Jump to content

View more

Image of the Day

Inventory ! Va falloir trouver une autre couleur pour le cadre D: #AzTroScreenshot #screenshotsaturday https://t.co/PvxhGL7cOH
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Old OpenGL movement problem

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 too_many_stars   Members   

336
Like
0Likes
Like

Posted 27 May 2014 - 10:00 PM

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



#2 too_many_stars   Members   

336
Like
0Likes
Like

Posted 27 May 2014 - 10:53 PM

nm got the problem solved, stupid initialization on my part.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.