Efficient vertex arrays

Started by
-1 comments, last by MrSimon 12 years, 1 month ago
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.

This topic is closed to new replies.

Advertisement