Left Handed - Right handed Coordinate systems

Miscellaneous Forums/General Discussion/Left Handed - Right handed Coordinate systems

Earlier I was posting about a b3d loader for Bmax:

http://www.blitzbasic.com/Community/posts.php?topic=56210

Looks like the issue isn't the loader, but rather coordinate systems. B3D being Left handed D3D and Bmax Bine Right Handed GL

So far we have gotten the geometry to load ok but back to front kind of as expected given the circumstances.

Here's the original as it looks in Blitz3d (the axis model was made Z up so you will have to ignore that):




Here's the result in Bmax when all the parts are combined into a single object.



In this case its an obvious horizontal flip to make the single object work.

The real problem is rotations, the pic below shows what happens when the axis is made up of several meshes rotated to make the original object. The rotations are completely out of whack.




(I got some hints from jeremy who overcame the problem in torque, not sure I can paste it here but will if he will let me)

If anyone has been here before and wants to share the solution, that would be really handy. If we can figure it out we will post our B3D loader for free for anyone that wants it.

PS. I saw that halo used to have a dll that did the conversion, but the link he posted is old and no longer works.

I had this problem with the render 2 texture module the y-axis was always flipped in OpenGL.

Here is my solution which is part of the module, maybe it will help?:
Function ViewportSet(X:Int=0,Y:Int=0,Width:Int=640,Height:Int=480,FlipY:Byte=False)
	?Win32
		If DX
			TD3D7Max2DDriver(_max2dDriver).viewport.dwX=x
			TD3D7Max2DDriver(_max2dDriver).viewport.dwY=y
			TD3D7Max2DDriver(_max2dDriver).viewport.dwWidth=width
			TD3D7Max2DDriver(_max2dDriver).viewport.dwHeight=height
			PrimaryDevice.device.SetViewport(TD3D7Max2DDriver(_max2dDriver).viewport)
		Else
	?
			If FlipY
				glViewport(X, Y, Width, Height)
				glMatrixMode(GL_PROJECTION)
				glPushMatrix()
				glLoadIdentity()
				gluOrtho2D(X, GraphicsWidth(), GraphicsHeight(),Y)
				glScalef(1, -1, 1)
				glTranslatef(0, -GraphicsHeight(), 0)
				glMatrixMode(GL_MODELVIEW)
			Else
				glViewport(X, Y, Width, Height)
				glMatrixMode(GL_PROJECTION)
				glLoadIdentity()
				glOrtho(X, GraphicsWidth(), GraphicsHeight(), Y, -1, 1)
				glMatrixMode(GL_MODELVIEW)
				glLoadIdentity()
			EndIf
	?Win32
		EndIf
	?
	'	Print "tRender : ViewportSet OK"
		Return True
	EndFunction