Jump to content
  • Advertisement
Sign in to follow this  
vicer1234

Unusual FreeGlut error

This topic is 2566 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
I am trying to build a small program using glut function.

The code structure looks like

int main(int argc, char** argv)
{
//initialising the glut and creating the window
glutInit(&argc, argv);
glutInitWindowSize(1024, 768);
glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE|GLUT_STENCIL|GLUT_DEPTH);

main_window = glutCreateWindow("Hello");

glutDisplayFunc( Display );
glutReshapeFunc( Reshape );
.......
...........
.........

glutMainLoop();
return EXIT_SUCCESS;
}



there is no errors when compiled but when i try to run it the command line splashes and disappears in a way it crashes

The command line shows a message FREEGLUT ERROR : Function <glutdDisplayFunc> called without first calling 'glutInit'.

But as you can see i have called glutInit function

I tried in google but did not get any proper solution for it... What is the reason for this BUG????

All suggestions are welcome

Share this post


Link to post
Share on other sites
Advertisement

there is no errors when compiled but when i try to run it the command line splashes and disappears in a way it crashes

The command line shows a message FREEGLUT ERROR : Function <glutdDisplayFunc> called without first calling 'glutInit'.

But as you can see i have called glutInit function

I tried in google but did not get any proper solution for it... What is the reason for this BUG????

All suggestions are welcome



What is the purpose of


main_window = glutCreateWindow("Hello");


I ran your code in VS2010 with no errors. Here is my code:



#include <gl\freeglut.h>

#pragma comment(lib, "freeglut.lib")

void Reshape(int w, int h)
{
}

void Display()
{
}

int main(int argc, char *argv[])
{

glutInit(&argc, argv);
glutInitWindowSize(1024, 768);
glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE|GLUT_STENCIL|GLUT_DEPTH);

glutCreateWindow("Hello");

glutDisplayFunc( Display );
glutReshapeFunc( Reshape );

glutMainLoop();

return EXIT_SUCCESS;
}


The pragma directive simply links the library.

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!