18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-19 22:44:59 +01:00

Merge pull request #383 from MaSzyna-EU07/fix/legacy-ui-stale-texcoord

fix(renderer): the legacy renderer clears the arrays the scene left before it draws the ui
This commit is contained in:
maj00r
2026-11-16 13:30:31 +01:00
committed by GitHub

View File

@@ -419,6 +419,15 @@ opengl_renderer::Render() {
// add user interface
setup_units( true, false, false );
::glPushClientAttrib( GL_CLIENT_VERTEX_ARRAY_BIT );
// the arrays the scene left enabled point into the buffer of whatever was drawn last; the ui sets up
// the vertex, colour and texture coordinates of the active unit only, so the driver would go on reading
// the rest with the indices of the ui, past the end of that buffer once the ui has more vertices than it
for( auto const unit : m_geometry.units().texture ) {
::glClientActiveTexture( GL_TEXTURE0 + unit );
::glDisableClientState( GL_TEXTURE_COORD_ARRAY );
}
::glDisableClientState( GL_NORMAL_ARRAY );
::glDisableClientState( GL_COLOR_ARRAY );
::glClientActiveTexture( GL_TEXTURE0 + m_diffusetextureunit );
// clear state for ui