All pastes #584690 Raw Edit

ASM GLtest

public text v1 · immutable
·published 2007-06-22 21:44 UTC
rendered paste body
extern SDL_Init
extern SDL_GL_SetAttribute
extern SDL_SetVideoMode
extern SDL_GL_SwapBuffers
extern glVertex3i
extern glBegin
extern glEnd
extern glLoadIdentity
extern sleep

section .data

section .text
	global main

main:
	;init sdl with video
	push 0x20
	call SDL_Init
	add esp,4
	
	;red buffer = 5
	push 5
	push 0
	call SDL_GL_SetAttribute
	add esp,4*2
	
	;green buffer = 5
	push 5
	push 1
	call SDL_GL_SetAttribute
	add esp,4*2
	
	;blue buffer = 5
	push 5
	push 2
	call SDL_GL_SetAttribute
	add esp,4*2
	
	;alpha buffer = 1
	push 1
	push 3
	call SDL_GL_SetAttribute
	add esp,4*2
	
	;enable double buffering
	push 1
	push 5
	call SDL_GL_SetAttribute
	add esp,4*2
	
	;enter 640 by 480 16bpp
	push 0x02
	push 16
	push 480
	push 640
	call SDL_SetVideoMode
	add esp,4*4
	
; 	call glLoadIdentity
	
	
; 	push  1.0
; 	push d 1.0
; 	push d 0
; 	push d 0
; 	call glRotatef
; 	add esp,8*4
	
	push 4
	call glBegin
	add esp,4
	
	push 0
	push 0
	push 0
	call glVertex3i
	add esp,4*3
	
	push 0
	push 1
	push 0
	call glVertex3i
	add esp,4*3
	
	push 0
	push 0
	push 1
	call glVertex3i
	add esp,4*3
	
	call glEnd
	
	call SDL_GL_SwapBuffers
	
	;sleep for a sec to stare in awe at the might triangle
	push 2
	call sleep
	add esp,4
	
	;exit with code 0
	mov eax,0
	ret