Jump to content
  • Advertisement
Sign in to follow this  
Andrew Lucas

OpenGL glArrayElement or glVertex3fv

This topic is 3193 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been into a dilemma lately. Before I render my models, for each submodel(a collection of meshes, wich are parts of the model with different textures), I need to transform each vertex and normal before I render. Now, the most efficient way for me would be to upload the vertexes into a vertex array before I render, and when I render each of the individual meshes, after I pass down the texture coords and a normal value, I should just call glArrayElement. This sounds great at first, because instead of passing down a vertex coord for each triangle index, I only upload all of them to the GPU before rendering, and then I just tell OpenGL wich vertex to draw with. Now, my problem is, that I can't really see any fps increase, in fact I fear that it might be slower. Does anyone have any real experiences with glArrayElement? I'd like to know if someone has a suggestion for this. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
So you are concerned about performance, and you chose between the two slowest methods there are? The answer to glArrayElement or glVertex3fv is, in that case, glDrawArrays or glDrawElements.

Share this post


Link to post
Share on other sites
Quote:
Original post by Andrew Lucas
I need to transform each vertex and normal before I render.


Sounds like something a vertex shader would be exceptionally good at

Share this post


Link to post
Share on other sites
Quote:
So you are concerned about performance, and you chose between the two slowest methods there are? The answer to glArrayElement or glVertex3fv is, in that case, glDrawArrays or glDrawElements.


The problem is that I'm using many shared vertexes, and if I made a duplicate vertex for each texture coordinate and normal, I'd basically end up with even worse performance.

Quote:
Sounds like something a vertex shader would be exceptionally good at


The problem is, that I'm already doing per-vertex lighting calculations on the GPU, and when taking v20 or lower shader profiles into case, I've already taken up most of my space. The model format I have to use allows for 128x3x4 matrices for bones, wich of course is too much to upload to the GPU. I'd need to cut up meshes too much for this to work properly, and I fear that I'd end up with just as low performance.

Share this post


Link to post
Share on other sites
Quote:
Original post by Andrew Lucas
Quote:
So you are concerned about performance, and you chose between the two slowest methods there are? The answer to glArrayElement or glVertex3fv is, in that case, glDrawArrays or glDrawElements.


The problem is that I'm using many shared vertexes, and if I made a duplicate vertex for each texture coordinate and normal, I'd basically end up with even worse performance.

You already have to do that with glArrayElement, so if that function is an option for you, then so are glDrawElements and glDrawArrays. If you are concerned about duplicating entries, then glArrayElement isn't an option in the first place, and your question is already answered.

Have you verified that duplicating entries is actually a problem, or are you just assuming it will be?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!