Vertex Arrays or Vertex Programs???

Started by
16 comments, last by HellRaiZer 20 years, 11 months ago
Lighting is enabled by caling glEnable(GL_LIGHTING); If you havn''t called that, you arn''t performing light calculations!
VP is efficient if you have GF3 up & want to perform lighnting on GPU, GF2 has vp emulated on CPU through the driver!

Use vertexarrays + tristrips for complicated geometry, that''s the fastest possible method (vbo/va) could be faster, but they remove AGP transfer mainly!

BTW, could someone tell me what was syntax for texture pointers when using multitexturing? glMultiTexCoordPointer0, glMultiTexCoordPointer1 etc.?

______________________________
Madman
______________________________Madman
Advertisement
You still don't get it

1.) A vertex program will NEVER be faster than the fixed function pipeline (but can be as fast on modern hardware)
2.) OpenGL immediate calls are slow, it doesn't matter if you use vertex programs or not
3.) You NEED to use vertex arrays or better something like nVidia VAR/ATi VAO or ARB_VBO to achive good performance. There is no way around that with the use of vertex programs

[edited by - novum on May 6, 2003 9:28:53 AM]
quote:Original post by Brother Bob
You can't generate vertices in a vertex program, only modify existing vertices. So at least you will have to provide dummy vertices for the vertex program to process, and how do you do that? Through vertex arrays?


quite a shame.. there would be lots of situations were one would prefer to just generate them on the fly. but as they seem to work in a quite simple way (one in, one out).. bad luck ,-)

oh. and if you really care about performance.. forget the fact that glvertex exists..

[edited by - Trienco on May 6, 2003 9:42:57 AM]
f@dzhttp://festini.device-zero.de
If you care about performance even the smallest bit, completely forget about immediate mode and go for vertex arrays. Efficient use of vertex arrays completely outperforms even the most clever use of immediate mode.

As noVum said, the use of vertex program is not going to make immediate mode efficient. So if you only want one of them, you want vertex arrays. Immediate mode should never even be an option.
the simplest vp you could get away with would just transform the incoming verticies.


!!ARBvp1.0
ATTRIB vertexPosition = vertex.position;

TEMP transformedPosition;

DP4 transformedPosition.x, state.matrix.mvp.row[0], vertexPosition;
DP4 transformedPosition.y, state.matrix.mvp.row[1], vertexPosition;
DP4 transformedPosition.z, state.matrix.mvp.row[2], vertexPosition;
DP4 transformedPosition.w, state.matrix.mvp.row[3], vertexPosition;

MOV result.position, transformedPosition;

END


I don''t know if it will be any faster than the standard pipeline stage (Which most likely just does the same thing, assuming that you have GL_LIGHTING, etc... disabled). You must supply the vertex data in one way or another since number of incoming verticices == number of out going verticies (as was stated earlier).
Trienco:
oh. and if you really care about performance.. forget the fact that glvertex exists..


I just wanted to futher support this statement. It might be the single most important statement a newbie openGL coder could ever remember.


super genius
quote:Original post by _Madman_
BTW, could someone tell me what was syntax for texture pointers when using multitexturing? glMultiTexCoordPointer0, glMultiTexCoordPointer1 etc.?


glActiveTexture(GL_TEXTURE2_ARB);
glTexCoordPointer(...);
glActiveTexture(GL_TEXTURE1_ARB);
glTexCoordPointer(...);
glActiveTexture(GL_TEXTURE0_ARB);
glTexCoordPointer(...);

---I write code.DelphiGL (http://delphigl.cfxweb.net)
Thanks for the replies!!!

I''ll try to forget everything about glVertex3f, and "convert" my rendering to vertex arrays!! I''ll leave vertex programs for now...

Thanks again!

HellRaiZer

PS. BTW does anyone know how i can use WGL_ARB_pixel_format? It is a little complicated, because you have to have a HGLRC before getting any extensions, and if you have a rc, then you already have a pixel format. I tried it, by creating a temporary window, but when i tried to get every pixel format supported, the returned value was zero!!!!! Do you have any idea???

Thanks.

HellRaiZer
HellRaiZer

This topic is closed to new replies.

Advertisement