Advertisement

class member question.

Started by September 15, 2001 12:46 PM
0 comments, last by dirkduck 23 years, 5 months ago
Hi all...im not sure if this is the right forum for this..but i am using OGL ...well, I have a function ''cube'' that requests 4 parameters, an object name, x,y,and z values. (cube(int objname,int x,int y, int z) Then I have a class that holds all of its coordinates...It works fine and dandy cept I cant get it to interpret the variable ''objname'' as an actual number. So my class ''entity'' ill do ''entity objname'' ''objname.x=x....etc. But, obviously it reads ''objname'' as the actual name, and not the variable stored in side. So, could I use a pointer somehow to get the value inside ''objname''? If not, what else should I try? thanks McDougal...DUCK McDougal
http://www.labino.net
heres one of the functions:



void pyramid(char objnum, int xtrans, int ytrans, int ztrans)
{


//THIS IS WHERE THE PROBLEM STARTS:
entity1 objnum; //entity1 is the name of the class
objnum.transx=xtrans;
objnum.transy=ytrans;
objnum.transz=ztrans;
//THIS IS WHERE THE PROBLEM ENDS


glTranslatef(xtrans,ytrans,ztrans);
glBegin(GL_TRIANGLES); // Start Drawing The Pyramid

glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Front)

glVertex3f(-1.0f,-1.0f, 1.0f); // Left Of Triangle (Front)

glVertex3f( 1.0f,-1.0f, 1.0f); // Right Of Triangle (Front)

glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Right)

glVertex3f( 1.0f,-1.0f, 1.0f); // Left Of Triangle (Right)

glVertex3f( 1.0f,-1.0f, -1.0f); // Right Of Triangle (Right)



glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Back)

glVertex3f( 1.0f,-1.0f, -1.0f); // Left Of Triangle (Back)

glVertex3f(-1.0f,-1.0f, -1.0f); // Right Of Triangle (Back)


glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Left)

glVertex3f(-1.0f,-1.0f,-1.0f); // Left Of Triangle (Left)

glVertex3f(-1.0f,-1.0f, 1.0f); // Right Of Triangle (Left)
glEnd(); // Done Drawing The Pyramid
glLoadIdentity();

}



McDougal...DUCK McDougal
http://www.labino.net

This topic is closed to new replies.

Advertisement