Back to main page

Texture

int Texture_Load_InSB(void);

I have chosen to only allow 4 file extensions (*.dds, *.bmp, *.png and *.jpg) for images so that loading is fast but extensionless. Therefor, you can change the file format of an image without having to rewrite everything that is using it.

The string buffer must contain an extensionless filename with less than 256 characters of an image. The engine will look for YourFileName.dds, YourFileName.bmp, YourFileName.png and YourFileName.jpg.

The ID to the new or reused texture.

Loads the texture if it haven't been loaded yet and locks it from being deleted by the engine.

void Texture_Unlock(int Texture);

Unlocking is affecting the use of Engine_RemoveUnusedResources.

Texture is a valid and locked texture reference.

Unlocks the texture to tell the garbage collection that you aren't using it and the engine can delete it when nothing else is using it.

int Texture_GetWidth(int Texture);

Texture is a valid texture reference.

Returns the width of the texture or 0 if failed.

int Texture_GetHeight(int Texture);

Texture is a valid texture reference.

Returns the height of the texture or 0 if failed.

void Texture_GetFilename_OutSB(int Texture);

Texture is a valid texture reference.

Writes Texture's extensionless filename to the string buffer. If you for example loaded "MyImage.jpg", "MyImage" will be returned to the string buffer.

void Texture_UseAsDefaultTexture(int Texture);

The default texture is used instead of (0,0,0,0) when a shader is sampling a texture or draw surface that do not exist. It works with both material shaders and post effect shaders.

Texture is a valid and locked texture reference or 0 for using (0,0,0,0) again.

Texture is used as the default texture. Giving 0 will set the default texture to NULL so that shaders will get (0,0,0,0) from sampling nothing.

void Texture_UseAsLightProjectionAtlas(int Texture);

The light projection atlas is used together with UV rectangles instead of one texture per light source because the texture registers are limited in graphics cards and one instance can be drawn with all light sources at the same time.

Texture is a valid and locked texture reference or 0 for using the default texture again.

Texture is used as the light projection atlas that will be used by image projecting spot lights. Giving 0 will use the default texture again.