BlitzMax/Modules/Graphics/OpenGL Graphics

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Functions[edit | edit source]

GLGraphicsDriver[edit | edit source]

Function GLGraphicsDriver:TGLGraphicsDriver()

Description: Get OpenGL graphics driver

Returns: An OpenGL graphics driver

Information: The returned driver can be used with SetGraphicsDriver

GLGraphics[edit | edit source]

Function GLGraphics:TGraphics( width,height,depth=0,hertz=60,flags=GRAPHICS_BACKBUFFER|GRAPHICS_DEPTHBUFFER )

Description: Create OpenGL graphics

Returns: An OpenGL graphics object

Information: This is a convenience function that allows you to easily create an OpenGL graphics context.

GLAdjustTexSize[edit | edit source]

Function GLAdjustTexSize( width Var,height Var )

Description: Helper function to calculate nearest valid texture size

Information: This functions rounds width and height up to the nearest valid texture size

GLTexFromPixmap[edit | edit source]

Function GLTexFromPixmap( pixmap:TPixmap,mipmap=True )

Description: Helper function to create a texture from a pixmap

Returns: Integer GL Texture name

Information: pixmap is resized to a valid texture size before conversion.

GLDrawRect[edit | edit source]

Function GLDrawRect( x,y,width,height )

Description: Helper function to output a simple rectangle

Information: Draws a rectangle relative to top-left of current viewport.

GLDrawText[edit | edit source]

Function GLDrawText( text$,x,y )

Description: Helper function to output some simple 8x16 font text

Information: Draws text relative to top-left of current viewport.

The font used is an internal fixed point 8x16 font.

This function is intended for debugging purposes only - performance is unlikely to be stellar.

GLDrawPixmap[edit | edit source]

Function GLDrawPixmap( pixmap:TPixmap,x,y )

Description: Helper function to draw a pixmap to a gl context

Information: Draws the pixmap relative to top-left of current viewport.

This function is intended for debugging purposes only - performance is unlikely to be stellar.

GLShareContexts[edit | edit source]

Function GLShareContexts()

Description: Enable OpenGL context sharing

Information: Calling GLShareContexts will cause all opengl graphics contexts created to shared displaylists, textures, shaders etc.

This should be called before any opengl contexts are created.