Tech ENABLE_GLBEGIN_GLEND_REMOVAL - Fixed a few bugs when the tech is disabled

This commit is contained in:
enricoturri1966 2022-03-02 13:28:20 +01:00
parent 5193a15852
commit 4990558dee
3 changed files with 14 additions and 23 deletions

View File

@ -593,10 +593,7 @@ void Bed3D::render_texture(bool bottom, GLCanvas3D& canvas)
if (bottom)
glsafe(::glFrontFace(GL_CW));
unsigned int stride = m_triangles.get_vertex_data_size();
GLint position_id = shader->get_attrib_location("v_position");
GLint tex_coords_id = shader->get_attrib_location("v_tex_coords");
const unsigned int stride = m_triangles.get_vertex_data_size();
// show the temporary texture while no compressed data is available
GLuint tex_id = (GLuint)m_temp_texture.get_id();
@ -606,22 +603,16 @@ void Bed3D::render_texture(bool bottom, GLCanvas3D& canvas)
glsafe(::glBindTexture(GL_TEXTURE_2D, tex_id));
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, m_vbo_id));
if (position_id != -1) {
glsafe(::glEnableVertexAttribArray(position_id));
glsafe(::glVertexAttribPointer(position_id, 3, GL_FLOAT, GL_FALSE, stride, (GLvoid*)(intptr_t)m_triangles.get_position_offset()));
}
if (tex_coords_id != -1) {
glsafe(::glEnableVertexAttribArray(tex_coords_id));
glsafe(::glVertexAttribPointer(tex_coords_id, 2, GL_FLOAT, GL_FALSE, stride, (GLvoid*)(intptr_t)m_triangles.get_tex_coords_offset()));
}
glsafe(::glVertexPointer(3, GL_FLOAT, stride, (const void*)(intptr_t)m_triangles.get_position_offset()));
glsafe(::glEnableClientState(GL_VERTEX_ARRAY));
glsafe(::glTexCoordPointer(2, GL_FLOAT, stride, (const void*)(intptr_t)m_triangles.get_tex_coords_offset()));
glsafe(::glEnableClientState(GL_TEXTURE_COORD_ARRAY));
glsafe(::glDrawArrays(GL_TRIANGLES, 0, (GLsizei)m_triangles.get_vertices_count()));
if (tex_coords_id != -1)
glsafe(::glDisableVertexAttribArray(tex_coords_id));
if (position_id != -1)
glsafe(::glDisableVertexAttribArray(position_id));
glsafe(::glDisableClientState(GL_TEXTURE_COORD_ARRAY));
glsafe(::glDisableClientState(GL_VERTEX_ARRAY));
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
glsafe(::glBindTexture(GL_TEXTURE_2D, 0));

View File

@ -1195,11 +1195,11 @@ void TriangleSelectorGUI::render_debug(ImGuiWrapper* imgui)
m_varrays[i].init_from(std::move(varrays_data[i]));
}
#else
for (auto* iva : { &m_iva_enforcers, &m_iva_blockers })
iva->finalize_geometry(true);
for (auto& iva : m_iva_seed_fills)
iva.finalize_geometry(true);
// for (auto* iva : { &m_iva_enforcers, &m_iva_blockers })
// iva->finalize_geometry(true);
//
// for (auto& iva : m_iva_seed_fills)
// iva.finalize_geometry(true);
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL

View File

@ -245,7 +245,7 @@ void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking)
m_cylinder.set_color(render_color);
#else
m_cylinder.set_color(-1, render_color);
if (shader != nu)
if (shader != nullptr)
#endif // ENABLE_GLBEGIN_GLEND_REMOVAL
shader->set_uniform("emission_factor", 0.5f);
for (const sla::DrainHole& drain_hole : m_c->selection_info()->model_object()->sla_drain_holes) {