WIP: is okay mais pas encore bien structuré
This commit is contained in:
parent
ecd3ed98fc
commit
4f766689ee
|
@ -77,89 +77,32 @@ static void graphics_debug_callback(GLenum source, GLenum type, GLuint id,
|
|||
GLenum code;
|
||||
|
||||
switch (source) {
|
||||
case GL_DEBUG_SOURCE_API:
|
||||
errsource = "API";
|
||||
break;
|
||||
|
||||
case GL_DEBUG_SOURCE_WINDOW_SYSTEM:
|
||||
errsource = "WINDOW SYSTEM";
|
||||
break;
|
||||
|
||||
case GL_DEBUG_SOURCE_SHADER_COMPILER:
|
||||
errsource = "SHADER COMPILER";
|
||||
break;
|
||||
|
||||
case GL_DEBUG_SOURCE_THIRD_PARTY:
|
||||
errsource = "THIRD PARTY";
|
||||
break;
|
||||
|
||||
case GL_DEBUG_SOURCE_APPLICATION:
|
||||
errsource = "APPLICATION";
|
||||
break;
|
||||
|
||||
case GL_DEBUG_SOURCE_OTHER:
|
||||
errsource = "UNKNOWN";
|
||||
break;
|
||||
|
||||
default:
|
||||
errsource = "UNKNOWN";
|
||||
break;
|
||||
case GL_DEBUG_SOURCE_API: errsource = "API"; break;
|
||||
case GL_DEBUG_SOURCE_WINDOW_SYSTEM: errsource = "WINDOW SYSTEM"; break;
|
||||
case GL_DEBUG_SOURCE_SHADER_COMPILER: errsource = "SHADER COMPILER"; break;
|
||||
case GL_DEBUG_SOURCE_THIRD_PARTY: errsource = "THIRD PARTY"; break;
|
||||
case GL_DEBUG_SOURCE_APPLICATION: errsource = "APPLICATION"; break;
|
||||
case GL_DEBUG_SOURCE_OTHER: errsource = "UNKNOWN"; break;
|
||||
default: errsource = "UNKNOWN"; break;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case GL_DEBUG_TYPE_ERROR:
|
||||
errtype = "ERROR";
|
||||
break;
|
||||
|
||||
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR:
|
||||
errtype = "DEPRECATED BEHAVIOR";
|
||||
break;
|
||||
|
||||
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR:
|
||||
errtype = "UNDEFINED BEHAVIOR";
|
||||
break;
|
||||
|
||||
case GL_DEBUG_TYPE_PORTABILITY:
|
||||
errtype = "PORTABILITY";
|
||||
break;
|
||||
|
||||
case GL_DEBUG_TYPE_PERFORMANCE:
|
||||
errtype = "PERFORMANCE";
|
||||
break;
|
||||
|
||||
case GL_DEBUG_TYPE_OTHER:
|
||||
errtype = "OTHER";
|
||||
break;
|
||||
|
||||
case GL_DEBUG_TYPE_MARKER:
|
||||
errtype = "MARKER";
|
||||
break;
|
||||
|
||||
default:
|
||||
errtype = "UNKNOWN";
|
||||
break;
|
||||
case GL_DEBUG_TYPE_ERROR: errtype = "ERROR"; break;
|
||||
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: errtype = "DEPRECATED BEHAVIOR";break;
|
||||
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: errtype = "UNDEFINED BEHAVIOR"; break;
|
||||
case GL_DEBUG_TYPE_PORTABILITY: errtype = "PORTABILITY"; break;
|
||||
case GL_DEBUG_TYPE_PERFORMANCE: errtype = "PERFORMANCE"; break;
|
||||
case GL_DEBUG_TYPE_OTHER: errtype = "OTHER"; break;
|
||||
case GL_DEBUG_TYPE_MARKER: errtype = "MARKER"; break;
|
||||
default: errtype = "UNKNOWN"; break;
|
||||
}
|
||||
|
||||
switch (severity) {
|
||||
case GL_DEBUG_SEVERITY_HIGH:
|
||||
errseverity = "CRITICAL";
|
||||
break;
|
||||
|
||||
case GL_DEBUG_SEVERITY_MEDIUM:
|
||||
errseverity = "ERROR";
|
||||
break;
|
||||
|
||||
case GL_DEBUG_SEVERITY_LOW:
|
||||
errseverity = "WARNING";
|
||||
break;
|
||||
|
||||
case GL_DEBUG_SEVERITY_NOTIFICATION:
|
||||
errseverity = "INFO";
|
||||
break;
|
||||
|
||||
default:
|
||||
errseverity = "UNKNOWN";
|
||||
break;
|
||||
case GL_DEBUG_SEVERITY_HIGH: errseverity = "CRITICAL"; break;
|
||||
case GL_DEBUG_SEVERITY_MEDIUM: errseverity = "ERROR"; break;
|
||||
case GL_DEBUG_SEVERITY_LOW: errseverity = "WARNING"; break;
|
||||
case GL_DEBUG_SEVERITY_NOTIFICATION: errseverity = "INFO"; break;
|
||||
default: errseverity = "UNKNOWN"; break;
|
||||
}
|
||||
|
||||
code = glGetError();
|
||||
|
@ -555,11 +498,11 @@ bool pref_mark_unit_space_zero = 0; // default == 0 == no mark
|
|||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
static void get_model_data_and_user_preferences(){
|
||||
// The model data to read
|
||||
// {1, 1, 0, 1, 2, 1, 1, 1, 10, 1, 2, 11, 1, 1, 20, 1, 2, 21}; < from model.xml
|
||||
// The model data (arrows) to use ( from model.xml)
|
||||
// { 1, 1, 0, 1, 2, 1, 1, 1, 10, 1, 2, 11, 1, 1, 20, 1, 2, 21 };
|
||||
|
||||
dim = 1;
|
||||
state_size = 8; // 2 < state_size < 32
|
||||
state_size = 9; // 2 < state_size < 32
|
||||
arrows_nb = 4; // assert : leur emplacement doit être fonction de state_size
|
||||
|
||||
pref_3D_xor_2D_space = 0; // default == 0 == 3D
|
||||
|
@ -574,13 +517,8 @@ static void compute_vertex_colors_lines_plans_nb(int dim,
|
|||
bool pref_3D_xor_2D_arrows,
|
||||
bool pref_mark_unit_space_zero,
|
||||
struct gl_area_entry *entry){
|
||||
vertex_nb = (state_size + 1) * 6 + arrows_nb * 9;
|
||||
vertex_nb = (state_size + 1) * 12 + arrows_nb * 15;
|
||||
|
||||
colors_nb = (state_size + 1) * 12 + arrows_nb * 0; // TODO
|
||||
|
||||
printf("Prefer : mark_unit_space_zero = %d pref_3D_xor_2D_space = %d state_size = %d\n",
|
||||
pref_mark_unit_space_zero, pref_3D_xor_2D_space, state_size);
|
||||
if (pref_3D_xor_2D_space) vertex_nb = (state_size + 1) * 6 + arrows_nb * 9; // case 2D
|
||||
else vertex_nb = (state_size + 1) * 12 + arrows_nb * 15; // case 3D
|
||||
|
||||
if (pref_3D_xor_2D_space) lines_nb = (2 + state_size) + (arrows_nb * 3); // case 2D
|
||||
else lines_nb = (4 + state_size * 4) + (arrows_nb * 8); // case 3D
|
||||
|
@ -592,8 +530,13 @@ static void compute_vertex_colors_lines_plans_nb(int dim,
|
|||
entry->line_indices_nb = lines_nb * 2;
|
||||
entry->plan_indices_nb = plans_nb * 3;
|
||||
|
||||
colors_nb = (state_size + 1) * 12 + arrows_nb * 0; // TODO
|
||||
|
||||
assert(state_size * 6 < vertex_nb); assert(state_size * 6 + 5 < vertex_nb);
|
||||
|
||||
printf("Prefer : mark_unit_space_zero = %d pref_3D_xor_2D_space = %d state_size = %d\n",
|
||||
pref_mark_unit_space_zero, pref_3D_xor_2D_space, state_size);
|
||||
|
||||
printf("Initialization of buffers with %u line_ndx, %u vertices and %u colors & state_size = %d\n",
|
||||
entry->line_indices_nb, vertex_nb, colors_nb, state_size);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue