PDA

View Full Version : object information



03-27-2002, 10:01 AM
i need to store information about objects e.g. position, size, tilt angle,what .bmp is texture mapped to it. this information will be changed and added to throughout the running of the program. the problem is i dont know how to do this and i need this to display all the objects. any help would be great.

Furrage
03-27-2002, 10:35 AM
Displaying the object can be done with OpenGL. For more on this check NeHe's tutorials ( http://nehe.gamedev.net ). The rest is best acheived with objects (classes or structures). If you aren't familiar with either search the web for C/C++ tutorials.

nexusone
03-27-2002, 12:13 PM
I think first you should think about learning the C language along with Opengl.
All the things you are asking is done through variable and structures which are part of the C/C++ language (for that fact any language).

An example of a structure for an object would look something like this:

typedef struct // this structure defines a object
{
int object; // What type of object to draw
Point3F Int_point; // Start xyz point of object
Point3F Curent_point; // Current xyz point
Point3F Target_point; // Target xyz point, object movies from current point to new point.
int Int_angle_x; // Start angle for object
int Int_angle_y;
int Int_angle_z;
int Target_angle_x; // Angle to move to.
int Target_angle_y;
int Target_angle_z;
int Rotation_x; // Is the object rotating
int Rotation_y;
int Rotation_z;
int Rotation_rate_x; //How fast the object it rotating
int Rotation_rate_y;
int Rotation_rate_z;
int Speed_x; // Rate of movement from Current point to Target point
int Speed_y;
int Speed_z;
int direction_x; // Direction of movement
int direction_y;
int direction_z;
int Ticks_per_frame; // How often we update the object
int Ticks; // Current number of tick’s past
}Object_data;


static Object_data My_Object[10]; Create space for 10 objects


glTranslate3f(My_Object[x].Curent_point[0], My_Object[x].Curent_point[1], My_Object[x].Curent_point[2] ); Usage of object in a moving.

Draw_Object(My_Object[x]);

Originally posted by rev:
i need to store information about objects e.g. position, size, tilt angle,what .bmp is texture mapped to it. this information will be changed and added to throughout the running of the program. the problem is i dont know how to do this and i need this to display all the objects. any help would be great.