Jump to content
  • Advertisement
Sign in to follow this  
MrSimon

OpenGL Efficient vertex arrays

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

Hi all,

I'm new to this site and c++ programming and openGL and, well, all of this. But I have been making steady progress. I'm fairly confident with c++ (syntax not withstanding) and have gotten to the stage where I can create a window, create some objects and move them about. I'm now going over what I now and trying to make it as efficient and functional as possible.

So far I have progressed from entering all object generation methods between glBegin and glEnd tags directly in may game loop, to creating object generation classes for much simpler object specification. I am now trying to creating a method that enables polygons and objects to share vertex references, minimising the number of necessary calls.

This is the bit I need a little guidance on.

What I am hoping to do is the following:

Create an array of vertices for each object (the vertex array will also hold normal, texture, etc information).
Create an array of vertex references.
Construct objects using vertex references, enabling my polygons to share vertexes.
Add simple functions for constructing and manipulating objects.

I'm pretty comfortable with all of this, however I was wondering how sensible this approach is; whether it is the most efficient way of doing this, whether I have forgotten or overlooked something, or whether the openGL vertex array method would render this approach redundant.

I've looked through the specification regarding the openGL vertex array method and am assuming it basically does what I am intending to do, though (I think) in a slightly less efficient way.

I've also read somewhere suggesting that using glBegin/glEnd is to be avoided. The draw functions within my object generation class would use this method, though it would be specifying vertex data through references, rather than literals.

Also using my own vertex and reference arrays, I am making my classes a bit more universal ( i.e. not so bound to openGL). In case that matters. Am I correct I'm this assumption?

Does anyone have any suggest/advice/input?

I'm eager to do as much of this myself as possible, but I certainly don't want to start getting myself into any bad habits.

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!