View Full Version : Noobie questions about some common conventions/standards and the reasons why

04-02-2014, 02:19 AM
Hey all,
I'm moving from working in pascal with zenGL (Built around OpenGL) for 2D Games to java with openGL for 3D games.
So, I've got a few questions that are burning at me - so I thought I'd see if you guys could help me out here.
They're all about convention or the "propper" way to do things, because I'm trying to make my code more readable to others.
I'm not trying to start a debate here about conventions mind you, though, I suppose it'll probably happen.

In the majority of tutorials the quads (for a cube eg.) are defined in the range -1.0f to 1.0f, like so:

My personal preference would be to define them in the range 0.0f to 1.0f, unless you wanted the origin centered - in which case -0.5f to 0.5f
My reasoning would be that the side of the quad would, at most for a perfectly square quad, be 1 unit of length.
The only reason I can see for -1.0f to 1.0f would be reduction in floating point rounding errors, allowing for greater precision.

Is there a reason why the range -1.0f to 1.0f is used? or is it more so convention?
Also, is there a reason for having the origin of the quad in the center as opposed to a corner?

I also noticed that you can use values outside of -1.0f to 1.0f, is that standard practice or should I be using scalef to make larger objects?
Is one faster than the other? Any drawbacks of either?

Should vertices for quads be defined where they actually will be, or is translatef designed to place an object/quad in the correct spot?
Is one faster than the other? Any drawbacks of either?

That's all/most of the questions of got at the moment.

Thanks for your time,