Jump to content
  • Advertisement
Sign in to follow this  
stecooper123

OpenGL gutTimerFunc()

This topic is 3775 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 has any one used glutTimerFunc(); i have found loads of sites using this and i could do with it but openGl cant find it, all the sites have the following includes but it is not included in them. Any ideas? thank you i need this as i am making a turret fire a stream of bullets but have the fire function called every so milli seconds. #include <stdio.h> #include <stdlib.h> #include <GLUT/glut.h> // thank you

Share this post


Link to post
Share on other sites
Advertisement
http://pyopengl.sourceforge.net/documentation/manual/glutTimerFunc.3GLUT.html

I am not following you. Do you want to know where to get it, or how to use it? You need to download glut library to use glut code. Google it and then add it to your compiler paths.

Share this post


Link to post
Share on other sites
Hi sorry, what i mean is i know how to use it but when i add it in OpenGl cant find it anywhere but i will have a look on that site. Thank you

Share this post


Link to post
Share on other sites
OpenGL won't be able to "find" it, since it isn't an OpenGL function. It's a GLUT function. You need to use GLUT to be able to use it. That is, you need to include the GLUT header AND you need to be using the GLUT main loop AND you need to link with the GLUT library file.

Share this post


Link to post
Share on other sites
If you need to delay here is a simple function:


#include <time.h>

void delay(int ms)
{
int start;
start=clock();
while(clock()-start<=ms);
};



Share this post


Link to post
Share on other sites
Quote:
Original post by cresty
If you need to delay here is a simple function:

*** Source Snippet Removed ***

Using that in a GUI-based Windows application, where you may be executing from the message loop, is a terrible idea because it'll avoid receiving system messages. Fine for non-IoC console apps, though.

Share this post


Link to post
Share on other sites
thank you. I got it to work now, it a good function, wish i knew of it before rather than making the proc check the distance of the prevous bullet from the turret before firing the next. Noob way lol especially calculating it for 3d space.


Thanks Guys

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!