-
September 16th, 2005, 11:00 PM
#1
first program(opengl+MFC)
actually i am planning to make a game in OpenGL using MFC..but don't know anything about both of them....but still wanna make
this is my fist code using opengl and MFC...please help
#include <windows.h>
#include <gl\glut.h>
void SetupRC();
void RenderScene();
void main()
{
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow("Simple");
RenderScene();
SetupRC();
glutMainLoop();
}
void SetupRC()
{
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
}
void RenderScene()
{
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}
I got this error at runtime...don't know where i am going wrong
------------------------------------------------------------------------
GLUT: Warning in (unamed): The following is a new check for GLUT 3.0; update your code.
GLUT: Fatal Error in (unamed): redisplay needed for window 1, but no display callback.
Appreciate others by rating good posts
"Only buy something that you'd be perfectly happy to hold if the market shut down for 10 years." - Warren Buffett
-
September 17th, 2005, 03:06 AM
#2
Re: first program(opengl+MFC)
You need to declare RenderScene function as callback which is called by GLUT framework to redraw window:
Code:
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow("Simple");
glutDisplayFunc(RenderScene);
SetupRC();
glutMainLoop();
Don't call RenderScene directly. Read also this tutorial:
http://www.lighthouse3d.com/opengl/glut/index.php?2
-
September 17th, 2005, 06:38 AM
#3
Re: first program(opengl+MFC)
-
September 20th, 2005, 06:17 AM
#4
Re: first program(opengl+MFC)
Thanxs alot...it worked fine
Appreciate others by rating good posts
"Only buy something that you'd be perfectly happy to hold if the market shut down for 10 years." - Warren Buffett
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|