View Single Post
Old Nov 7th, 2005, 1:30 PM   #1
Klarre
Game engine designer
 
Klarre's Avatar
 
Join Date: May 2005
Location: Sweden
Posts: 296
Rep Power: 4 Klarre is on a distinguished road
Floats to doubles

I have a problem with floats and doubles.

I wanted to put a camera in my OpenGL scene. But when
I added the gluLookAt function, the program did'nt started
anymore.

I was using this code, and simply made a call like
_gluLookAt eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz
in my draw function.
These variables are created like this:
eyex dd 0.0

_gluLookAt macro A1, A2, A3, A4, A5, A6, A7, A8, A9
	push A9
	push A8
	push A7
	push A6
	push A5
	push A4
	push A3
	push A2
	push A1
	call gluLookAt
endm

I guessed that the problem was that the gluLookAt function expects 64 bits doubles,
instead of 32 bits floats. I tried my assumption by pushing twice as much on the stack.
Then the program started again, but with wrong values to gluLookAt of course.

How shall I solve this problem? How do I convert my floats to doubles? Is there
a simple way of doing this?

I am not an assembly guru, so try keeping the answears as clean as possible

Thanks

/Klarre
Klarre is offline   Reply With Quote