News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

[Solved] OpenGL artifact during glRotatef

Started by Mishanya00, August 23, 2024, 06:17:13 AM

Previous topic - Next topic

Mishanya00

Update: I found a mistake, I should multiply x coordinate by 2 before drawing square.

Hello everyone! I encountered an artifact while trying to draw the tape of squares. It looks properly if I dont use glRotatef(60, 1,0,0) but if I do, it gets these strips of another color. If I add one more glRotatef as glRotatef(30, 0,0,1) it gets even worse. Maybe someone encountered smth similar this as well? And one more question: is it recommended not to use masm32 for creating OpenGL programs? I see all tutorials are on masm64. Thanks for reading!

After glRotatef(60, 1,0,0):


After glRotatef(60, 1,0,0) and glRotatef(30, 0,0,1):


My procedure:
Game_ShowField proc uses ecx esi edi
LOCAL tmp:REAL4

mov edi, -10
mov esi, 1

.while edi != 11

.if esi == 1
invoke glColor3f, FP4(1.0), FP4(1.0), 0
mov esi, 0
.else
invoke glColor3f, FP4(1.0), FP4(1.0), FP4(1.0)
mov esi, 1
.endif

invoke glPushMatrix

mov tmp, edi
fild tmp
fstp tmp
invoke glTranslatef, tmp,0,0
invoke Quad

invoke glPopMatrix

inc edi

.endw

@@Ret:
Ret
Game_ShowField endp


NoCforMe

Heh: at first I thought this was a mistake in your code:
    LOCAL tmp:REAL4
            mov tmp, edi
            fild tmp
            fstp tmp

but now I see it's kinda clever: you first load tmp as a 32-bit integer, then magically turn it into a 32-bit floating-point value. Cool!
Assembly language programming should be fun. That's why I do it.