• Advertisement


This topic is now archived and is closed to further replies.

Class Variables

This topic is 5448 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

If i have the following
BOOL Object::draw_object(GLfloat posx, GLfloat posy, GLfloat direction, int textureID)

	glTranslatef(posx + 0.5, posy+ 0.5, 0.0f);
	glRotatef(direction, 0.0f, 0.0f, 1.0f);
	glBindTexture(GL_TEXTURE_2D, texture[textureID]);
		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);
	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
	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?

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites

  • Advertisement