Blender Rotation to OpenGL rotation

Hello,
i’m working for an exporter for a 3D engine i’m doing (and that will be free avaiable when more completed). I need to export the Mesh objects in the scene in Blender and transfer their position, rotation and scale in the export data file (a text-xml).
OpenGL uses a different coordinate axis system then the Blender one
http://pierrel5.free.fr/PocketGLb/Axes.jpg
i’d like to take the euler angles given by the Python interface and convert them into OpenGL compatible ones. After that fill them in a quaternion in my engine and … stop :smiley:
Is there any script that already do this conversion? i’ve searched also for more documentation about how that angles are calculated by Blender but i cant find nothing.
Any ideas of about how to do this thing?

Thanks

:slight_smile:

I doubt Blender really uses a coordinates system different than the OpenGL one, as its whole interface to the world is through OpenGL, but I could be talking out of my arse here. However, why do you have to go through the Euler angles at all? Can’t you just grab the object’s transform matrices (Object.getMatrix(space=‘worldspace’)), multiply it for a correction matrix for whatever coordinates system and scale you use, and then extract the quaternion directly from it with Matrix.toQuat()?

Blender surely uses a right hand coordinate system.

I do believe OpenGL does too, and, in any case, the one you drawn is right handed.

Stefano

there’s a lot of rotation conversion formulas on
http://www.euclideanspace.com/maths/index.htm