Simple quad program?

BlitzMax Forums/BlitzMax OpenGL Programming/Simple quad program?

Drawing in Max2D and drawing in 'pure GL' using screen coordinates:
' Mode1 is pretty much the same as Mode2, except in Mode1
' the states are set up for you and transformations are
' performed in DrawRect, no transformations are performed
' in Mode2 for the sake of simplicity

Goto Mode1

' Pure Max2D
#Mode1

Graphics 800,600,0,0

While Not KeyDown(KEY_ESCAPE)
	
	Cls()
	
	SetColor(255,255,255)
	
	DrawRect(GraphicsWidth()*.5-64,GraphicsHeight()*.5-64,128,128)
	
	Flip()
	
	FlushMem
	
Wend

End





' Pure GL
#Mode2

bglCreateContext(800,600,0,0,BGL_BACKBUFFER | BGL_DEPTHBUFFER)

glOrtho(0,800,0,600,-10,10)

While Not KeyDown(KEY_ESCAPE)
	
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
	
	glBegin(GL_QUADS)
	
	glVertex2f(400-64,300-64)
	glVertex2f(400+64,300-64)
	glVertex2f(400+64,300+64)
	glVertex2f(400-64,300+64)
	
	glEnd()
	
	bglSwapBuffers()
	
	FlushMem
	
Wend

End


The problem you might run into with textures is that Max2D stores its own texture state variables and has its own functions for binding GL textures, but these functions aren't exposed, so basically, if you want to use GL and Max2D, you're screwed.