-
Notifications
You must be signed in to change notification settings - Fork 0
Textures
TechnologicalTurtle edited this page Jul 19, 2026
·
5 revisions
LibGui::Texture class is used to render images on objects, it can be initialized in two ways:
You can create texture from an LibGui::Image like this:
LibGui::Texture MyTexture(MyImage);
// if you want pixelart (or something pixelated), specify it with smoothed = false
LibGui::Texture MyTexture(MyImage, false);
// you can also set your custom texture slot (if you know what are you doing)
LibGui::Texture MyTexture(MyImage, false, 4);
// lastly you can decide between GL_CLAMP_TO_BORDER (true) and GL_REPEAT (default, false) too
LibGui::Texture MyTexture(MyImage, false, 4, true);You can directly load from file, without needing an LibGui::Image like this:
LibGui::Texture MyTexture("cool_turtle_image.png");
// if you want pixelart (or something pixelated), specify it with smoothed = false
LibGui::Texture MyTexture("cool_turtle_image.png", false);
// you can too set your custom texture slot (if you know what are you doing)
LibGui::Texture MyTexture("cool_turtle_image.png", false, 4);
// lastly you can decide between GL_CLAMP_TO_BORDER (true) and GL_REPEAT (default, false) too
LibGui::Texture MyTexture("cool_turtle_image.png", false, 4, true);Note
I don't talk about LoadFile and LoadImage, becouse theese are just backends for image and file constructors
Binds texture, you don't need it, except if you want to use OpenGL simultaniously with LibGui.
Unbinds texture, you don't need it, except if you want to use OpenGL simultaniously with LibGui.
Returns OpenGL texture ID.
Texture slot is index of unit, the texture is in. More about in texture units part in here
nrChannels tells you how much color channels had the file you loaded from.
| value | means |
|---|---|
| 1 | RED |
| 2 | RED-GREEN |
| 3 | RED-GREEN-BLUE |
| 4 | RED-GREEN-BLUE-ALPHA |
Size of texture in pixels.
Features