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

Rendering models with vertex arrays

This topic is 3320 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

Hello people. I'm trying to optimize my game using vertex vertex arrays. I'm doing this in Half-Life, so I have to convert the studio model format to something I can use with vertex arrays. What I do is multiply shared vertices whenever it's necessary, and then I arrange the triangle indexes so that I can directly render them with the vertex arrays. For the duplicated vertices, I add Now, when I render the models, I transform the original number vertices, and calculate lightvalues for each vertex normal. After this is done, I arrange the lightvalues paralell to the vertex indexes, and I copy the positions of the extra vertices over from their original indexes' positions. Finally, I set the color and vertex pointers, and I render each of the meshes that have a different texture. I use a glDrawElements call for this. The problem is, that even if I cancel out vertex transformations and lightvalue calculations and only render the objects untransformed, my rendering is still a lot slower than the immediate method. I'd like to ask if anyone has a suggestion, because I'm in trouble with this. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Andrew Lucas
Now, when I render the models, I transform the original number vertices, and calculate lightvalues for each vertex normal. After this is done, I arrange the lightvalues paralell to the vertex indexes, and I copy the positions of the extra vertices over from their original indexes' positions.

You do this every frame? If so, why? If your data isn't highly dynamic I'd suggest doing once at load time. And if it is dynamic, I guess it would be the coordinates, normals etc. rather than the overall array layout (number of vertices, indices etc.).

Why are you doing lighting calculations and/or transformations in software (on the CPU)? Are you doing anything fancy that isn't possible with standard T&L or shaders?

Share this post


Link to post
Share on other sites
Hehe.

What I do for each vertex is first add the ambient and shade lighting, and then add light from dynamic lights in. This is lighting. Now, after this I transform vertices by their bone matrices. I'm quite unsure wether this is possible to do using shaders, because to be honest I haven't worked with shaders yet, and I have yet to read any tutorials.

Thanks.
Andrew.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!