PDA

View Full Version : Urgent Help: How tough it is if I can not use glut?



wzhao53
12-01-2003, 08:06 AM
I developed a program to draw table and print some text dynamically in OpenGL.
Then the professor said I can not use glut.h, I can use only gl. glx is allowed.

I am using Visuaa C++ in Windows. How tough it is to change my code so that no glut is used?

Any sample code to start with without using glut?

Thanks!

For example, my main code is here:
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(500, 500);
glutInitWindowPosition(100, 100);
glutCreateWindow("Dynamic Programming Array");
Accept_String();
Insert();
init();
glutMouseFunc(mymouse);
glutKeyboardFunc(mykey);
glutDisplayFunc(display);
glutMainLoop();
}

Ostsol
12-01-2003, 08:24 AM
There's lots, actually. Check out NeHe's tutorials: http://nehe.gamedev.net/

jwatte
12-01-2003, 12:08 PM
GLX is the X11 equivalent of WGL. If you use Visual C++ on Windows, then porting to GLX will be somewhat hard, because the APIs are quite different, as is event handling, window creation, etc.

If you want to develop on Windows, first make sure that you either have a plan for porting to GLX before submitting, or that they will accept Windows submissions. Else, get a copy of Linux, install XFree86, and bite the bullet, if GLX is really the requirement.

dorbie
12-02-2003, 12:13 PM
You need to go chat with your professor again and let him know that WGL is the windows platform specific glue and that GLX does not exist on windows (except in a mostly uninteresting software emulation layer in Mesa) and make sure it's OK to use WGL.

If not and he insists you learn GLX then you're probably on the wrong platform. You should then shoot for a Linux based solution, or maybe even cross playform development.

WGL will probably be OK, I expect your prof just wants you to understand the basics of creating your own window and graphics context and writing your own your own event handling.

You can download the GLUT source and see how it does things, that should help.

There are loads of OpenGL tutorials on creating windows and contexts on both glx and wgl.