Open source remastering of the Freespace 2 engine
gropengltexture.cpp File Reference

Go to the source code of this file.


struct  fbo_t




int opengl_free_texture (tcache_slot_opengl *t)
void opengl_free_texture_with_handle (int handle)
void opengl_tcache_get_adjusted_texture_size (int w_in, int h_in, int *w_out, int *h_out)
int opengl_create_texture_sub (int bitmap_handle, int bitmap_type, int bmap_w, int bmap_h, int tex_w, int tex_h, ubyte *data=NULL, tcache_slot_opengl *t=NULL, int base_level=0, int resize=0, int reload=0)
int opengl_create_texture (int bitmap_handle, int bitmap_type, tcache_slot_opengl *tslot=NULL)
void opengl_set_additive_tex_env ()
void opengl_set_modulate_tex_env ()
GLfloat opengl_get_max_anisotropy ()
void opengl_set_texture_target (GLenum target)
void opengl_tcache_init ()
void opengl_tcache_flush ()
void opengl_kill_all_render_targets ()
void opengl_tcache_shutdown ()
void opengl_tcache_frame ()
void opengl_free_texture_slot (int n)
bool opengl_texture_slot_valid (int n, int handle)
int gr_opengl_tcache_set_internal (int bitmap_handle, int bitmap_type, float *u_scale, float *v_scale, int tex_unit=0)
int gr_opengl_tcache_set (int bitmap_handle, int bitmap_type, float *u_scale, float *v_scale, int stage)
void opengl_preload_init ()
int gr_opengl_preload (int bitmap_num, int is_aabitmap)
void gr_opengl_set_texture_panning (float u, float v, bool enable)
void gr_opengl_set_texture_addressing (int mode)
void gr_opengl_get_bitmap_from_texture (void *data_out, int bitmap_num)
int opengl_get_texture (GLenum target, GLenum pixel_format, GLenum data_format, int num_mipmaps, int width, int height, int bytes_per_pixel, void *image_data, int offset)
size_t opengl_export_render_target (int slot, int width, int height, int alpha, int num_mipmaps, ubyte *image_data)
void gr_opengl_update_texture (int bitmap_handle, int bpp, const ubyte *data, int width, int height)
int opengl_check_framebuffer ()
void opengl_kill_render_target (int slot)
int opengl_set_render_target (int slot, int face, int is_static)
int opengl_make_render_target (int handle, int slot, int *w, int *h, ubyte *bpp, int *mm_lvl, int flags)
GLuint opengl_get_rtt_framebuffer ()
 Gets the current RTT framebuffer. More...


int GL_texture_ram = 0
int GL_min_texture_width = 0
GLint GL_max_texture_width = 0
int GL_min_texture_height = 0
GLint GL_max_texture_height = 0
int GL_textures_in = 0
int GL_textures_in_frame = 0
int GL_last_detail = -1
GLint GL_supported_texture_units = 2
int GL_should_preload = 0
ubyte GL_xlat [256]
GLfloat GL_anisotropy = 1.0f
GLfloat GL_max_anisotropy = -1.0f
int GL_mipmap_filter = 0
GLenum GL_texture_target = GL_TEXTURE_2D
GLenum GL_texture_face = GL_TEXTURE_2D
GLenum GL_texture_addressing = GL_REPEAT
bool GL_rendering_to_texture = false
GLint GL_max_renderbuffer_size = 0
 References a map that is a fully lit version of its index -Bobboau. More...
 References a map that is for specular mapping -Bobboau. More...
 References a map that is for environment mapping -Bobboau. More...
int Interp_multitex_cloakmap
bool GL_initted

Macro Definition Documentation


Definition at line 1031 of file gropengltexture.cpp.

Function Documentation

void gr_opengl_get_bitmap_from_texture ( void data_out,
int  bitmap_num 

Definition at line 1201 of file gropengltexture.cpp.

int gr_opengl_preload ( int  bitmap_num,
int  is_aabitmap 

Definition at line 1122 of file gropengltexture.cpp.

void gr_opengl_set_texture_addressing ( int  mode)

Definition at line 1170 of file gropengltexture.cpp.

void gr_opengl_set_texture_panning ( float  u,
float  v,
bool  enable 

Definition at line 1145 of file gropengltexture.cpp.

int gr_opengl_tcache_set ( int  bitmap_handle,
int  bitmap_type,
float u_scale,
float v_scale,
int  stage 

Definition at line 1088 of file gropengltexture.cpp.

int gr_opengl_tcache_set_internal ( int  bitmap_handle,
int  bitmap_type,
float u_scale,
float v_scale,
int  tex_unit = 0 

Definition at line 1033 of file gropengltexture.cpp.

void gr_opengl_update_texture ( int  bitmap_handle,
int  bpp,
const ubyte data,
int  width,
int  height 

Definition at line 1322 of file gropengltexture.cpp.

int opengl_check_framebuffer ( )

Definition at line 1412 of file gropengltexture.cpp.

int opengl_create_texture ( int  bitmap_handle,
int  bitmap_type,
tcache_slot_opengl tslot = NULL 

Definition at line 860 of file gropengltexture.cpp.

int opengl_create_texture_sub ( int  bitmap_handle,
int  bitmap_type,
int  bmap_w,
int  bmap_h,
int  tex_w,
int  tex_h,
ubyte data = NULL,
tcache_slot_opengl t = NULL,
int  base_level = 0,
int  resize = 0,
int  reload = 0 

Definition at line 366 of file gropengltexture.cpp.

size_t opengl_export_render_target ( int  slot,
int  width,
int  height,
int  alpha,
int  num_mipmaps,
ubyte image_data 

Sends a texture object out to "image_data"

Image_data should be memory which is already allocated. Function should only be used for uncompressed 24-bit or 32-bit (distiguished by "alpha" var) images

0 on failure
size of data on success

Definition at line 1256 of file gropengltexture.cpp.

int opengl_free_texture ( tcache_slot_opengl t)

Definition at line 296 of file gropengltexture.cpp.

void opengl_free_texture_slot ( int  n)

Definition at line 263 of file gropengltexture.cpp.

void opengl_free_texture_with_handle ( int  handle)

Definition at line 207 of file gropengltexture.cpp.

GLfloat opengl_get_max_anisotropy ( )

Definition at line 90 of file gropengltexture.cpp.

GLuint opengl_get_rtt_framebuffer ( )

Gets the current RTT framebuffer.

Gets the OpenGL framebuffer ID of the currently in use RTT framebuffer. If there is currently none such framebuffer in use then this function returns 0 so it can be used in any place where the framebuffer should be reset to the default drawing surface.

The current RTT FBO ID or 0 when not doing RTT.

Definition at line 1869 of file gropengltexture.cpp.

int opengl_get_texture ( GLenum  target,
GLenum  pixel_format,
GLenum  data_format,
int  num_mipmaps,
int  width,
int  height,
int  bytes_per_pixel,
void image_data,
int  offset 

Definition at line 1222 of file gropengltexture.cpp.

void opengl_kill_all_render_targets ( )

Definition at line 1523 of file gropengltexture.cpp.

void opengl_kill_render_target ( int  slot)

Definition at line 1476 of file gropengltexture.cpp.

int opengl_make_render_target ( int  handle,
int  slot,
int w,
int h,
ubyte bpp,
int mm_lvl,
int  flags 

Definition at line 1628 of file gropengltexture.cpp.

void opengl_preload_init ( )

Definition at line 1114 of file gropengltexture.cpp.

void opengl_set_additive_tex_env ( )

Definition at line 62 of file gropengltexture.cpp.

void opengl_set_modulate_tex_env ( )

Definition at line 76 of file gropengltexture.cpp.

int opengl_set_render_target ( int  slot,
int  face,
int  is_static 

Definition at line 1542 of file gropengltexture.cpp.

void opengl_set_texture_target ( GLenum  target)

Definition at line 106 of file gropengltexture.cpp.

void opengl_tcache_flush ( )

Definition at line 215 of file gropengltexture.cpp.

void opengl_tcache_frame ( )

Definition at line 253 of file gropengltexture.cpp.

void opengl_tcache_get_adjusted_texture_size ( int  w_in,
int  h_in,
int w_out,
int h_out 

Definition at line 318 of file gropengltexture.cpp.

void opengl_tcache_init ( )

Definition at line 111 of file gropengltexture.cpp.

void opengl_tcache_shutdown ( )

Definition at line 233 of file gropengltexture.cpp.

bool opengl_texture_slot_valid ( int  n,
int  handle 

Determine if a bitmap is in API memory, so that we can just reuse it rather that having to load it from disk again

Definition at line 277 of file gropengltexture.cpp.

Variable Documentation


Called in game_shutdown() to free malloced memory

NOTE: do not call this function. It is only called from game_shutdown()

Definition at line 14145 of file ship.cpp.


References a map that is for environment mapping -Bobboau.

Definition at line 59 of file bmpman.cpp.

GLfloat GL_anisotropy = 1.0f

Definition at line 39 of file gropengltexture.cpp.

bool GL_initted

Definition at line 60 of file gropengl.cpp.

int GL_last_detail = -1

Definition at line 35 of file gropengltexture.cpp.

GLfloat GL_max_anisotropy = -1.0f

Definition at line 40 of file gropengltexture.cpp.

GLint GL_max_renderbuffer_size = 0

Definition at line 46 of file gropengltexture.cpp.

GLint GL_max_texture_height = 0

Definition at line 32 of file gropengltexture.cpp.

GLint GL_max_texture_width = 0

Definition at line 30 of file gropengltexture.cpp.

int GL_min_texture_height = 0

Definition at line 31 of file gropengltexture.cpp.

int GL_min_texture_width = 0

Definition at line 29 of file gropengltexture.cpp.

int GL_mipmap_filter = 0

Definition at line 41 of file gropengltexture.cpp.

bool GL_rendering_to_texture = false

Definition at line 45 of file gropengltexture.cpp.

int GL_should_preload = 0

Definition at line 37 of file gropengltexture.cpp.

GLint GL_supported_texture_units = 2

Definition at line 36 of file gropengltexture.cpp.

GLenum GL_texture_addressing = GL_REPEAT

Definition at line 44 of file gropengltexture.cpp.

GLenum GL_texture_face = GL_TEXTURE_2D

Definition at line 43 of file gropengltexture.cpp.

int GL_texture_ram = 0

Definition at line 28 of file gropengltexture.cpp.

GLenum GL_texture_target = GL_TEXTURE_2D

Definition at line 42 of file gropengltexture.cpp.

int GL_textures_in = 0

Definition at line 33 of file gropengltexture.cpp.

int GL_textures_in_frame = 0

Definition at line 34 of file gropengltexture.cpp.

ubyte GL_xlat[256]

Definition at line 38 of file gropengltexture.cpp.


References a map that is a fully lit version of its index -Bobboau.

Definition at line 57 of file bmpman.cpp.

int Interp_multitex_cloakmap

Definition at line 209 of file modelinterp.cpp.


References a map that is for specular mapping -Bobboau.

Definition at line 58 of file bmpman.cpp.