How do you control everything?

how do you keep everything under control do you have a class for each thing… like Object class, Camera class, Light class, Texture class, Vertex class. And then a big “OpenGL” Class that start’s the gl rendering contex and then you load in all objects, cameras, lights into that class

like this:
you have your own Object class with a vertex list and a pointer to a texture and so on…

class C_Object {
int m_iNrVertices; // Number of vertices in list
C_Vertex3f *VertexList; // Vertex list
C_Texture *Texture; // Pointer to a texture
public:
void ReadObject(void); // Read object from file (.ase or what ever you use)
void RenderObject(void); // Object Render function
}

then you have a big class that you can put your object into

class C_Scene {
int m_iNrObjects;
C_Object *m_pObjects[10]; // Pointer to objects in scene

C_Camera *Camera; // Pointer to a camera
C_Lights *Lights[8]; // Pointer to Lights

public:
void Render(void); // a loop function for render all objects and position the lights& cameras
}

if you got something like this… tell me

what different Classes do you have?

and what different things are in that classes?

Is it so usefull as it looks like or is it slow?

when I use the classes should I create a “new” class for each object like this:
class SpaceShip : private C_Object {
// All stuff for a spaceship and so on
// perheps a new renderfunction…
};
or is that only usefull if I need a specefic render function, can I have the same function for all objects?

I am not a big C++ person, but it is good to break down thing into objects or sections.

example:

step 1: program startup
setup window
setup init data for program.
enter event loop.

step2: event loop
check input devices
check our objects for movement or put into motion.
build new world data
render new data to screen
repeat event loop until an exit command is recieved.

As for what classes to build, lighting, camera, object, world have been some that I have seen used in a C++ program.
Each class would be processed before rendering takes place.

I hope this helps.

Originally posted by McZ:
[b]how do you keep everything under control do you have a class for each thing… like Object class, Camera class, Light class, Texture class, Vertex class. And then a big “OpenGL” Class that start’s the gl rendering contex and then you load in all objects, cameras, lights into that class

like this:
you have your own Object class with a vertex list and a pointer to a texture and so on…

class C_Object {
int m_iNrVertices; // Number of vertices in list
C_Vertex3f *VertexList; // Vertex list
C_Texture *Texture; // Pointer to a texture
public:
void ReadObject(void); // Read object from file (.ase or what ever you use)
void RenderObject(void); // Object Render function
}

then you have a big class that you can put your object into

class C_Scene {
int m_iNrObjects;
C_Object *m_pObjects[10]; // Pointer to objects in scene

C_Camera *Camera; // Pointer to a camera
C_Lights *Lights[8]; // Pointer to Lights

public:
void Render(void); // a loop function for render all objects and position the lights& cameras
}

if you got something like this… tell me

what different Classes do you have?

and what different things are in that classes?

Is it so usefull as it looks like or is it slow?

when I use the classes should I create a “new” class for each object like this:
class SpaceShip : private C_Object {
// All stuff for a spaceship and so on
// perheps a new renderfunction…
};
or is that only usefull if I need a specefic render function, can I have the same function for all objects?

[/b]

ask JW Bush !