View Full Version : OpenGL Global Variables
03-01-2012, 05:13 AM
Hello. I've just started C++ not long ago and only know some basics on OpenGL. I was taught to use global variables to animate( rotate, translate, ... ) the scene in glutDisplayFunc(MyDisplay) by changing the variables in other part of the program. So, I know global variables have it's disadvantages so i was wondering how to go around doing it without global variables ?
03-01-2012, 05:40 AM
The way glut works, you need global variables, because you can't pass variables to MyDisplay.
It can even be a single global var, holding a struct with all the details needed to draw the display.
03-01-2012, 05:51 AM
So if i don't wanna use global variables, what do you suggest ?
03-01-2012, 06:43 AM
I am partial to GLFW : http://www.glfw.org/index.html
03-01-2012, 10:27 AM
+1 for glfw
03-01-2012, 11:34 AM
Though sadly, GLFW does not (yet) have a way to create an sRGB framebuffer.
03-01-2012, 09:18 PM
Okay! I will read about it thanks!
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.