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):
(https://i.postimg.cc/cKx2pJyK/Screenshot-9.jpg) (https://postimg.cc/cKx2pJyK)
After glRotatef(60, 1,0,0) and glRotatef(30, 0,0,1):
(https://i.postimg.cc/RJ5RzP6P/Screenshot-10.jpg) (https://postimg.cc/RJ5RzP6P)
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
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!