PDA

View Full Version : OpenGL and OOP



marco1475
05-10-2005, 05:34 AM
Hi!

I have some experience with OpenGL, but I always programmed it in one file, C-style. Now I would like to create classes etc., however, I have no clue how to start/do that.

What should a OpenGL class have? I would like to have a class for my 3D objects (which will be loaded from 3DS files) where I can store their vertices and ... what else? What is the best (performance-wise) way to store vertices? What should the class have (texturing, lighting, ...)?

Any pointers/help would be appreciated,

CWiC
05-11-2005, 07:45 AM
There are many approaches to establish the architecture of classes for work with OpenGL. It depends on many factors and require big amount of knowlage about 3d graphics, hardware capabilities, OpenGL API and so on... Is you looking for solution from other peoples try to search for this words: ogre3d, opensg, sgl, openscenegraph - all this are open source engines for rendering with OpenGL.

Rectless
05-16-2005, 07:39 AM
For your models class I would start by looking at what you want the model to have and what the model format file contains. If you want to be able to load in a model file with textures and so forth, then you will definately need to have a texture variable in your model class. No one can really answer this for you. You need to see what you want the model to display and what your model format that you are reading from contains.