|
Forum
|
|
|
C++ OpenGl tutorial translated to Assembly, the prototypes from masm32 includes conflict with the ones in C++ and my program runs but it crashes on CreateWindowEx.
|
|
| Savage |
|

Very Very Active Member
    
Group: Members
Posts: 88
Member No.: 1048
Joined: 27-February 05

|
This just in: When I try to draw things, the screen stays black. Lol.
my updated file is attached.
Note that I couldn't get my $fConst macro to account for negative signs, so I had to just fall back to having it use non-unique constants. In other words, each time I make a float with a value "-1.0", it is going to take up more space. So I end up having hundreds of them.
Right now I have it so $fConst(12.345) turns into
| CODE | | c_REAL4_12_345 REAL4 12.345 |
And $dConst(12.345) turns into
| CODE | | c_REAL8_12_345 REAL8 12.345 |
And I would like it if I could get negatives to work properly. (Right now it incorrectly changes $fConst(-12.345) into c_REAL4_-12_345 or something like that.
Ideally, I would love for $fConst(-12.345) to turn into something like
| CODE | | c_REAL4_neg_12_345 REAL4 -12.345 |
If anyone wants to help me out, just fiddle with the macro and use %echo to see what the variable ends up as. That's what I've been doing. I have no expertise whatsoever with doing macros, mine are all by trial and error. For example, I turned the decimal point into a "_" by searching for its position in the string, and then using @CatStr to take everything before and after the decimal opint, and just placing a "_" in the middle. It's pretty much brute force, since, ironically, efficiency is not relevant in macros, lol. The only thing we care about is the end result. The negative signs are a big problem. Hmm well I guess I didnt think of this before, for the time being, I could just make a macro specifically for negative values, like $fConstNeg().
Attached File ( Number of downloads: 13 )
Login or Register to download
|
| |
|
|
|
| Savage |
|

Very Very Active Member
    
Group: Members
Posts: 88
Member No.: 1048
Joined: 27-February 05

|
Blood, sweat, and tears, my friends.
| CODE | $fConst MACRO Num dotposition equ @InStr(2,<Num>,<.>) IFIDN @SubStr(<Num>,1,1),<-> formatted textequ @CatStr(<_c_REAL4_>,@SubStr(<Num>,1,dotposition-1),<_>,@SubStr(<Num>,dotposition+1)) sgnlocation equ @InStr(1,%formatted,<->) formatted textequ @CatStr(<_>,@SubStr(%formatted,1,sgnlocation-1),@SubStr(%formatted,sgnlocation+1)) ELSE formatted textequ @CatStr(<c_REAL4_>,@SubStr(<Num>,1,dotposition-1),<_>,@SubStr(<Num>,dotposition+1)) ENDIF %IFNDEF formatted .const formatted REAL4 Num .code ENDIF EXITM <formatted> ENDM
|
Finally got the little devil to work. Lol. It works. It ain't pretty. But it works. Just made it start with another underscore, for example, $fConst(-100.65) = __c_REAL4_100_65, I will prettify the macro soon. Anyone have any suggestions to be more efficient, I would appreciate it. Anyway, it turns out this not only made it easier to do the code, but it also fixed whatever was wrong with the program! Here is myfinal (for now...) working template for OpenGL! All that's left is translating dozens of functions over, which really isn't that hard.
Attached File ( Number of downloads: 57 )
Login or Register to download
|
| |
|
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
|
|
|