Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
Loading...
Searching...
No Matches
texture.h
Go to the documentation of this file.
1
6#ifndef TEXTURE_H
7#define TEXTURE_H
8
9#include "gl_common.h"
10#include <stdbool.h>
11
12enum { MAX_TEXTURE_DIMENSION = 8192 };
13
25void texture_ensure_pbo(GLuint* pbo_id, GLsizeiptr* current_size,
26 GLsizeiptr required_size);
27
35void* texture_map_pbo(GLuint pbo_id, size_t size_bytes);
36
49GLuint texture_preallocate_hdr(int width, int height, GLuint old_tex);
50
61GLuint texture_upload_hdr_from_pbo(GLuint pbo_id, void* ptr, int width,
62 int height, GLuint reuse_tex_id,
63 GLuint internal, GLuint fmt, GLuint type,
64 bool is_compressed, GLsizei pbo_size);
65
71void texture_generate_hdr_mipmap(GLuint tex);
72
83float* texture_load_pixels(const char* path, int* width, int* height,
84 int* channels);
85
92GLuint texture_load_rgba_png(const char* path);
93
94#endif /* TEXTURE_H */
Common OpenGL definitions, RAII helpers, and utilities.
void * texture_map_pbo(GLuint pbo_id, size_t size_bytes)
Maps a PBO for writing.
Definition texture.c:104
GLuint texture_upload_hdr_from_pbo(GLuint pbo_id, void *ptr, int width, int height, GLuint reuse_tex_id, GLuint internal, GLuint fmt, GLuint type, bool is_compressed, GLsizei pbo_size)
Finalizes HDR upload from a PBO (Unmap -> Upload -> Mipmaps).
Definition texture.c:257
float * texture_load_pixels(const char *path, int *width, int *height, int *channels)
Decodes an HDR image into RAM without uploading to GPU.
Definition texture.c:21
@ MAX_TEXTURE_DIMENSION
Definition texture.h:12
void texture_ensure_pbo(GLuint *pbo_id, GLsizeiptr *current_size, GLsizeiptr required_size)
Ensures a PBO is allocated with sufficient size.
Definition texture.c:76
GLuint texture_load_rgba_png(const char *path)
Loads a PNG image from disk and creates an OpenGL RGBA texture.
Definition texture.c:340
GLuint texture_preallocate_hdr(int width, int height, GLuint old_tex)
Pre-allocates VRAM for an HDR texture (glTexStorage2D only).
Definition texture.c:159
void texture_generate_hdr_mipmap(GLuint tex)
Generates mipmaps for an HDR texture.
Definition texture.c:329