• Advertisement
Sign in to follow this  

Old OpenGL movement problem

This topic is 1333 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

Hi Guys,

 

Having an issue with OpenGL.

 

Here's my update function

	void update(float dt){
		
		glLoadIdentity();
		
		glTranslatef(pos.x,pos.y,pos.z);

		pos.z+=vel.z*dt/1000.0f;
	
		glCallList(object);
	}

The idea is simple, move a ball, along the z axis with the help of a V3 class I created wich has float x,y,z with all the requisite operations such as addition, normailization etc.

 

The issue is, when I initialize vel.z=20.0f, the ball does not move, however when I do the following...

	void update(float dt){
		
		glLoadIdentity();
		
		glTranslatef(pos.x,pos.y,pos.z);

		pos.z+=20*dt/1000.0f;//change here
	
		glCallList(object);
	}

the ball does move. I am completely baffled as I have done this numerous times in SDL and the objects move just fine.

 

I think the issue has to do something with either glLoadIdentity() or glTranslatef().

 

If anyone has any ideas please let me know.

 

Thanks,

 

Mike

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement