2D in OpenGL

BlitzMax Forums/BlitzMax OpenGL Programming/2D in OpenGL

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

local drawX:float,drawY:float
local drawWidth:float,drawHeight:float


glBegin(GL_QUADS)

glTexCoord2f 0,0
glVertex2f drawX,drawY

glTexCoord2f 1,0
glVertex2f drawX+drawWidth,drawY


glTexCoord2f 1,1
glVertex2f drawX+DrawWidth,drawy+drawheight


glTexCoord2f 0,1
glVertex2f drawx,drawy+drawheight


glEnd()

to help you visualize it. of course that does not cover the gl code to load and bind a texture, that would simply render a solid rect.(Whose color could be changed by calling glColor4f)

In short, always roll your own renderer. Even if you don't need to, do it. You'll learn faster, end up with more flexible engines(max2d is a newbie engine, whichever way you look at it. Not one "Wow" feature, at least in my eyes)

If you need more help, speak to my mate dave. he's a wizard at this coding lark. me, I just make him tea.