Nothing is rendered.
So I'm like "okay, I could just be :tard: about VBO's since I've never used them before", so I switch over to using vertex arrays as my backup plan. For the OpenGL-inexperienced, that basically means commenting out a line of code and switching like 3 pointers around. Big deal.
The changes are made, yet nothing changes.
...
So now I'm like "fucking fuck fuck OpenGL fucking hell DIE DIE DIE". Here's the code of death that I'm working with right now - see if you can see an error (because I can't)
#pragma pack( 1 )struct _Vertex { float x, y; float tu, tv; float r, g, b;};#pragma pack()typedef std::vector<_Vertex> DataBuffer;DataBuffer _pendingData;int _primCount; glEnableClientState( GL_VERTEX_ARRAY ); glEnableClientState( GL_COLOR_ARRAY ); glEnableClientState( GL_TEXTURE_COORD_ARRAY ); glBindTexture( GL_TEXTURE_2D, _texture.tex ); //glBindBufferARB( GL_ARRAY_BUFFER, _bufferID ); glVertexPointer( 2, GL_FLOAT, sizeof( _Vertex ), &_pendingData.front() + (int)( 0 ) ); glTexCoordPointer( 2, GL_FLOAT, sizeof( _Vertex ), &_pendingData.front() + (int)( 2*sizeof( float ) ) ); glColorPointer( 3, GL_FLOAT, sizeof( _Vertex ), &_pendingData.front() + (int)( 4*sizeof( float ) ) ); glDrawArrays( GL_TRIANGLES, 0, _primCount ); glDisableClientState( GL_TEXTURE_COORD_ARRAY ); glDisableClientState( GL_COLOR_ARRAY ); glDisableClientState( GL_VERTEX_ARRAY );
Given - _pendingData is filled with correct data information, _texture.tex is a valid loaded texture, and _primCount contains the correct number of vertices in the array. The clearcolor is set to magenta, so its not like stuff is rendering in black and hiding on a black background.
I think I'm done with this shit for tonight, going to go binge on something. If you see an error fell free to comment, if not, I'm ripping out the whole wrapper class, comparing to old code, and fucking unit testing that whore until she bleeds.
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_COLOR_ARRAY );
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
glBindTexture( GL_TEXTURE_2D, _texture.tex );
glVertexPointer( 2, GL_FLOAT, sizeof( _Vertex ), VertexArray );
glTexCoordPointer( 2, GL_FLOAT, sizeof( _Vertex ), TexCoordArray );
glColorPointer( 3, GL_FLOAT, sizeof( _Vertex ), ColourArray );
glDrawArrays( GL_TRIANGLES, 0, _primCount );
glDisableClientState( GL_TEXTURE_COORD_ARRAY );
glDisableClientState( GL_COLOR_ARRAY );
glDisableClientState( GL_VERTEX_ARRAY );
You can do things using interleaved arrays like you wanted in the example. but I've never done it. Look up glInterleavedArrays(), that might be some help.