Advertisement

OpenGL in assembler

Started by November 09, 2000 03:13 PM
2 comments, last by Hiroshimator 23 years ago
Hello everyone. I would like to try and program for opengl in assembler (MASM32) I have made win32 programs in assembler before and the structure in NeHes tutorials is clear to me. However I''m not very comfortable with Floating Point yet and the ASM conversions of NeHes tutorials (written in TASM if I''m not mistaken) use const vars such as ; Numeric Data constants _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 _m15 equ -1077936128 ;-1.5 _m6 equ -1061158912 ;-6.0 _15 equ 1069547520 Know I''m sorry if this should be basic knowledge but I have no clue 1. how he got these values 2. why he pushes doubles where NeHe pushes floats (1 is REAL8 other is real4, DWORD difference, but that''s not really a problem) So does anyone have an example in masm or anything with gluPerpsective and the likes. My code is crashing somewhere after the windows creation and I think it has to do with gluPerspective call I make. Any help on this and the constants above will be appreciated. if anyone can show me how to make an invoke call with floats that would be great. My program keeps crashing and I don''t know why Another question: does anyone know where I can download the bluebook (on it''s site it''s impossible ) Thank you very much and thanks for a great site. Harold
I had the same problem before...

i think it''s has something to do with how data are stored in the RAM .

gluPerspective takes 4 parameter.. but when i program i MASM i use 8 parameter.
Here is what i have to do to make it work
for example)

aaa dq 45.0
bbb dq 25.0
ccc dq 5.0
ddd dq -5.0

invoke gluPerspective,DWORD PTR aaa,DWORD PTR aaa+4,DWORD PTR bbb,DWORD PTR bbb+4,DWORD PTR ccc,DWORD PTR ccc+4,DWORD PTR ddd,DWORD PTR ddd+4

summary::
Use dq and DWORD PTR +
And with other word you have to do this with other OGL commands too for example vertexf and so on

good luck!
-= Nothing is impossible=-
Advertisement
Blue Book
You can find the Blue Book online at http://www.gamedev.net/reference/count.asp?LinkID=611 but I don''t know if you can *download* it there.


float / double
You have to push doubles because the gluPerspective function needs doubles.
From GLU specifications :

void gluPerspective( GLdouble fovy, GLdouble aspect,
GLdouble near, GLdouble far );

That''s not a problem for NeHe''s C/C++ code because the compiler automatically converts floats to doubles.


Crash
You have to make sure that glu32 is loaded into memory. GLU32 functions are probably separated to OpenGL functions.
ok ,thats why.... now i see little better
thanks! :-)
-= Nothing is impossible=-

This topic is closed to new replies.

Advertisement