|
Table of Contents
Texture functions used for displaying imagesmglCreateTexture: Create a texture from a matrix
purpose: Create a texture for display on the screen with mglBltTexture image can either be grayscale nxm, color nxmx3 or color+alpha nxmx4
mglOpen; mglClearScreen mglScreenCoordinates texture = mglCreateTexture(round(rand(100,100)*255)); mglBltTexture(texture,[0 0]); mglFlush; mglBltTexture: Draw the texture to the screen
purpose: Draw a texture to the screen in desired position.
To display several textures at once, texture can be an array of n textures, position is nx2, or nx4 and hAlignment, vAlignment and rotation are either a single value or an array of n. multiple textures: mglOpen; mglVisualAngleCoordinates(57,[16 12]); image = rand(200,200)*255; imageTex = mglCreateTexture(image); mglBltTexture([imageTex imageTex],[-3 0;3 0],0,0,[-15 15]); mglFlush; single textures mglOpen; mglVisualAngleCoordinates(57,[16 12]); image = rand(200,200)*255; imageTex = mglCreateTexture(image); mglBltTexture(imageTex,[0 0]); mglFlush; mglDeleteTexture: Delete a texture
purpose: Deletes a texture. This will free up memory for textures that will not be drawn again. Note that when you call mglClose texture memory is freed up. You only need to call this if you are running out of memory and have textures that you do not need to use anymore.
mglOpen; mglClearScreen mglScreenCoordinates texture = mglCreateTexture(round(rand(100,100)*255)); mglBltTexture(texture,[0 0]); mglFlush; mglDeleteTexture(texture); |