PDA

View Full Version : Rendering a list of structures - Advice



DragonSpawn
04-16-2005, 05:40 AM
Hiya,

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

I'm learning OpenGL and writing a graphics engine at the same time :) 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 :) Trying to figure out how a game would do it :)

Thanks

Paul

dorbie
04-17-2005, 10:28 PM
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.