I'm following NeHe's second tutorial, the window is created and everything runs fine, but no triangle or square is shown, here's my DrawGLScene function:

DrawGLScene proc                                        ;drawing proc
    invoke glClear, GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT ;clear screen and depth buffer
    invoke glLoadIdentity                                      ;reset modelview matrix
    invoke glTranslatef, _m1d5, 0, _m6
    invoke glBegin, GL_TRIANGLES
        invoke glVertex3f, 0, _1, 0
        invoke glVertex3f, _m1, _m1, 0
        invoke glVertex3f, _1, _m1, 0
    invoke glEnd
    invoke glTranslatef, _3, 0, 0
    invoke glBegin, GL_QUADS
        invoke glVertex3f, _m1, _1, 0
        invoke glVertex3f, _1, _1, 0
        invoke glVertex3f, _1, _m1, 0
        invoke glVertex3f, _m1, _m1, 0
    invoke glEnd
    mov eax, TRUE
    ret
DrawGLScene endp


These numbers with a _ preceding them are constants to replace the float numbers:

_45d0	equ 40468000h ;45.0
_45d1  equ 0
_01d0 equ 1069128089
_01d1  equ -1717986918 ;0.1
_100d0 equ 1079574528
_100d1  equ 0          ;100.0
_1d0 equ 1072693248
_1d1    equ 0          ;1.0
_05     equ 1056964608  ; 0.5
_1     equ 1065353216  ; 1.0
_m1     equ -1082130432 ;-1.0
_3     equ 1077936128  ; 3.0
_m1d5  equ -1077936128 ;-1.5
_m6     equ -1061158912 ;-6.0


And here's my whole asm file, it's based on the ASM and MASM translations of this tutorial:

Some of you might be wondering why am I making so topics on both DirectX and OpenGL, the reason of that is that I haven't decided yet wich one I'll be using from now on, I'm still deciding :)
Attachments:
Posted on 2005-11-24 19:44:49 by Lenin

what's with winextra.def? Is this part of MASM32?

Posted on 2005-11-25 06:30:57 by japheth
Attached. This came along with masm translation of the tutorial...
Attachments:
Posted on 2005-11-25 20:17:57 by Lenin
It may be something with the camera (my blind guess). Write yourself a 'LookAtSceneCenter()' function (using gluLookAt, for example).


BTW: there's a typo in the title
Posted on 2005-11-25 21:29:58 by ti_mo_n

in ReSizeGLScene ratio should be defined as REAL8 (or QWORD), not as DWORD
Posted on 2005-11-25 22:32:20 by japheth


in ReSizeGLScene ratio should be defined as REAL8 (or QWORD), not as DWORD



The program is working fine now! Thank you :)
Posted on 2005-11-26 08:42:50 by Lenin
I have one problem... As I already said I'm using these decimal constants to replace the floating number, and it's working finely, as long as I have them. I would like to know how to get these constants, without having to look at the tutorial's translation, for numbers like -7.0f, etc.

I already looked for float to dec converters in google without succes...
Posted on 2005-11-26 13:43:37 by Lenin

you could define them as variables instead of constants. Then there is no need for a conversion:

_05d  REAL8 0.5

but is is a bit "slower" of course ;-)

Posted on 2005-11-26 14:51:26 by japheth
Thanks :) Still I can't use it in any API, opcode...

_m7 REAL8 -7.0
invoke glTranslatef, _1d5, 0, _m7


Gives me:
error A2114: INVOKE argument type mismatch : argument : 3


I tried things like: mov eax, _m7 and push _m7 but they all give me errors...
Posted on 2005-11-26 16:43:51 by Lenin
Translatef requires "REAL4" (I guess that's the name. I've only used TASM, where it's simply 'dd' ).
Posted on 2005-11-26 21:01:45 by ti_mo_n
Perfect :) Thanks.
Posted on 2005-11-27 11:57:31 by Lenin
More problems... Now on tut 7.... Here I 'm loading an image of a crate and using it as a texture, everything is running smoothly except that the crate is... blue.  :O
Attachments:
Posted on 2005-11-28 19:39:17 by Lenin

try using GL_BGR_EXT instead of GL_RGB in glTextImage2D and glBuild2DMipmaps.


Posted on 2005-11-29 03:26:56 by japheth
Thanks :)
Posted on 2005-11-29 14:01:43 by Lenin
Remember to check whether the BGR extension is supported, or better write yourself a RGB->BGR converter (this way you'll get a bit independent :P ).

Prefer using DXn texture format.
Posted on 2005-11-29 23:15:49 by ti_mo_n