views:

45

answers:

1

Hello,

This is not really a functional problem I'm having but more a strategic question. I am new to 3D-programming and when looking at tutorials and examples I recon that the coordinates are usually between -1 and 1.

It feels more natural using integers as coordinates, I think. Is there any particula reason(s) why small float-values are used, perhaps performance or anything else?

I haven't gotten that far yet so perhaps this questions is a bit too early to ask, but when creating objects/textures that I will import, they are created in applications where the coordinates usually are having sizes in integer numbers, I guess (E.g. Photoshop for textures). Doesn't this matter for how I define my x/y/z-sizes?

Thanks in advance!

+1  A: 

I've never seen such small ranges used. This is likely to introduce problems in calculations I would say. A more common style is to use a real-world scale, so 1 unit = 1 metre. And using floating-point values is more realistic - you need fractional values because when you rotate something, the new coordinates will nearly always be non integral. Using integers you'll run into problems of scale and precision.

John
Thank you! That's more like the way I want it, and I do understand the point using float instead of int. I found the small numbers in this excelent tutorial http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html (Viewports and perspectives) and in at least one more place which I have forgotten about. So it's out there...
Nicsoft
In viewports, numbers **are** often scaled to that kind of range, but these are perspective-corrected, basically 2D screen coordinates with a Z-depth. using [-1,+1] makes it screen-resolution-independent.
John