Hi everybody,

I've been reading this board for quite a while now and I finally got around to post something (I was too lazy to click on the register button :tongue: ). Anyway, I've started using assembly for all my projects (not that I have a lot), and I'd really like to be able to use OpenGL. I've already tried Masm, but I find it too big for my taste (besides, I like to have the source of all the tools I'm using). I was thinking if it was possible, with fasm's macroinstructions, to ease the use of OpenGL with something like glCallf or glCalld (like the ones found in bizzarecreations' gl includes files) which declares floating-point variables and push them on the stack for use with the call instruction (I have a C background, hence the description I'm making of this concept, correct me if I use inappropriate terms). I already started *trying* to create them, but my limited knowledge of assembly and fasm makes it difficult for me to get something working in that area.

The point is, can anyone help me with that problem, or give me directions if it was already solved by one of you guys?

P.S: How can Privalov answer all those questions and bug reports so fast?!? :eek: Is he a god, or does he simply pay a few code monkeys to help him? ;)
Posted on 2002-08-17 01:45:00 by Natix
The attached file contains some OpenGL equated converted for fasm by Anvar Sosnitski.

You should not have any problems with the floating-point values, because with fasm they can be used everywhere in place of any other number expression. For example you can provide the immediate floating-point value as an parameter for "invoke" macro.

PS. To reduce costs on monkeys I do it all myself.
Posted on 2002-08-17 05:34:23 by Tomasz Grysztar
:eek:... :alright:

Thanks for the fast answer! It works well with normal floating-point numbers, but not when it ends with 'f'.

Ex: invoke glClearDepth, 1.0f

Most OpenGL calls in C/C++ uses this syntax, and it would make easier porting to fasm if it would be accepted. :)

Anyway, sorry for requesting help before trying it out myself, I assumed it was not working this way because Masm and Nasm don't have this built-in. Keep up the good work! :alright:
Posted on 2002-08-17 10:29:02 by Natix
1.0f is supported now.
Posted on 2002-08-18 13:17:11 by Tomasz Grysztar
Thanks! :alright:

Now what about 0.9f, 0.8f, etc... j/k ;)
Posted on 2002-08-18 15:34:10 by Natix
:grin:
Posted on 2002-08-18 16:07:13 by Tomasz Grysztar
Hmm... all in place floating-point values are converted to dword format, but some ogl functions require 64-bit values (qword). Wouldn't it be possible to support them aswell? The idea would simply be to make the assembler format the floating point to a qword value and let us access the hi-dword or the low-dword. Maybe something like this:

invoke glFunction, low(1.0d), hi(1.0d)

which would be the same as using

fp_value dq 1.0
invoke glFunction, dword , dword


But then again, I guess a macro could accomplish this work. Any suggestions?
Posted on 2002-08-23 04:42:59 by Natix


struc equq value
{
virtual at 0
dq value
load .low dword from 0
load .high dword from 4
end virtual
}

pi equq 3.14159265358979

invoke glFunction, pi.low, pi.high
Posted on 2002-08-23 05:14:05 by Tomasz Grysztar
thx :) it's not exactly what I needed, but will do nicely :alright:
Posted on 2002-08-23 05:35:52 by Natix
I'm pretty sure it's exaclty what you asked for. It defines constants, not data.
Posted on 2002-08-23 06:08:46 by Tomasz Grysztar