Hello, lately I played a bit with GLFW. But I´ve got a problem: When I try to set the background color of the window to red, it´s getting yellow instead. What´s the problem?
section .drectve info align=8
db "glfw3.dll", 0x20
db "kernel32.dll", 0x20
db "opengl32.dll", 0x20
extern glfwInit
extern glfwCreateWindow
extern glfwMakeContextCurrent
extern glfwWindowShouldClose
extern glfwGetFramebufferSize
extern glfwSwapBuffers
extern glfwPollEvents
extern glfwTerminate
extern glClearColor
extern glClear
extern ExitProcess
section .data align=8
hello db "Hello World!", 0
window dq 0
one dq 1.0
zero dq 0.0
section .text
global Start
Start:
sub rsp, 0x38
call glfwInit
test rax, rax
jz shitHappened
mov rcx, 640
mov rdx, 480
mov r8, hello
xor r9, r9
mov [rsp+0x20], r9
call glfwCreateWindow
test rax, rax
jz terminate_shitHappened
mov [window], rax
mov rcx, [window]
call glfwMakeContextCurrent
mov rcx, [one]
mov rdx, [zero]
mov r8, [zero]
mov r9, [zero]
call glClearColor
messageLoop:
mov rcx, [window]
call glfwWindowShouldClose
test rax, rax
jnz terminate
mov rcx, 0x4000
call glClear
mov rcx, [window]
call glfwSwapBuffers
call glfwPollEvents
jmp messageLoop
shitHappened:
mov rcx, 1
call ExitProcess
add rsp, 0x38
ret
terminate_shitHappened:
call glfwTerminate
mov rcx, 1
call ExitProcess
add rsp, 0x38
ret
terminate:
call glfwTerminate
xor rcx, rcx
call ExitProcess
add rsp, 0x38
ret