[ Back to Geeks3D.com ]
 GeeXLab
Laboratory for Real Time 3D Programming (prototyping and demos) OpenGL, Lua, Python, GLSL, PhysX and more...Reference Guide Host-API Lua / Python
» Back to Homepage
» Back to Developer's Guide Index
HYP_Texture Library
Texture library
Number of functions: 34
HYP_Texture.Create
Creates an texture object. This function is useful if you plan to set the pixels manually. If width and height are zero, an empty texture object (without pixmap) will be created. You can use such a texture object with a texture render (InitFromRenderTexture).
: Lua
tex_type [INTEGER]: Texture type - Values = TEXTURE_1D (1) | TEXTURE_2D (2)
pixel_format [INTEGER]: Texture pixel format - Values = RGBA_FLOAT(1) | RGB_BYTE(2) | RGBA_BYTE(3) | RGBA_32F(4)
width [INTEGER]: Texture width
height [INTEGER]: Texture height
depth [INTEGER]: Texture depth - Set it to 0 for a 2D texture.
texId [INTEGER]: texture identifier
:
TEXTURE_2D = 2
RGBA_BYTE = 3
texId = HYP_Texture.Create(TEXTURE_2D, RGBA_BYTE, 128, 128, 0)
HYP_Texture.Destroy
Destroys an existing texture object.
: Lua - Python
texId [INTEGER]: texture identifier
:
HYP_Texture.Destroy(texId)
HYP_Texture.LoadTex2D
Creates a 2D texture from an image file.
: Lua - Python
texId [INTEGER]: texture identifier
filename [STRING]: Image file name
pixel_format [INTEGER]: Texture pixel format - Values = RGBA_FLOAT(1) | RGB_BYTE(2) | RGBA_BYTE(3) | RGBA_32F(4)
compress [INTEGER]: Texture compression state - Values = 0|1
isAbsolutePath [INTEGER]: If 1 the path to the image file is absolute. If 0, the path is relative to the scene main script. - Values = 0|1
:
RGBA_BYTE = 3
filename = "data/texture.jpg"
texId = HYP_Texture.LoadTex2D(filename, RGBA_BYTE, 0, 0)
HYP_Texture.UploadToGraphicsMemory
Uploads an existing texture object to graphics card memory.
: Lua - Python
texId [INTEGER]: texture identifier
:
HYP_Texture.UploadToGraphicsMemory(texId)
HYP_Texture.GenerateMipmaps
Allow to generate all mipmap chain when the texture will be loaded in graphics memory.
: Lua - Python
texId [INTEGER]: texture identifier
:
HYP_Texture.GenerateMipmaps(texId)
HYP_Texture.LoadTex2DAvi
Creates a 2D texture from an AVI file.
: Lua
filename [STRING]: Image file name
width [INTEGER]: Texture's width
height [INTEGER]: Texture's height
isAbsolutePath [INTEGER]: If 1 the path to the image file is absolute. If 0, the path is relative to the scene main script. - Values = 0|1
texId [INTEGER]: texture identifier
:
filename = "data/myVideo.avi"
texId = HYP_Texture.LoadTex2DAvi(filename, 512, 512, 0)
HYP_Texture.Save
Saves the texture to a file.
: Lua
texId [INTEGER]: texture identifier
filename [STRING]: texture's filename
:
HYP_Texture.Save(texId, "output.jpg")
HYP_Texture.GetDimensions
Returns texture's dimensions.
: Lua - Python
texId [INTEGER]: texture identifier
width, height, depth [INTEGER]: Texture's dimensions
:
width, height, depth = HYP_Texture.GetDimensions(texId)
HYP_Texture.InitFromRenderTexture
Initializes an empty texture from a render texture.
: Lua
texId [INTEGER]: texture identifier
rtId [INTEGER]: render texture identifier
rtTextureIndex [INTEGER]: render texture specific texture (0 to 3)
:
texId = HYP_Texture.Create(TEXTURE_2D, 3, 0, 0, 0)
HYP_Texture.InitFromRenderTexture(texId, rtId, 0)
HYP_Texture.SetFunction
Sets texture function. Only for use with the fixed pipeline.
: Lua - Python
texId [INTEGER]: texture identifier
func [INTEGER]: texture function - Values = MODULATE(0) | REPLACE(1) | ADD(2) | ADD_SIGNED(3) | SUB(4)
HYP_Texture.SetFilteringMode
Sets texture filtering mode.
: Lua - Python
texId [INTEGER]: texture identifier
mode [INTEGER]: texture filtering mode - Values = NONE(0) | LINEAR(1) | TRILINEAR(2)
:
LINEAR = 1
HYP_Texture.SetFilteringMode(texId, LINEAR)
HYP_Texture.SetAddressingMode
Sets texture addressing mode.
: Lua - Python
texId [INTEGER]: texture identifier
mode [INTEGER]: texture addressing mode - Values = WRAP(0) | MIRROR(1) | CLAMP(2)
:
CLAMP = 2
HYP_Texture.SetAddressingMode(texId, CLAMP)
HYP_Texture.SetAnisotropy
Sets texture anisotropic filtering value.
: Lua - Python
texId [INTEGER]: texture identifier
anisotropy [REAL]: anisotropic filtering
:
HYP_Texture.SetAnisotropy(texId, 16.0)
HYP_Texture.GetId
Returns texture identifier from its name.
: Lua - Python
name [STRING]: texture name
texId [INTEGER]: texture identifier
:
texId = HYP_Texture.GetId(name)
HYP_Texture.SetValueTex1DByteRgb
Sets the RGB color of a specific pixel for a 1D texture.
: Lua - Python
texId [INTEGER]: texture identifier
offset [INTEGER]: pixel's offset in texture pixmap array: offset = x where x belongs to [0 ; texWidth[
r, g, b [INTEGER]: new pixel's color. Each channel is coded on a byte.
:
HYP_Texture.SetValueTex1DByteRgb(texId, offset, r, g, b)
HYP_Texture.GetValueTex1DByteRgb
Gets the RGB color of a specific pixel for a 1D texture.
: Lua - Python
texId [INTEGER]: texture identifier
offset [INTEGER]: pixel's offset in texture pixmap array: offset = x where x belongs to [0 ; texWidth[
r, g, b [INTEGER]: pixel's color. Each channel is coded on a byte.
:
r, g, b = HYP_Texture.GetValueTex1DByteRgb(texId, offset)
HYP_Texture.SetValueTex1DFloatRgba
Sets the RGBA color of a specific pixel for a 1D texture.
: Lua - Python
texId [INTEGER]: texture identifier
offset [INTEGER]: pixel's offset in texture pixmap array: offset = x where x belongs to [0 ; texWidth[
r, g, b, a [REAL]: new pixel's color. Each channel is coded on a float.
:
HYP_Texture.SetValueTex1DFloatRgba(texId, offset, r, g, b, a)
HYP_Texture.GetValueTex1DFloatRgba
Gets the RGBA color of a specific pixel for a 1D texture.
: Lua - Python
texId [INTEGER]: texture identifier
offset [INTEGER]: pixel's offset in texture pixmap array: offset = x where x belongs to [0 ; texWidth[
r, g, b, a [REAL]: pixel's color. Each channel is coded on a float.
:
r, g, b, a = HYP_Texture.GetValueTex1DFloatRgba(texId, offset)
HYP_Texture.SetValueTex2DByteRgb
Sets the RGB color of a specific pixel for a 2D texture.
: Lua - Python
texId [INTEGER]: texture identifier
offset [INTEGER]: pixel's offset in texture pixmap array: offset = y*texWidth + x where x belongs to [0 ; texWidth[ and where y belongs to [0 ; texHeight[
r, g, b [INTEGER]: new pixel's color. Each channel is coded on a byte.
:
HYP_Texture.SetValueTex2DByteRgb(texId, offset, r, g, b)
HYP_Texture.SetValueTex2DByteRgb
Gets the RGB color of a specific pixel for a 2D texture.
: Lua - Python
texId [INTEGER]: texture identifier
offset [INTEGER]: pixel's offset in texture pixmap array: offset = y*texWidth + x where x belongs to [0 ; texWidth[ and where y belongs to [0 ; texHeight[
r, g, b [REAL]: pixel's color. Each channel is coded on a byte.
:
r, g, b = HYP_Texture.GetValueTex2DByteRgb(texId, offset)
HYP_Texture.SetValueTex2DFloatRgba
Sets the RGBA color of a specific pixel for a 2D texture.
: Lua - Python
texId [INTEGER]: texture identifier
offset [INTEGER]: pixel's offset in texture pixmap array: offset = y*texWidth + x where x belongs to [0 ; texWidth[ and where y belongs to [0 ; texHeight[
r, g, b, a [REAL]: new pixel's color. Each channel is coded on a float.
:
HYP_Texture.SetValueTex2DFloatRgba(texId, offset, r, g, b, a)
HYP_Texture.GetValueTex2DFloatRgba
Gets the RGBA color of a specific pixel for a 2D texture.
: Lua - Python
texId [INTEGER]: texture identifier
offset [INTEGER]: pixel's offset in texture pixmap array: offset = y*texWidth + x where x belongs to [0 ; texWidth[ and where y belongs to [0 ; texHeight[
r, g, b, a [REAL]: pixel's color. Each channel is coded on a float.
:
r, g, b, a = HYP_Texture.GetValueTex2DFloatRgba(texId, offset)
HYP_Texture.SetValueTex2DByteRgba
Sets the RGBA color of a specific pixel for a 2D texture.
: Lua - Python
texId [INTEGER]: texture identifier
offset [INTEGER]: pixel's offset in texture pixmap array: offset = y*texWidth + x where x belongs to [0 ; texWidth[ and where y belongs to [0 ; texHeight[
r, g, b, a [INTEGER]: new pixel's color. Each channel is coded on a byte.
:
HYP_Texture.SetValueTex2DByteRgba(texId, offset, r, g, b, a)
HYP_Texture.GetValueTex2DByteRgba
Gets the RGBA color of a specific pixel for a 2D texture.
: Lua - Python
texId [INTEGER]: texture identifier
offset [INTEGER]: pixel's offset in texture pixmap array: offset = y*texWidth + x where x belongs to [0 ; texWidth[ and where y belongs to [0 ; texHeight[
r, g, b, a [INTEGER]: pixel's color. Each channel is coded on a byte.
:
r, g, b, a = HYP_Texture.GetValueTex2DByteRgba(texId, offset)
HYP_Texture.Bind
Binds a texture on the current active texture unit (see HYP_Renderer.ActiveTextureUnit()). This function is useful with render to texture or in direct rendering scripts.
: Lua
texId [INTEGER]: texture identifier
:
HYP_Texture.Bind(texId)
HYP_Texture.ApplyToRenderer
Applies all texture's data and properties to the renderer for the current texture unit. This function is useful with render to texture or in direct rendering scripts.
: Lua
texId [INTEGER]: texture identifier
:
HYP_Texture.ApplyToRenderer(texId)
HYP_Texture.SetTransformMatrix
Sets the texture transformation matrix.
: Lua
texId [INTEGER]: texture identifier
m0 to m15 [REAL]: Matrix data (16 values)
HYP_Texture.GetAVINumFrames
Gets the number of frames of an AVI texture file.
: Lua
texId [INTEGER]: texture identifier
n [INTEGER]: Number of frames
:
n = HYP_Texture.GetAVINumFrames(texId)
HYP_Texture.GetAVIMpf
Gets the number of milliseconds per frame (MPF) of an AVI texture file.
: Lua
texId [INTEGER]: texture identifier
mpf [INTEGER]: milliseconds per frame
:
mpf = HYP_Texture.GetAVIMpf(texId)
HYP_Texture.GetAVICurrentTime
Gets the current time of an AVI texture.
: Lua
texId [INTEGER]: texture identifier
time [INTEGER]: current time
:
time = HYP_Texture.GetAVICurrentTime(texId)
HYP_Texture.GetAVICurrentTime
Gets the current time of an AVI texture.
: Lua
texId [INTEGER]: texture identifier
time [INTEGER]: current time
:
time = HYP_Texture.GetAVICurrentTime(texId)
HYP_Texture.SetAVICurrentFrame
Sets the current frame of an AVI texture.
: Lua
texId [INTEGER]: texture identifier
frame [INTEGER]: current frame - Values = [0 ; GetAVINumFrames()-1]
:
time = HYP_Texture.SetAVICurrentFrame(texId, frame)
HYP_Texture.GetAVICurrentFrame
Gets the current frame of an AVI texture.
: Lua
texId [INTEGER]: texture identifier
frame [INTEGER]: current frame
:
frame = HYP_Texture.GetAVICurrentFrame(texId)
HYP_Texture.PlayStopAVI
Sets the current frame of an AVI texture.
: Lua
texId [INTEGER]: texture identifier
state [INTEGER]: plays (1) or stops (0) the AVI texture - Values = 0|1
:
HYP_Texture.PlayStopAVI(texId, 0)
|