Sign in to follow this  

Vertex pointers - Coming up empty handed

Recommended Posts

oOJoshOo    122
I've got some vertex pointer code down that's supposed to be drawing a cube to the screen. However, when I run it, I come up empty handed. It's based on the NeHe VBO code. Each draw cycle it does the following: if(g_fVBOSupported) { glBindBufferARB(GL_ARRAY_BUFFER_ARB, g_pMesh->m_nVBOVertices); glVertexPointer(3, GL_FLOAT, 0, (char*)NULL); glBindBufferARB(GL_ARRAY_BUFFER_ARB, g_pMesh->m_nVBOTexCoords); glTexCoordPointer(2, GL_FLOAT, 0, (char*)NULL); } else { glVertexPointer(3, GL_FLOAT, 0, g_pMesh->m_pVertices); glTexCoordPointer(2, GL_FLOAT, 0, g_pMesh->m_pTexCoords); } glDrawArrays(GL_TRIANGLES, 0, g_pMesh->m_nVertexCount); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); Now, though this is code for a VBO with vertex pointer fallback, on my computer I find after querying for the VBO extension, I really don't have it. I don't know if that's because I haven't kept some files to date or because my hardware isn't particularly good - which is entirely possible, because I am on a Tablet PC. The thing is, after calling glDrawArrays, my screen is still black. The only other relevant code is for the setup of g_pMesh->m_nVBOVertices and g_pMesh->m_nVBOTexCoords, so I'll give you that as well. m_nVertexCount = 36; // 3 verts * 2 tris * 6 faces m_pVertices = new CVec[m_nVertexCount]; m_pTexCoords = new CTexCoord[m_nVertexCount]; m_pVertices[0].x = -1.0f; m_pVertices[0].y = -1.0f; m_pVertices[0].z = 1.0f; m_pTexCoords[0].u = 0.0f; m_pTexCoords[0].v = 0.0f; m_pVertices[1].x = 1.0f; m_pVertices[1].y = -1.0f; m_pVertices[1].z = 1.0f; m_pTexCoords[1].u = 1.0f; m_pTexCoords[1].v = 0.0f; ... This goes on for a while, but I'll skip the rest. If anyone really cares to know, I copied the numbers for the cube from NeHe's texture map tutorial. Does anyone have any idea? Thanks for your time, Josh

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this