Advertisement

GLUT for Windows

Started by March 31, 2002 05:39 PM
14 comments, last by antix 22 years, 10 months ago
quote:
Original post by zedzeek
glut has a repuatation as childish? dont ask me why cause its ilogical.



I couldn''t care less about reputation. =)
GLUT totally makes sense for me since im switching to Macintosh in several months anyway, so I''m definitly going to use it.
quote:
Original post by zedzeek
glut has a repuatation as childish? dont ask me why cause its ilogical.



I couldn't care less about reputation. =)
GLUT totally makes sense for me since im switching to Macintosh in several months anyway, so I'm definitly going to use it.

EDIT: Sorry about the double post

[edited by - antix on April 1, 2002 9:15:38 PM]
Advertisement
Has anyone setup GLUT with Bloodsheds DevC, i tried the first tutorial of the Lighthouse website. It compiles but it wont link properly. Im getting undefined references for all the functions. I have -lopengl32 -lglut32 in project options and #include <gl/glut.h> and #include <gl/gl.h> in the program. All the files seem to be there and in the right places i think. Do i have the wrong version? What order should i put every thing in
quote:
Original post by Cipher1973
Has anyone setup GLUT with Bloodsheds DevC, i tried the first tutorial of the Lighthouse website. It compiles but it wont link properly. Im getting undefined references for all the functions. I have -lopengl32 -lglut32 in project options and #include <gl/glut.h> and #include <gl/gl.h> in the program. All the files seem to be there and in the right places i think. Do i have the wrong version? What order should i put every thing in


The glut header file automatically links the openGl libraries, and sets the includes through pragma and.. well.. includes. Its redundant to manually link and include when using Glut (not 100% sure on the accuracy of this statement through DevC, but should still be true). Could you post the exact undefined reference''s you''re getting?
I think the reason NeHe said it would be simple is because he assumes ppl reading his site knows how to program, more specifically WINDOWS programming. So keeping it the same works good. Here is a replacement for WinMain:

      int main(int argc, char** argv){    glutInit(&argc, argc);    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);    glutInitWindowSize(250,250);    glutInitWindowPosition(100,100);    glutCreateWindow("title");    Init();                                        //InitGL(GLvoid)    glutDisplayFunc(display);                      //display = function that draws                                                   //DrawGLScene    glutMainLoop();    return 0;}      

You can also cut all that other trash out that has to do with windows programming. Usally thats just WndProc.

If you can handle the messages yourself (keypresses, resizing, ect.) then Glut works much better. On the contrary if you are a new windows programmer then stay with the windows "shell".
One thing to remember.
DirectX is for WINDOWS ONLY!
OpenGL is for ALL OPERATING SYSTEMS, so learning one way to make a window that works on all systems is much MUCH more time effecient.


BTW i brought up DirectX to show why openGL is better ;D
It really had nothing to do with my point



[edited by - DarkHunter on April 2, 2002 12:31:31 AM]
I forgot to put some other glut functions you might find useful.

glutReshapeFunc(void(*func)(int width, int height))
glutKeyboardFunc(void(*func)(unsigned char key, int x, int y))
glutMouseFunc(void(*func)(int button, int state, int x, int y))
glutMotionFunc(void(*func)(int x, int y))

Sombody should write a tutorial just on using glut for making windows and handling events. Speaking of which, how many of you people actually use glut? although i know a moderate amount about it, i dont usally use it. But my code does work, i promise ;D


[edit] A tutorial on ALL of glut would be pretty long...

[edited by - DarkHunter on April 2, 2002 12:39:12 AM]

This topic is closed to new replies.

Advertisement