PDA

View Full Version : XYZ points in OpenGL



jon_opengl
11-15-2008, 05:33 PM
A DXF file is being read in with real world X,Y,Z coordinates. Is there a good tutorial on how to go between these values and the OpenGL coordinates and planes?

Many thanks in advance.

satan
11-15-2008, 07:26 PM
There is no such thing as 'OpenGL coordinates'. You decide what 1 OpenGL unit shall be in your application. It is up to you if 1 OpenGL unit is 1 mm, 1 km or 1 parsec.
Any reason why you cannot use the DXF coordinates directly?

jon_opengl
11-16-2008, 04:09 AM
No, it's just that the documentation I have come across uses glut or another library to do the transformation mapping. A commented example or tutorial of how to apply the vertex extents to the viewport was what I was looking for further documentation on.

Rosario Leonardi
11-16-2008, 05:56 AM
I don't understand what you means with "transformation mapping" as Satan say there is not openGL units, the only convention is that the "UP" direction is on the Y axis and the left hand rules is used, so your coordinates are something like this.


/\Y
|
|_____>X
/
/
|/Z
Here you can find some better explanation about openGL coordinate convention (it don't speak about units :P )
http://www.falloutsoftware.com/tutorials/gl/gl0.htm

jon_opengl
11-17-2008, 07:03 AM
Transformation mapping is used in the context of transforming the XYZ coordinates so that they map into the display window.

glOrtho() is the function that sets the buffer up correctly. Setting the min & max for each direction to be larger than the largest XYZ allows the entities to be displayed. I was able to use the glRotate() OK, but am still having issues with the gluLookAt().

Thanks for the link as I had not run across it before.