What is it with OpenGL tutorials?
Every single OpenGL tutorial i've come across is SATURATED with global variables. It's disgusting. I can't learn from that garbage. Ugh. Ick.
I shouldn't have to sign away the good programming principles i've learned just so I can learn OpenGL.
I downloaded a basic tutorial which setup an OpenGL window and drew a triangle...
It had SEVEN global variables.
I quickly elminated four of them by adding some parameters to functions and using some standard Win32 API calls.
I'm going to wrap initializing OpenGL in a nice flexable class so I never have to deal with this garbage again.
Before I'll be able to do anything I know i'm going to want to wrap everything into a neat little package. Down with C! Up with C++!
PLUS I have a very big hunk of garbage on my shelf called "OpenGL Superbible"
Worst. Book. Ever.
It's almost like once OpenGL is introduced, you can forget everything about design and structure and just hack new modules on until the cows come home.
/rant
Re: What is it with OpenGL tutorials?
Quote:
Originally posted by Eibro
Every single OpenGL tutorial i've come across is SATURATED with global variables. It's disgusting. I can't learn from that garbage. Ugh. Ick.
I shouldn't have to sign away the good programming principles i've learned just so I can learn OpenGL.
I downloaded a basic tutorial which setup an OpenGL window and drew a triangle...
It had SEVEN global variables.
I quickly elminated four of them by adding some parameters to functions and using some standard Win32 API calls.
I'm going to wrap initializing OpenGL in a nice flexable class so I never have to deal with this garbage again.
Before I'll be able to do anything I know i'm going to want to wrap everything into a neat little package. Down with C! Up with C++!
PLUS I have a very big hunk of garbage on my shelf called "OpenGL Superbible"
Worst. Book. Ever.
It's almost like once OpenGL is introduced, you can forget everything about design and structure and just hack new modules on until the cows come home.
Agreed, Eibro. When I first started programmng in OpenGL, I went to NeHe and I was really disgusted. I stopped going pretty quickly. The best reference I've found has been MSDN's documentation. It's not exactly meant to be a learning tool (just a reference), but that's really what I learned off of. Just make sure you understand the very basic concepts of drawing in OpenGL and it's simple to branch off from there using msdn for a reference. As long as you are experienced with C++ and design (which I know you are), it shouldn't be a problem.
Quote:
Originally posted by Fordy
Graphics programming often uses globals for speed....though in your apps you may not need it yet.....
"Globals for speed" is an ignorant excuse. The speed difference between global and local variables is very minute. The use of global variables as an "optimization of speed" just limits the modularity of functions and doesn't pull in a noticeable gain (even if the variable is used thousands of times per second). The only really valid reason for not wanting things being put on the stack is if you are worried about a large amount of data being repeatedly tossed there. If that's the problem, then you just make the object static in the function it is declared.
Re: Re: What is it with OpenGL tutorials?
Quote:
Originally posted by Polymorphic OOP
"Globals for speed" is an ignorant excuse.
:rolleyes:
You may see it as ignorant, but often that's why people do it.
At learning stage, as I said, its probably not needed.
PORTABILITY NOT IMPORTANT ??!!!
Travis Dane:
Portability is the most important thing there is. Without portability, there would be one language for each platform.
Why not use SDL or GLUT? These are very good API's and as a Linux programmer,I use SDL because I want everyone to be able to use my program/game, not just other Linux users, and I wouldn't use WinAPI if I was using Windows either. Not caring about portability is just selfish.
*thankyou*