Original Post
Ok guys, I've searched the internet, forums (including these ones), documentation, I just dont know what to do. I was making a sort of VBO wrapper, and everything was going nice and smooth until I realized it didn't work lol. So basically my problem is, the whole glVertexPointer thing. Your supposed to pass an offset to the buffer as the last argument, but when I do that, it just crashes. It only works if I pass the pointer to the vertices in it, like a normal vertex array. I am binding buffers before I make these calls, and im not really sure what the problem is so maybe someone can help me out. Ill paste a compact version of my code too eVboID is just an enum I pass to find out which buffer im going to be using. I was setting up this wrapper so you could pass in a buffer id to setup vertices, indices, texture verts, and normals int CVBO :: Create( eVboID eID, eVboType eType, int iNumOfVerts ) { if ( iNumOfVerts < 3 ) return 1; VBO_t* pCurrent = GetObj( eID ); if ( pCurrent != NULL ) { pCurrent->m_NumOfVerts = iNumOfVerts; glGenBuffersARB( 1, &pCurrent->m_ID ); if ( !glIsBufferARB( pCurrent->m_ID ) ) return 1; //Not techincally created until data //has been written to the buffer pCurrent->Created = false; } return 0; } void CVBO :: WriteNewBufferData( eVboID eID, int iNewSize, const void* cvpVerts ) { GLenum BindFlag = Bind( eID ); VBO_t* pCurrent = GetObj( eID ); if ( pCurrent == NULL ) return; if ( pCurrent->m_ID == 0 ) return; int NumSize = 0; if ( iNewSize > 3 ) { pCurrent->m_NumOfVerts = iNewSize; if ( eID == ID_TEXVERTS ) NumSize = iNewSize * 2; else NumSize = iNewSize * 3; if ( eID == ID_INDICIES ) NumSize *= sizeof( unsigned int ); else NumSize *= sizeof( float ); } glBufferDataARB( BindFlag, NumSize, cvpVerts, GetVboType( eTU_Draw ) ); //Set a pointer to the verts, vbos not working pCurrent->m_pVerts = (float*)cvpVerts; Unbind(); pCurrent->Created = true; } void CVBO :: DrawBuffer( GLenum ePolygonType ) { if ( m_Verts.Created ) { glEnableClientState( GL_VERTEX_ARRAY ); Bind( ID_VERTS ); //glVertexPointer( 3, GL_FLOAT, 0, m_Verts.m_pVerts ); glVertexPointer( 3, GL_FLOAT, 0, (char*)NULL ); Unbind(); glDrawArrays( ePolygonType, 0, m_Verts.m_NumOfVerts ); } if ( m_Verts.Created ) glDisableClientState( GL_VERTEX_ARRAY ); Unbind(); } Ok so thats pretty much it, I know theres a cool way to put it in a code window, but I dont know how and its like 2:20 in the morning, so im really tired, and desperate. I've been trying to figure this out for a while, I just want to get back to normal programming again lol so someone help me k thnx :) heh heh