Jump to content
  • Advertisement
Sign in to follow this  
doNY

OpenGL Error:The following is a new check for GLUT3.0

This topic is 2950 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 compile these codes with gcc:

#include <windows.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glut.h>

typedef struct
{
GLint x;
GLint y;
}GLintPoint;

GLintPoint corner[2];
int selected=0;
int screenWidth=640,screenHeight=480;

void Render()
{
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1.0f,1.0f,1.0f);
if(selected)
{
glBegin(GL_QUADS);
glVertex2i(corner[0].x,corner[0].y);
glVertex2i(corner[0].x,corner[1].y);
glVertex2i(corner[1].x,corner[1].y);
glVertex2i(corner[1].x,corner[0].y);
glEnd();
}
glutSwapBuffers();
}

void Mouse(int button,int state,int x,int y)
{
if(button==GLUT_LEFT_BUTTON&&state==GLUT_DOWN)
{
corner[0].x=x;
corner[0].y=screenHeight-y;
selected=1;
}
glutPostRedisplay();
}

void PassiveMotion(int x,int y)
{
corner[1].x=x;
corner[1].y=screenHeight-y;
glutPostRedisplay();
}

void main(int argc,char** argv)
{
glutInit(&argc,argv);
glutInitWindowPosition(0,0);
glutInitWindowSize(screenWidth,screenHeight);
glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE);
glutCreateWindow("Ch2_MouseRect");
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0,screenWidth,0,screenHeight);
glMatrixMode(GL_MODELVIEW);
glClearColor(0.0f,0.0f,0.0f,0.0f);
glViewport(0,0,screenWidth,screenHeight);
glutMouseFunc(Mouse);
glutPassiveMotionFunc(PassiveMotion);
glutMainLoop();
}


but the cui shows:
GLUT: Warning in F:\OpenGL\Ch2_MouseRect\bin\Debug\Ch2_MouseRect.exe: The follow
ing is a new check for GLUT 3.0; update your code.
GLUT: Fatal Error in F:\OpenGL\Ch2_MouseRect\bin\Debug\Ch2_MouseRect.exe: redisp
lay needed for window 1, but no display callback.

anybody knows how to correct it?thanks!

Share this post


Link to post
Share on other sites
Advertisement
0) You should not do
#include <gl\gl.h>

but rather
#include <gl/gl.h>

, because the slash is the path seperator char in C and C++. Using backspace can cause a lot of trouble.



in case this is C++
1) Function main should return int, not void. You can omit return-statements and all arguments, but it must be of return-type int and nothing else.

2) typedef struct{...}<name>; is not needed, just use struct <name> {...};

Share this post


Link to post
Share on other sites
Quote:
Original post by RobTheBloke
you need:
*** Source Snippet Removed ***
After you create the window.


thanks for RobTheBloke
I had compiled successfully!

and I also take phresnel's suggestion,thanks!

Share this post


Link to post
Share on other sites
Quote:
Original post by phresnel
I just stumbled over this entry, which is even more fitting to your includes ;)


Yes,I had browsed that site,it's needed for me,thanks a lot^_^

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!