![]() |
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, upzThese variables are created like this: :
eyex dd 0.0:
_gluLookAt macro A1, A2, A3, A4, A5, A6, A7, A8, A9I 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 |
|
Thanks for the link! It took me back on track again.
But... I got that I should use the cdq instruction to extend the eax to edx. Right? Am I thinking correct if I try using this rewritten code instead of the old one? :
_gluLookAt macro A1, A2, A3, A4, A5, A6, A7, A8, A9 |
Problem solved...
|
Mind posting the solution to help others?
|
I solved it using constants. It is a solution so far. And next step is to use double variables instead, so I can move the camera around in real time.
The original function used :
void gluLookAt(GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ,In C++ the code would look like this: :
double eyez = 45.0;Rewritten in assembly it looks like this: :
_45d0 equ 40468000h ; eyez |
| All times are GMT -5. The time now is 4:24 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC