franck22000 Posted May 18, 2012 Share Posted May 18, 2012 Hello, i am currently adding Gwen Gui into my game everything is working fine so far but i got a weird rendering artifact on some models (depending of the angle of the camera) if i render the Gui. Look at those images (dont pay attention to the weird rendering of the text): I have identified the code responsible of this in the openGL renderer of Gwen Gui, it is this code: glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(Vertex), (void*)&m_Vertices[0].r ); glEnableClientState( GL_COLOR_ARRAY ); if i comment this code portion the bug is solved but some part of the gui that need this is getting weird. Is there any solution to fix this small code portion ? Here is the the whole function if it can help: void OpenGL::Flush() { if ( m_iVertNum == 0 ) return; glVertexPointer( 3, GL_FLOAT, sizeof(Vertex), (void*) &m_Vertices[0].x ); glEnableClientState( GL_VERTEX_ARRAY ); // This 2 lines make the weird rendering artifact glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(Vertex), (void*)&m_Vertices[0].r ); glEnableClientState( GL_COLOR_ARRAY ); glTexCoordPointer( 2, GL_FLOAT, sizeof(Vertex), (void*) &m_Vertices[0].u ); glEnableClientState( GL_TEXTURE_COORD_ARRAY ); glDrawArrays( GL_TRIANGLES, 0, (GLsizei) m_iVertNum ); m_iVertNum = 0; glFlush(); } Thanks ! Quote You guys are going to be the death of me. Josh Link to comment Share on other sites More sharing options...
Josh Posted May 18, 2012 Share Posted May 18, 2012 All those calls to glEnableClientState() should have a corresponding call to glDisableClientState after the call to glDrawArrays(). Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
franck22000 Posted May 18, 2012 Author Share Posted May 18, 2012 Thanks a lot Josh it is working now ! Quote You guys are going to be the death of me. Josh Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.