PDA

View Full Version : very large VBO and wrong points



adrien
06-22-2005, 05:18 AM
I'm using a very simple piece of code to render a VBO of vertices.
It works well for 1.000, 10.000,100.000 points.

But when using 1.000.000 points, a few of them are displayed with wrong coordinates.
It looks like one or several of their coordinates is/are set to 0, and the others are random. (just a guess from what it looks like). Some others are completely random.
On the radeon 9600, these 'wrong' points draw a circle on each xy or yz or xz planes, centered at 0, and of radius 0.5.

I know some people say VBO should not be too big... but what means 'should' ? I don't get any error from GL.

Any idea about that ?

I get the same strange results on an nvidia nvidia geforce fx 5700 and also on a radeon 9600...
(driver for the geforce at least are recent (less than 2 months)).

Relic
06-22-2005, 06:29 AM
If you get the same result on different vendors' graphics this points to an error in your code.
I would look for wrong mallocs, memcpy, for-loops etc.
Try if it works without VBOs just using vertex arrays.

adrien
06-22-2005, 07:30 AM
I guess you're right, but cannot find the problem. Code looks like :

float * coords5 = new float[NB_POINTS5*3];
for(i=0; i inf NB_POINTS5 ; ++i)
{
coords5[i*3+0] = (float) rand()/RAND_MAX -0.5f;
coords5[i*3+1] = (float) rand()/RAND_MAX -0.5f;
coords5[i*3+2] = (float) rand()/RAND_MAX -0.5f;
}

(i have a try catch and test for NULL return in my code)

Then i create the VBO like this :

glGenBuffersARB( 1, &nVBOVertices5 );
glBindBufferARB(GL_ARRAY_BUFFER_ARB,VBOVertices5);
glBufferDataARB( GL_ARRAY_BUFFER_ARB, NB_POINTS5*3*sizeof(float), coords5, GL_STATIC_DRAW_ARB );

and rendering is done via :
glBindBufferARB( GL_ARRAY_BUFFER_ARB, nVBOVertices5 );
glVertexPointer( 3, GL_FLOAT, 0, (char *) NULL );
glDrawArrays( GL_POINTS, 0, NB_POINTS5*3 );

there may be a stupid thing in this code... but can't see it..

Humus
06-22-2005, 03:02 PM
Originally posted by adrien:
glDrawArrays( GL_POINTS, 0, NB_POINTS5*3 );There. Should be NB_POINTS5, not NB_POINTS5*3.

adrien
06-22-2005, 10:35 PM
thanks much, i'll read the doc next time ;-)