"No one can be told what GeeXLab is, you have to see it for yourself!"

"Stop Playing Games and Start Making Them! With GeeXLab, your are on your way!"


Quick Links
What is GeeXLab
Download GeeXLab
GeeXLab Requirements
Online Help
Articles and Tutorials
Samples Screenshots
Videos

GeeXLab Changelog

XML Ref. Guide
Scripting Ref. Guide
Code Samples

Purchase GeeXLab
GeeXLab SDK

Shader Library

Follow GeeXLab's News
GeeXLab news, articles, tutorials and demos @ Geeks3D.com
GeeXLab @ Twitter GeeXLab RSS Feed

Subscribe to GeeXLab news by email

[ Back to Geeks3D.com ]

GeeXLab

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


Description
Texture library

Number of functions: 34

HYP_Texture.Create

Description
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).

Languages: Lua

Parameters
  • 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.

    Return Values
  • texId [INTEGER]: texture identifier

    Code sample :

    TEXTURE_2D = 2
    RGBA_BYTE = 3
    texId = HYP_Texture.Create(TEXTURE_2D, RGBA_BYTE, 128, 128, 0)


    HYP_Texture.Destroy

    Description
    Destroys an existing texture object.

    Languages: Lua - Python

    Parameters
  • texId [INTEGER]: texture identifier

    Code sample :

    HYP_Texture.Destroy(texId)


    HYP_Texture.LoadTex2D

    Description
    Creates a 2D texture from an image file.

    Languages: Lua - Python

    Parameters
  • 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

    Code sample :

    RGBA_BYTE = 3
    filename = "data/texture.jpg"
    texId = HYP_Texture.LoadTex2D(filename, RGBA_BYTE, 0, 0)


    HYP_Texture.UploadToGraphicsMemory

    Description
    Uploads an existing texture object to graphics card memory.

    Languages: Lua - Python

    Parameters
  • texId [INTEGER]: texture identifier

    Code sample :

    HYP_Texture.UploadToGraphicsMemory(texId)


    HYP_Texture.GenerateMipmaps

    Description
    Allow to generate all mipmap chain when the texture will be loaded in graphics memory.

    Languages: Lua - Python

    Parameters
  • texId [INTEGER]: texture identifier

    Code sample :

    HYP_Texture.GenerateMipmaps(texId)


    HYP_Texture.LoadTex2DAvi

    Description
    Creates a 2D texture from an AVI file.

    Languages: Lua

    Parameters
  • 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

    Return Values
  • texId [INTEGER]: texture identifier

    Code sample :

    filename = "data/myVideo.avi"
    texId = HYP_Texture.LoadTex2DAvi(filename, 512, 512, 0)


    HYP_Texture.Save

    Description
    Saves the texture to a file.

    Languages: Lua

    Parameters
  • texId [INTEGER]: texture identifier
  • filename [STRING]: texture's filename

    Code sample :

    HYP_Texture.Save(texId, "output.jpg")


    HYP_Texture.GetDimensions

    Description
    Returns texture's dimensions.

    Languages: Lua - Python

    Parameters
  • texId [INTEGER]: texture identifier

    Return Values
  • width, height, depth [INTEGER]: Texture's dimensions

    Code sample :

    width, height, depth = HYP_Texture.GetDimensions(texId)


    HYP_Texture.InitFromRenderTexture

    Description
    Initializes an empty texture from a render texture.

    Languages: Lua

    Parameters
  • texId [INTEGER]: texture identifier
  • rtId [INTEGER]: render texture identifier
  • rtTextureIndex [INTEGER]: render texture specific texture (0 to 3)

    Code sample :

    texId = HYP_Texture.Create(TEXTURE_2D, 3, 0, 0, 0)
    HYP_Texture.InitFromRenderTexture(texId, rtId, 0)


    HYP_Texture.SetFunction

    Description
    Sets texture function. Only for use with the fixed pipeline.

    Languages: Lua - Python

    Parameters
  • texId [INTEGER]: texture identifier
  • func [INTEGER]: texture function - Values = MODULATE(0) | REPLACE(1) | ADD(2) | ADD_SIGNED(3) | SUB(4)

    HYP_Texture.SetFilteringMode

    Description
    Sets texture filtering mode.

    Languages: Lua - Python

    Parameters
  • texId [INTEGER]: texture identifier
  • mode [INTEGER]: texture filtering mode - Values = NONE(0) | LINEAR(1) | TRILINEAR(2)

    Code sample :

    LINEAR = 1
    HYP_Texture.SetFilteringMode(texId, LINEAR)


    HYP_Texture.SetAddressingMode

    Description
    Sets texture addressing mode.

    Languages: Lua - Python

    Parameters
  • texId [INTEGER]: texture identifier
  • mode [INTEGER]: texture addressing mode - Values = WRAP(0) | MIRROR(1) | CLAMP(2)

    Code sample :

    CLAMP = 2
    HYP_Texture.SetAddressingMode(texId, CLAMP)


    HYP_Texture.SetAnisotropy

    Description
    Sets texture anisotropic filtering value.

    Languages: Lua - Python

    Parameters
  • texId [INTEGER]: texture identifier
  • anisotropy [REAL]: anisotropic filtering

    Code sample :

    HYP_Texture.SetAnisotropy(texId, 16.0)


    HYP_Texture.GetId

    Description
    Returns texture identifier from its name.

    Languages: Lua - Python

    Parameters
  • name [STRING]: texture name

    Return Values
  • texId [INTEGER]: texture identifier

    Code sample :

    texId = HYP_Texture.GetId(name)


    HYP_Texture.SetValueTex1DByteRgb

    Description
    Sets the RGB color of a specific pixel for a 1D texture.

    Languages: Lua - Python

    Parameters
  • 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.

    Code sample :

    HYP_Texture.SetValueTex1DByteRgb(texId, offset, r, g, b)


    HYP_Texture.GetValueTex1DByteRgb

    Description
    Gets the RGB color of a specific pixel for a 1D texture.

    Languages: Lua - Python

    Parameters
  • texId [INTEGER]: texture identifier
  • offset [INTEGER]: pixel's offset in texture pixmap array: offset = x where x belongs to [0 ; texWidth[

    Return Values
  • r, g, b [INTEGER]: pixel's color. Each channel is coded on a byte.

    Code sample :

    r, g, b = HYP_Texture.GetValueTex1DByteRgb(texId, offset)


    HYP_Texture.SetValueTex1DFloatRgba

    Description
    Sets the RGBA color of a specific pixel for a 1D texture.

    Languages: Lua - Python

    Parameters
  • 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.

    Code sample :

    HYP_Texture.SetValueTex1DFloatRgba(texId, offset, r, g, b, a)


    HYP_Texture.GetValueTex1DFloatRgba

    Description
    Gets the RGBA color of a specific pixel for a 1D texture.

    Languages: Lua - Python

    Parameters
  • texId [INTEGER]: texture identifier
  • offset [INTEGER]: pixel's offset in texture pixmap array: offset = x where x belongs to [0 ; texWidth[

    Return Values
  • r, g, b, a [REAL]: pixel's color. Each channel is coded on a float.

    Code sample :

    r, g, b, a = HYP_Texture.GetValueTex1DFloatRgba(texId, offset)


    HYP_Texture.SetValueTex2DByteRgb

    Description
    Sets the RGB color of a specific pixel for a 2D texture.

    Languages: Lua - Python

    Parameters
  • 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.

    Code sample :

    HYP_Texture.SetValueTex2DByteRgb(texId, offset, r, g, b)


    HYP_Texture.SetValueTex2DByteRgb

    Description
    Gets the RGB color of a specific pixel for a 2D texture.

    Languages: Lua - Python

    Parameters
  • 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[

    Return Values
  • r, g, b [REAL]: pixel's color. Each channel is coded on a byte.

    Code sample :

    r, g, b = HYP_Texture.GetValueTex2DByteRgb(texId, offset)


    HYP_Texture.SetValueTex2DFloatRgba

    Description
    Sets the RGBA color of a specific pixel for a 2D texture.

    Languages: Lua - Python

    Parameters
  • 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.

    Code sample :

    HYP_Texture.SetValueTex2DFloatRgba(texId, offset, r, g, b, a)


    HYP_Texture.GetValueTex2DFloatRgba

    Description
    Gets the RGBA color of a specific pixel for a 2D texture.

    Languages: Lua - Python

    Parameters
  • 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[

    Return Values
  • r, g, b, a [REAL]: pixel's color. Each channel is coded on a float.

    Code sample :

    r, g, b, a = HYP_Texture.GetValueTex2DFloatRgba(texId, offset)


    HYP_Texture.SetValueTex2DByteRgba

    Description
    Sets the RGBA color of a specific pixel for a 2D texture.

    Languages: Lua - Python

    Parameters
  • 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.

    Code sample :

    HYP_Texture.SetValueTex2DByteRgba(texId, offset, r, g, b, a)


    HYP_Texture.GetValueTex2DByteRgba

    Description
    Gets the RGBA color of a specific pixel for a 2D texture.

    Languages: Lua - Python

    Parameters
  • 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[

    Return Values
  • r, g, b, a [INTEGER]: pixel's color. Each channel is coded on a byte.

    Code sample :

    r, g, b, a = HYP_Texture.GetValueTex2DByteRgba(texId, offset)


    HYP_Texture.Bind

    Description
    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.

    Languages: Lua

    Parameters
  • texId [INTEGER]: texture identifier

    Code sample :

    HYP_Texture.Bind(texId)


    HYP_Texture.ApplyToRenderer

    Description
    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.

    Languages: Lua

    Parameters
  • texId [INTEGER]: texture identifier

    Code sample :

    HYP_Texture.ApplyToRenderer(texId)


    HYP_Texture.SetTransformMatrix

    Description
    Sets the texture transformation matrix.

    Languages: Lua

    Parameters
  • texId [INTEGER]: texture identifier
  • m0 to m15 [REAL]: Matrix data (16 values)

    HYP_Texture.GetAVINumFrames

    Description
    Gets the number of frames of an AVI texture file.

    Languages: Lua

    Parameters
  • texId [INTEGER]: texture identifier

    Return Values
  • n [INTEGER]: Number of frames

    Code sample :

    n = HYP_Texture.GetAVINumFrames(texId)


    HYP_Texture.GetAVIMpf

    Description
    Gets the number of milliseconds per frame (MPF) of an AVI texture file.

    Languages: Lua

    Parameters
  • texId [INTEGER]: texture identifier

    Return Values
  • mpf [INTEGER]: milliseconds per frame

    Code sample :

    mpf = HYP_Texture.GetAVIMpf(texId)


    HYP_Texture.GetAVICurrentTime

    Description
    Gets the current time of an AVI texture.

    Languages: Lua

    Parameters
  • texId [INTEGER]: texture identifier

    Return Values
  • time [INTEGER]: current time

    Code sample :

    time = HYP_Texture.GetAVICurrentTime(texId)


    HYP_Texture.GetAVICurrentTime

    Description
    Gets the current time of an AVI texture.

    Languages: Lua

    Parameters
  • texId [INTEGER]: texture identifier

    Return Values
  • time [INTEGER]: current time

    Code sample :

    time = HYP_Texture.GetAVICurrentTime(texId)


    HYP_Texture.SetAVICurrentFrame

    Description
    Sets the current frame of an AVI texture.

    Languages: Lua

    Parameters
  • texId [INTEGER]: texture identifier
  • frame [INTEGER]: current frame - Values = [0 ; GetAVINumFrames()-1]

    Code sample :

    time = HYP_Texture.SetAVICurrentFrame(texId, frame)


    HYP_Texture.GetAVICurrentFrame

    Description
    Gets the current frame of an AVI texture.

    Languages: Lua

    Parameters
  • texId [INTEGER]: texture identifier

    Return Values
  • frame [INTEGER]: current frame

    Code sample :

    frame = HYP_Texture.GetAVICurrentFrame(texId)


    HYP_Texture.PlayStopAVI

    Description
    Sets the current frame of an AVI texture.

    Languages: Lua

    Parameters
  • texId [INTEGER]: texture identifier
  • state [INTEGER]: plays (1) or stops (0) the AVI texture - Values = 0|1

    Code sample :

    HYP_Texture.PlayStopAVI(texId, 0)




  • Random Projects

    2D Shockwave Effect
    2D Shockwave Effect

    Pixelation PostFX
    Pixelation PostFX

    Thermal Vision PostFX
    Thermal Vision PostFX


    Random Code Samples

    3DS Format Loading
    3DS Format Loading

    Texture viewer
    Texture viewer

    3D Sound
    3D Sound



    (C)2009-2010 Geeks3D.com