Tech ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES renamed as ENABLE_GL_SHADERS_ATTRIBUTES

This commit is contained in:
enricoturri1966 2022-03-09 08:22:07 +01:00
parent 5ffe010a9d
commit 46283cfde3
37 changed files with 706 additions and 735 deletions
src/slic3r/GUI

View file

@ -985,14 +985,14 @@ void GLModel::render(const std::pair<size_t, size_t>& range)
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, m_render_data.vbo_id));
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
#if ENABLE_GL_SHADERS_ATTRIBUTES
int position_id = -1;
int normal_id = -1;
int tex_coord_id = -1;
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
if (position) {
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
#if ENABLE_GL_SHADERS_ATTRIBUTES
position_id = shader->get_attrib_location("v_position");
if (position_id != -1) {
glsafe(::glVertexAttribPointer(position_id, Geometry::position_stride_floats(data.format), GL_FLOAT, GL_FALSE, vertex_stride_bytes, (GLvoid*)Geometry::position_offset_bytes(data.format)));
@ -1001,10 +1001,10 @@ void GLModel::render(const std::pair<size_t, size_t>& range)
#else
glsafe(::glVertexPointer(Geometry::position_stride_floats(data.format), GL_FLOAT, vertex_stride_bytes, (const void*)Geometry::position_offset_bytes(data.format)));
glsafe(::glEnableClientState(GL_VERTEX_ARRAY));
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
}
if (normal) {
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
#if ENABLE_GL_SHADERS_ATTRIBUTES
normal_id = shader->get_attrib_location("v_normal");
if (normal_id != -1) {
glsafe(::glVertexAttribPointer(normal_id, Geometry::normal_stride_floats(data.format), GL_FLOAT, GL_FALSE, vertex_stride_bytes, (GLvoid*)Geometry::normal_offset_bytes(data.format)));
@ -1013,10 +1013,10 @@ void GLModel::render(const std::pair<size_t, size_t>& range)
#else
glsafe(::glNormalPointer(GL_FLOAT, vertex_stride_bytes, (const void*)Geometry::normal_offset_bytes(data.format)));
glsafe(::glEnableClientState(GL_NORMAL_ARRAY));
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
}
if (tex_coord) {
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
#if ENABLE_GL_SHADERS_ATTRIBUTES
tex_coord_id = shader->get_attrib_location("v_tex_coord");
if (tex_coord_id != -1) {
glsafe(::glVertexAttribPointer(tex_coord_id, Geometry::tex_coord_stride_floats(data.format), GL_FLOAT, GL_FALSE, vertex_stride_bytes, (GLvoid*)Geometry::tex_coord_offset_bytes(data.format)));
@ -1025,7 +1025,7 @@ void GLModel::render(const std::pair<size_t, size_t>& range)
#else
glsafe(::glTexCoordPointer(Geometry::tex_coord_stride_floats(data.format), GL_FLOAT, vertex_stride_bytes, (const void*)Geometry::tex_coord_offset_bytes(data.format)));
glsafe(::glEnableClientState(GL_TEXTURE_COORD_ARRAY));
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
}
shader->set_uniform("uniform_color", data.color);
@ -1034,7 +1034,7 @@ void GLModel::render(const std::pair<size_t, size_t>& range)
glsafe(::glDrawElements(mode, range.second - range.first, index_type, (const void*)(range.first * Geometry::index_stride_bytes(data.format))));
glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
#if ENABLE_GL_SHADERS_ATTRIBUTES
if (tex_coord_id != -1)
glsafe(::glDisableVertexAttribArray(tex_coord_id));
if (normal_id != -1)
@ -1048,7 +1048,7 @@ void GLModel::render(const std::pair<size_t, size_t>& range)
glsafe(::glDisableClientState(GL_NORMAL_ARRAY));
if (position)
glsafe(::glDisableClientState(GL_VERTEX_ARRAY));
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
}
@ -1065,11 +1065,11 @@ void GLModel::render_instanced(unsigned int instances_vbo, unsigned int instance
GLShaderProgram* shader = wxGetApp().get_current_shader();
#if ENABLE_LEGACY_OPENGL_REMOVAL
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
#if ENABLE_GL_SHADERS_ATTRIBUTES
if (shader == nullptr || !boost::algorithm::iends_with(shader->get_name(), "_instanced_attr"))
#else
if (shader == nullptr || !boost::algorithm::iends_with(shader->get_name(), "_instanced"))
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
return;
// vertex attributes