Jump to content
  • Advertisement

Archived

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

hello_there

what the f!@#

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

i''m a newbie to open gl so this mightn''t seem stupid to you. but the main function in my programme is never executed yet it opens a window. Can someone please tell me why or simply tell me how to open a gl window and be able to draw stuff to it. please help. nothing works hmmm interesting

Share this post


Link to post
Share on other sites
Advertisement
What toolkit are you using ?

Assuming you're using GLUT, here's a minimalistic example.

    
#include <GL/glut.h>

void
DisplayMain()
{
glClear( GL_COLOR_BUFFER_BIT );
// your drawing code here

glFinish();
glutSwapBuffers();
}

void
ReshapeMain( int w, int h)
{
glViewport( 0, 0, w, h );
// Adjust your projection matrix to your new window size

}

void
Idle()
{
// Animation, AI ..

glutPostRedisplay();
}

void
main( int argc, char** argv )
{
glutInit( &argc, argv );
glutInitDisplayFunc( GLUT_RGB | GLUT_DOUBLE );
glutCreateWindow( argv[0] );
glutDisplayFunc( DisplayMain );
glutReshapeFunc( ReshapeMain );
glutIdleFunc( Idle );

glutMainLoop();
}


Edited by - Fruny on November 20, 2001 11:13:21 AM

Share this post


Link to post
Share on other sites

  • 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!