Draw textured rectangle

BlitzMax Forums/OpenGL Module/Draw textured rectangle

plash(Posted 2008) [#1]
What do I have to do to my dimensions to apply max2d origin, handle, scale, rotation, etc to a quad I'm drawing? What about alpha and blend?

I thought I saw a way to do it by modifying the modules but that is less than optimal..

(Talking GetScale, GetHandle, GetOrigin, GetRotation etc..)

Current code:
Function DrawTexturedQuad(x:Float, y:Float, w:Float, h:Float, texture:Int)
	
	'Make transformations to dimensions
	
	glPushMatrix() 'Necessary?
	
	glBindTexture(GL_TEXTURE_2D, texture)
	
	glBegin(GL_QUADS)
	glTexCoord2f(0.0, 0.0); glVertex2f(x, y)			'Top-Left
	glTexCoord2f(1.0, 0.0); glVertex2f(x + w, y)		'Top-Right
	glTexCoord2f(1.0, 1.0); glVertex2f(x + w, y + h)		'Bottom-Right
	glTexCoord2f(0.0, 1.0); glVertex2f(x, y + h)		'Bottom-Left
	glEnd()
	
	'Unbind texture??
	
	glPopMatrix() 'Necessary?

End Function



plash(Posted 2008) [#2]
Nevermind.. I just looked at the code for DrawPixmap, which already handles the dimensions and draws the pixels directly from the pixmap instead of having a load of textures on hand.

EDIT: Lost my thought there.. I have to be able to change the vertex values so using drawimage/drawpixmap isn't an option..

Halp, GL guru's!


plash(Posted 2008) [#3]


*Gasps for air*

Sheesh.. That took forever..

But I had to make a modification to brl.glmax2d :(