PDA

View Full Version : How to display items without using glutDisplayFunc()? What exactly does its code do?



loonger
08-21-2014, 07:24 PM
Hi guys, I'm new to programming and OpenGL. I try to understand from the ground. Most tutorials I've read so far are based on glut. I'm wondering how to write codes without using glut? What exactly do those functions do?

For example, I've defined a display() function. If I use glut I can simply write "glutDisplayFunc(display); glutMainLoop();" in the main() function to call the display(). But if I do not use glut, what should I do? What do the code look like?

If I work on a MFC/Qt project, there is no main() function. What should I do?

Thanks!

Ruggero Visitnin
08-21-2014, 11:49 PM
Hi guys, I'm new to programming and OpenGL. I try to understand from the ground. Most tutorials I've read so far are based on glut. I'm wondering how to write codes without using glut? What exactly do those functions do?

For example, I've defined a display() function. If I use glut I can simply write "glutDisplayFunc(display); glutMainLoop();" in the main() function to call the display(). But if I do not use glut, what should I do? What do the code look like?

If I work on a MFC/Qt project, there is no main() function. What should I do?

Thanks!

All this glut functions are needed to create a context, otherwise you should use windows api or the one for linux, i think they are x windows but, the point is that using (or glfw or whatever library you want to use) avoids you tens of lines of code.

This is not in modern opengl but you' ll get the idea:
http://nehe.gamedev.net/tutorial/creating_an_opengl_window_(win32)/13001/

About Qt i'm not the right person since i never use it, you should try searching on google a tutorial on how to create a context in Qt

loonger
08-23-2014, 05:36 AM
Thanks Ruggero.

Ruggero Visitnin
08-23-2014, 08:37 AM
Thanks Ruggero.

you're welcome