Jump to content

  • Log In with Google      Sign In   
  • Create Account


what the f!@#


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 hello_there   Members   -  Reputation: 122

Like
Likes
Like

Posted 19 November 2001 - 06:16 PM

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

Sponsor:

#2 Fruny   Moderators   -  Reputation: 1653

Like
Likes
Like

Posted 20 November 2001 - 04:12 AM

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




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.



PARTNERS