flat assembler
Message board for the users of flat assembler.
Index
> Windows > double precision function arguments |
Author |
|
LocoDelAssembly 28 Aug 2008, 03:44
http://flatassembler.net/docs.php?article=win32
2.1 Procedure parameters wrote: If the parameter is preceded by the word double, it is treated as 64-bit value and passed to the procedure as two 32-bit parameters. For example: But still, are you sure the crash is because of the gluPerspective call? |
|||
28 Aug 2008, 03:44 |
|
bitshifter 28 Aug 2008, 04:27
Quote: But still, are you sure the crash is because of the gluPerspective call? If i comment out that function call she doesn't crash. Also, i did find that part about preceding the var with double. The manual is the first place i look before asking questions. I had to include win32ax to make it visible to the assembler. Is there any reason why my second attempt crashes? Either way, im not seeing anything in the viewport. My code is almost 400 lines so i would hate to post it, but if you would like me too i can. |
|||
28 Aug 2008, 04:27 |
|
LocoDelAssembly 28 Aug 2008, 05:16
Post it as a zipped attachment, even the HTML code of this thread will be bigger than the ZIP.
Do you know what kind of exception are you getting? Perhaps your problem is that you don't have GLUT installed on your system (the library macro includes the import data only if some of the imported functions is used and import macro includes the used functions only). |
|||
28 Aug 2008, 05:16 |
|
bitshifter 28 Aug 2008, 05:51
Ok, by including win32ax.inc and invoking the function like:
Code: invoke gluPerspective,double[g_fovy],double[g_aspect],double[g_znear],double[g_zfar] I got it working! This is the code that was causing the crash, why? i do not know? Code: push dword [g_zfar+4] push dword [g_zfar] push dword [g_znear+4] push dword [g_znear] push dword [g_aspect+4] push dword [g_aspect] push dword [g_fovy+4] push dword [g_fovy] call gluPerspective And im having problems with calculating the aspect ratio. Code: g_aspect dq ? g_width dd 1024 g_height dd 768 ; my attempt (g_aspect = g_width / g_height) fild [g_width] fild [g_height] fdiv st1,st0 fstp [g_aspect] Thanks for the help so far, you have been great!!! |
|||
28 Aug 2008, 05:51 |
|
bitshifter 28 Aug 2008, 08:56
Ok, after some more reading the manual and some more tinkering i think i nailed it down!
Code: g_width dd ? g_height dd ? g_aspect dq ? .wmsize mov eax,[lparam] mov ebx,eax and eax,0xFFFF shr ebx,16 mov [g_width],eax mov [g_height],ebx fld [g_width] fld [g_height] fdivp st1,st0 fstp [g_aspect] This seems to be working perfectly! Now i can use the values to setup a perspective projection matrix. Ahhh...How nice it is to get results. |
|||
28 Aug 2008, 08:56 |
|
r22 02 Sep 2008, 16:09
http://board.flatassembler.net/topic.php?t=8381
Some OGL code that may be useful. |
|||
02 Sep 2008, 16:09 |
|
bitshifter 03 Sep 2008, 04:05
Yes, i had stumbled upon that article during my adventure's here.
Right now i am a little further along than that. For practice i am porting much of my opengl code to fasm. I strive to get my game engine up and running with it. |
|||
03 Sep 2008, 04:05 |
|
bitshifter 23 Sep 2008, 02:32
Ok, i found why this crashes...
Code: push dword [g_zfar+4] push dword [g_zfar] push dword [g_znear+4] push dword [g_znear] push dword [g_aspect+4] push dword [g_aspect] push dword [g_fovy+4] push dword [g_fovy] call gluPerspective I was supposed to enclose the function in brackets like... Code: call [gluPerspective] What confuses me is that imported function calls should be within brackets and .code section functions (using labels) should not be within brackets. |
|||
23 Sep 2008, 02:32 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.