Solar System OpenGL v1.0.0
Loading...
Searching...
No Matches
texture_loader.h File Reference

Provides texture loading functionality. More...

#include "stb_image.h"
#include <GL/glut.h>
#include <iostream>

Go to the source code of this file.

Macros

#define STB_IMAGE_IMPLEMENTATION
 Defines implementation of the STB image library.
 

Functions

GLuint loadTexture (const char *filename)
 Loads a texture from a file.
 

Detailed Description

Provides texture loading functionality.

This file declares functions and includes necessary libraries for loading textures using the STB image library and OpenGL.

Macro Definition Documentation

◆ STB_IMAGE_IMPLEMENTATION

#define STB_IMAGE_IMPLEMENTATION

Defines implementation of the STB image library.

This macro should be defined exactly once in the project to include the implementation of the STB image functions.

Function Documentation

◆ loadTexture()

GLuint loadTexture ( const char * filename)

Loads a texture from a file.

Parameters
filenamePath to the texture file.
Returns
The OpenGL texture ID.

This function loads an image from the specified file and generates an OpenGL texture object.

Loads a texture from a file.

Parameters
filenamePath to the texture file.
Returns
The OpenGL texture ID.

This function uses the STB image library to load an image from the specified file, creates an OpenGL texture object, and sets its parameters. If the image fails to load, an error message is printed to std::cerr.