28 GLenum internal_format,
29 GLenum type, GLenum format) {
34 glTexImage1D(GL_TEXTURE_1D, 0,
35 internal_format, res, 0, format, type,
nullptr);
36 glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
37 glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
38 glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
56 SDL_Surface *tmp = SDL_ConvertSurfaceFormat(image.
image,
57 SDL_PIXELFORMAT_RGBA8888, 0);
63 glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
64 glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
65 glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
66 glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA, image.
width, 0,
67 GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, tmp->pixels);
68 glGenerateMipmap(GL_TEXTURE_1D);
bool load(const sgltk::Image &image)
Load a new image as texture.
void bind(unsigned int texture_unit=0)
Bind the texture to be used by the shader.
void unbind(unsigned int texture_unit=0)
Unbind the texture.
void create_empty(unsigned int res, GLenum internal_format, GLenum type, GLenum format)
Creates an empty texture.
unsigned int width
The width of the texture.
unsigned int height
The height of the texture.