Jump to content

Recommended Posts

Posted

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):

 

5686cf190928061.jpg f6e146190928094.jpg

 

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 !

You guys are going to be the death of me. Josh
Posted

All those calls to glEnableClientState() should have a corresponding call to glDisableClientState after the call to glDrawArrays().

My job is to make tools you love, with the features you want, and performance you can't live without.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...