int nVertexCount = m_numTriangles * 3;
// generate the vertex, texture and normal arrays
generateArrays();
// Generate And Bind The Vertex Buffer
m_pgp->glGenBuffersARB(1, &m_nVBOVertexArray); // Get A Valid Name
m_pgp->glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_nVBOVertexArray); // Bind The Buffer
// Load The Data (vertices, texture cords, colours and normals)
m_pgp->glBufferDataARB(GL_ARRAY_BUFFER_ARB,
nVertexCount * sizeof(vaVertexArray),
m_pvaVertexArray,
GL_STATIC_DRAW_ARB);
m_fVBOGenerated = true;
// generate a display list
m_vaDisplayList = glGenLists(1);
if(m_vaDisplayList == 0)
{
return;
}
glNewList(m_vaDisplayList, GL_COMPILE);
// Enable all client states we are using.
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
#ifndef NO_NORMALS
glEnableClientState(GL_NORMAL_ARRAY);
#endif
// Load the data to each pointer type we need.
m_pgp->glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_nVBOVertexArray);
glVertexPointer(3, GL_FLOAT, sizeof(vaVertexArray), BUFFER_OFFSET(0));
glTexCoordPointer(2, GL_FLOAT, sizeof(vaVertexArray), BUFFER_OFFSET(3*sizeof(float)));
#ifndef NO_NORMALS
glNormalPointer(GL_FLOAT, sizeof(vaVertexArray), BUFFER_OFFSET(5*sizeof(float)));
#endif
// Draw the entire object.
glDrawArrays(GL_TRIANGLES, 0, m_numTriangles*3);
// Disable all the client states we enabled.
glDisableClientState(GL_VERTEX_ARRAY);
#ifndef NO_NORMALS
glDisableClientState(GL_NORMAL_ARRAY);
#endif
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
// End the list creation.
glEndList();
// unbind any buffers
m_pgp->glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
It's crashing on the glDrawArrays command..
any ideas ??
I am using the latest catalyst drivers (3.10) available for download on the ATI site..
Jumpman - Under Construction
[edited by - Jumpman on January 6, 2004 2:20:18 AM]
Problem with VBO on ATI
over the weekend I bought myself a ATI 9600XT Radeon.. (I had a gf4mx before that) and since then, my model loader has been crashing when setting up the VBO's (which was working fine on the gforce card).
Here is the code which allocates the VBO and then feeds it the data (into a display list)..
Lol what a coincidence, i too bought a Radeon 9600 over the weekend, but my VBO''s seem to work fine.
I can''t help you with your problem, but I''m just curious: why are you putting VBO inside a DL? This is pretty useless and will slow things down, since for DLs it makes no difference if the data is in the VBO, vertex arrays or even immediate mode.
-Lev
-Lev
well in my initial tests (on the gforce).. there was a significant jump in fps in putting in the enabling client state into a DL..
if I use the same vertex data as an normal vertex array then it works fine (including putting it in a display list).. would like to understand why it''s crashing as VBO''s should really be used if possible..
if I use the same vertex data as an normal vertex array then it works fine (including putting it in a display list).. would like to understand why it''s crashing as VBO''s should really be used if possible..
How much data are you trying to load into the VBO? There is a limit but I think it varies by card/driver configuration. Try putting just a few vertices in there and see if it still crashes.
i think my largest object has about 1000 vertices , normals, texture cords etc..
will give it a go..
is there anyway to find out the maximum size of a VBO..
will give it a go..
is there anyway to find out the maximum size of a VBO..
tried it with just 10 tri''s and it''s still crashing out.. access violation in ATIOGLXX.DLL
bog standard va''s work fine.. hmm..
bog standard va''s work fine.. hmm..
do you have anything enabled usng EnableClientState where you haven''t specfied a pointer to? For instance i know my app crashes if i enable Normal_ARRAY but dont specify the data for it with NormalPointer. Maybe you accidentially enabled one of the other arrays but nevered turned it off ealier in your code; It''s probably not ur problem, but its a shot in the dark. Good luck with ur problem.
try something weird and use the normal pointers etc. (everything but vertex pointer) without enabling them. i had some pretty pointless crashes using vbo and fragment programs and for some reason not enabling normal/color arrays but just using them would not just not crash but for some reason even work correctly when it probably shouldnt.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement