C# Class TexLib.TexUtil

The TexUtil class is released under the MIT-license. /Olof Bjarnason
Afficher le fichier Open project: LukaHorvat/Kento

Méthodes publiques

Méthode Description
CreateRGBATexture ( int width, int height, byte rgba ) : int

Create a translucent OpenGL texture object from given byte-array of r,g,b,a-triplets. See CreateRGBTexture for more info.

CreateRGBTexture ( int width, int height, byte rgb ) : int

Create an opaque OpenGL texture object from a given byte-array of r,g,b-triplets. Make sure width and height is 1, 2, .., 32, 64, 128, 256 and so on in size since all 3d graphics cards support those dimensions. Not necessarily square. Don't forget to call GL.DeleteTexture(int) when you don't need the texture anymore (eg. when switching levels in your game).

CreateTextureFromBitmap ( Bitmap bitmap ) : int

Create an OpenGL texture (translucent or opaque) from a given Bitmap. 24- and 32-bit bitmaps supported.

CreateTextureFromFile ( string path ) : int

Create an OpenGL texture (translucent or opaque) by loading a bitmap from file. 24- and 32-bit bitmaps supported.

InitTexturing ( ) : void

Initialize OpenGL state to enable alpha-blended texturing. Disable again with GL.Disable(EnableCap.Texture2D). Call this before drawing any texture, when you boot your application, eg. in OnLoad() of GameWindow or Form_Load() if you're building a WinForm app.

Private Methods

Méthode Description
CreateTexture ( int width, int height, bool alpha, byte bytes ) : int
GiveMeATexture ( ) : int
SetParameters ( ) : void
Upload ( int width, int height, bool alpha, byte bytes ) : void

Method Details

CreateRGBATexture() public static méthode

Create a translucent OpenGL texture object from given byte-array of r,g,b,a-triplets. See CreateRGBTexture for more info.
public static CreateRGBATexture ( int width, int height, byte rgba ) : int
width int
height int
rgba byte
Résultat int

CreateRGBTexture() public static méthode

Create an opaque OpenGL texture object from a given byte-array of r,g,b-triplets. Make sure width and height is 1, 2, .., 32, 64, 128, 256 and so on in size since all 3d graphics cards support those dimensions. Not necessarily square. Don't forget to call GL.DeleteTexture(int) when you don't need the texture anymore (eg. when switching levels in your game).
public static CreateRGBTexture ( int width, int height, byte rgb ) : int
width int
height int
rgb byte
Résultat int

CreateTextureFromBitmap() public static méthode

Create an OpenGL texture (translucent or opaque) from a given Bitmap. 24- and 32-bit bitmaps supported.
public static CreateTextureFromBitmap ( Bitmap bitmap ) : int
bitmap System.Drawing.Bitmap
Résultat int

CreateTextureFromFile() public static méthode

Create an OpenGL texture (translucent or opaque) by loading a bitmap from file. 24- and 32-bit bitmaps supported.
public static CreateTextureFromFile ( string path ) : int
path string
Résultat int

InitTexturing() public static méthode

Initialize OpenGL state to enable alpha-blended texturing. Disable again with GL.Disable(EnableCap.Texture2D). Call this before drawing any texture, when you boot your application, eg. in OnLoad() of GameWindow or Form_Load() if you're building a WinForm app.
public static InitTexturing ( ) : void
Résultat void