Rendering a list of structures - Advice

Hiya,

Not sure if this is the right place but I thought I’d ask OpenGL programmers :slight_smile:

I’m learning OpenGL and writing a graphics engine at the same time :slight_smile: I’ve defined a structure in a text file and a world in another file.

In my program I read a list of required structures and their locations from the world file. Now is this the way its done: For each required structure I will create an instance of class structure, storing all the details in the instance from the file including an array of locations for the structure to be placed. Each instance of structure I create, I will store in an array ‘StructureList’.

Then when its time to render, I will go from the structure array rendering all the structures in their instances.

Any advice / help would be grateful :slight_smile: Trying to figure out how a game would do it :slight_smile:

Thanks

Paul

That’s one way.

Generally it’s kinda done with a generic object type and the object has info like location and orientation and a member/pointer to detailed geometry, the geometry can be shared.

Your approach if I understand it is inherently sorted by object type which is actually good for state management, a more generic object approach tends to require sorting, yours will too but probably a bit less so.

I suggest you take a look at Open Scene Ggraph.

http://www.openscenegraph.com/pmwiki.php/Home/Home

I’m moving this thread to the scene graph/higher level topics section.