A more efficient glVertex*

Started by
6 comments, last by Firecore 16 years, 1 month ago
Hi guys. I read that it is more efficient for the GPU to be given large batches of data to draw. I wanted to know, is it more efficient to call glVertexfv than glVertex3f?
Advertisement
Quote:Original post by Firecore
Hi guys.
I read that it is more efficient for the GPU to be given large batches of data to draw.
I wanted to know, is it more efficient to call glVertexfv than glVertex3f?


You probably don't want to use any of the immediate mode commands--they are far too slow. You should look into vertex arrays and Vertex Buffer Objects for supplying geometry to your GPU.
Quote:Original post by mhamlin
You probably don't want to use any of the immediate mode commands--they are far too slow. You should look into vertex arrays and Vertex Buffer Objects for supplying geometry to your GPU.


hi.
um i saw the site.
but how do i use the function?
There's quite a few VBO tutorials out there, but I recall this one was the best out of the ones I came across.
hi.
saw the turorial.
it was pretty good.
i wanted to kno, is it efficient 2 update the vbo every frame?
Efficiency is a relative term. If you are supplying the same data each time, then no, and it's also pointless. If it is necessary to update it each frame with different values then you have little other alternative.
Quote:Original post by Firecore
hi.
saw the turorial.
it was pretty good.
i wanted to kno, is it efficient 2 update the vbo every frame?


In that case I recommend 2 VBOs. One from which you render and one that you update. On the next frame, switch the VBOs around.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Quote:Original post by V-man
Quote:Original post by Firecore
hi.
saw the turorial.
it was pretty good.
i wanted to kno, is it efficient 2 update the vbo every frame?


In that case I recommend 2 VBOs. One from which you render and one that you update. On the next frame, switch the VBOs around.


aahhh.
i see.
thanx guys.
uve been a big help

This topic is closed to new replies.

Advertisement