Jump to content
  • Advertisement
Sign in to follow this  
Tirdad

Problem with Header files in GLUT OpenGL programmin

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

[font="Times New Roman"][/font][font="Calibri"]Hi there[/font]

[font="Times New Roman"][/font][font="Calibri"]I’m using openGL with GLUT framework .[/font]

[font="Times New Roman"][/font][font="Calibri"]I’ve got some problem with my first code :[/font]

[font="Times New Roman"][/font][font="Calibri"]Here’s the condiotion :[/font]

[font="Times New Roman"][/font][font="Calibri"]Windows 7 64 bit[/font]

[font="Times New Roman"][/font][font="Calibri"]DevC++ , Pelles C compiler[/font]

[font="Times New Roman"][/font][font="Calibri"]GLUT 3.7[/font]

[font="Times New Roman"][/font][font="Calibri"]==============================[/font]

[font="Times New Roman"][/font][font="Calibri"]I got the GLUT 3.7 files from the site .[/font]

[font="Times New Roman"][/font][font="Calibri"]In which folders I must put them ? glut.h / glut.lib /glut.dll[/font]

[font="Times New Roman"][/font][font="Calibri"]And the code :[/font]

[font="Times New Roman"][/font][font="Calibri"]==============================[/font]

[font="Times New Roman"][/font][font="Calibri"]#include <windows.h>[/font]

[font="Times New Roman"][/font][font="Calibri"]#include <GL/glut.h>[/font]

[font="Times New Roman"][/font][font="Calibri"]#include <GL/gl.h>[/font]

[font="Times New Roman"][/font][font="Calibri"]#include <GL/glu.h>[/font]

[font="Times New Roman"][/font][font="Calibri"] [/font]

[font="Times New Roman"][/font][font="Calibri"]void display(void)[/font]

[font="Times New Roman"][/font][font="Calibri"]{[/font]

[font="Times New Roman"][/font][font="Calibri"] glClear(GL_COLOR_BUFFER_BIT);[/font]

[font="Times New Roman"][/font][font="Calibri"] glColor3f(1.0,1.0,1.0);[/font]

[font="Times New Roman"][/font][font="Calibri"] glBegin(GL_POLYGON);[/font]

[font="Times New Roman"][/font][font="Calibri"] glVertex3f(0.25,0.25,0.0);[/font]

[font="Times New Roman"][/font][font="Calibri"] glVertex3f(0.75,0.25,0.0);[/font]

[font="Times New Roman"][/font][font="Calibri"] glVertex3f(0.75,0.75,0.0);[/font]

[font="Times New Roman"][/font][font="Calibri"] glVertex3f(0.25,0.75,0.0);[/font]

[font="Times New Roman"][/font][font="Calibri"] glEnd();[/font]

[font="Times New Roman"][/font][font="Calibri"] glFlush();[/font]

[font="Times New Roman"][/font][font="Calibri"] [/font]

[font="Times New Roman"][/font][font="Calibri"]}[/font]

[font="Times New Roman"][/font][font="Calibri"] [/font]

[font="Times New Roman"][/font][font="Calibri"]void init(void)[/font]

[font="Times New Roman"][/font][font="Calibri"]{[/font]

[font="Times New Roman"][/font][font="Calibri"] glClearColor(0.0,0.0,0.0);[/font]

[font="Times New Roman"][/font][font="Calibri"] glMatrixMode(GL_PROJECTION);[/font]

[font="Times New Roman"][/font][font="Calibri"] glLoadIdentity();[/font]

[font="Times New Roman"][/font][font="Calibri"] glOrtho(0.0,1.0,0.0,1.0,-1.0,1.0);[/font]

[font="Times New Roman"][/font][font="Calibri"]}[/font]

[font="Times New Roman"][/font][font="Calibri"]int main(int argc,char** argv)[/font]

[font="Times New Roman"][/font][font="Calibri"]{[/font]

[font="Times New Roman"][/font][font="Calibri"] glutInit(&argc,argv);[/font]

[font="Times New Roman"][/font][font="Calibri"] glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);[/font]

[font="Times New Roman"][/font][font="Calibri"] glutInitWindowSize(250,250);[/font]

[font="Times New Roman"][/font][font="Calibri"] glutInitWindowPosition(100,100);[/font]

[font="Times New Roman"][/font][font="Calibri"] glutCreateWindow("hello");[/font]

[font="Times New Roman"][/font][font="Calibri"] init();[/font]

[font="Times New Roman"][/font][font="Calibri"] glutDisplayFunc(display);[/font]

[font="Times New Roman"][/font][font="Calibri"] glutMainLoop();[/font]

[font="Times New Roman"][/font][font="Calibri"] return0;[/font]

[font="Times New Roman"][/font][font="Calibri"]}[/font]

[font="Times New Roman"][/font][font="Calibri"]============================[/font]

[font="Times New Roman"][/font][font="Calibri"]Error code :[/font]

[font="Times New Roman"][/font][font="Calibri"]========================================================[/font]

[font="Times New Roman"][/font]C:\Users\Tirdad\Documents\PellesC Projects\first\gl1.c(24): error #2070: Insufficient number of arguments to'function'.

[font="Times New Roman"][/font]C:\Users\Tirdad\Documents\PellesC Projects\first\gl1.c(30): warning #2203: Function 'main' can't be __stdcall,changed to __cdecl.

[font="Times New Roman"][/font]C:\Users\Tirdad\Documents\PellesC Projects\first\gl1.c(37): warning #2168: Operands of '=' have incompatibletypes 'void __cdecl function(void)' and 'void __stdcall function(void)'.

[font="Times New Roman"][/font]C:\ProgramFiles\PellesC\Include\Win\GL\glut.h(549): warning #2135: Static'glutCreateMenu_ATEXIT_HACK' is not referenced.

[font="Times New Roman"][/font][font="Calibri"] [/font]

[font="Times New Roman"][/font][font="Calibri"]========================================================[/font]

[font="Times New Roman"][/font]

Share this post


Link to post
Share on other sites
Advertisement
Your call to glClearColor () has only 3 arguments but you need to also supply the alpha argument so you need one more 0.0 or whatever you want to pass. Also, you have a syntax error on the "return0" statement. You probably don't want to be using Dev++ and glut either as both are quite old. The free Visual Studio Express C++ from Microsoft or minimalist gcc for Windows along with Code::Blocks or Eclipse is a better choice. Use freeglut instead of glut. Another thing, why not try learning modern OpenGL 3/4 instead of the old classic OpenGL? Unless you're planning on working with legacy code I really don't see why you would want to learn it. But if you are learning it, then just go to the NeHe website--it will answer almost all your questions.

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!