Class Variables

Started by
0 comments, last by TheShadow 20 years, 12 months ago
If i have the following
  
BOOL Object::draw_object(GLfloat posx, GLfloat posy, GLfloat direction, int textureID)
{

	glLoadIdentity();
	glPushMatrix();
	glTranslatef(posx + 0.5, posy+ 0.5, 0.0f);
	glRotatef(direction, 0.0f, 0.0f, 1.0f);
	
	glBindTexture(GL_TEXTURE_2D, texture[textureID]);
	glBegin(GL_QUADS);
		glTexCoord2f(1.0f, 1.0f); glVertex2f( 0.5f, 0.5f);
		glTexCoord2f(1.0f, 0.0f); glVertex2f( 0.5f,  -0.5f);
		glTexCoord2f(0.0f, 0.0f); glVertex2f(-0.5f,  -0.5f);
		glTexCoord2f(0.0f, 1.0f); glVertex2f(-0.5f, 0.5f);
	glEnd();
	glPopMatrix();
	return TRUE;

}
  
And I want to modify textureID variable in the declaration of the member function to a different value from another member function... I declare it as a public variable
  

class Object
{
public:
	BOOL draw_object(GLfloat posx, GLfloat posy, GLfloat direction, int textureID);
	int Animate();
	GLfloat posx;
	GLfloat posy;
	GLfloat direction;
	int sprite;
	bool wall;
};
  
But when i modify it textureID = 2; for example... i dont get any results... how can i achieve this?
Mecha Engineer (Making Real Humanoid Suits)
Advertisement
I don''t get you completely, but it sounds like you want to pass texture1D by reference, or at least that''s what I think you want. You weren''t too clear.

This topic is closed to new replies.

Advertisement