sphore 0.0.1
SPH openGL rendering engine

src/offscreen.h File Reference

Code for managing offscreen rendering. More...

#include <GL/gl.h>

Go to the source code of this file.

Typedefs

typedef struct _offscreen offscreen_t
 Public handel to the offsceen object.

Functions

offscreen_toffscreen_create (unsigned int width, unsigned int height)
 Creates an offscreen object with the sepcified dimensions.
void offscreen_destroy (offscreen_t *o)
 Cleans up the memory accosiated with an offscreen object.
unsigned int get_next_power_2 (unsigned int x)
 Returns a number that is the smallest power of two heigher that x.
GLuint offscreen_get_texture (offscreen_t *o)
 Gets the OpenGL identifier for the texture that has been drawn to.
GLint offscreen_get_texture_location (offscreen_t *o)
 Gets the location of the texture in the current glsl program.
void offscreen_set_texture_location (offscreen_t *o, GLint loc)
 Sets the location of the texture in the current glsl program.
void offscreen_load_texture (offscreen_t *o)
void offscreen_get_texture_size (offscreen_t *o, unsigned int *width, unsigned int *height)
void offscreen_start (offscreen_t *o)
 Begins drawing to the offscreen texture.
void offscreen_stop (offscreen_t *o)
 Ends drawing to the offscreen texture.

Detailed Description

Code for managing offscreen rendering.

Actual implimentation is either with fbo's (offscreen-fbo.c) or by copying the texture from the window system provided buffer.


Typedef Documentation

typedef struct _offscreen offscreen_t

Public handel to the offsceen object.


Function Documentation

unsigned int get_next_power_2 ( unsigned int  x)

Returns a number that is the smallest power of two heigher that x.

Parameters:
[in]xThe number that the return value must be equall to or higher than.
Returns:
The power of two that is equal to or higher than x.
offscreen_t* offscreen_create ( unsigned int  width,
unsigned int  height 
)

Creates an offscreen object with the sepcified dimensions.

Parameters:
[in]widthThe width of the offscreen object in pixels.
[in]heightThe height of the offscreen object in pixels.
Returns:
A pointer to the new offscreen object.
void offscreen_destroy ( offscreen_t o)

Cleans up the memory accosiated with an offscreen object.

Parameters:
[in]oThe object to be destroyed.
GLuint offscreen_get_texture ( offscreen_t o)

Gets the OpenGL identifier for the texture that has been drawn to.

Parameters:
[in]oThe object for which we want the texture.
Returns:
The OpenGL identifier for the offscreen texture that has been drawn to.
GLint offscreen_get_texture_location ( offscreen_t o)

Gets the location of the texture in the current glsl program.

Parameters:
[in]oThe offscreen object to query.
Returns:
The OpenGL identifier for the location.
void offscreen_get_texture_size ( offscreen_t o,
unsigned int *  width,
unsigned int *  height 
)

Returns the size of the offscreen object in pixels.

Parameters:
[in]oThe object to query.
[out]widthGets set to the width of the object in pixels.
[out]heightGets set to the height of the object in pixels.
void offscreen_load_texture ( offscreen_t o)
void offscreen_set_texture_location ( offscreen_t o,
GLint  loc 
)

Sets the location of the texture in the current glsl program.

Parameters:
[in]oThe offscreen object to modify.
[in]locThe new location identifier.
void offscreen_start ( offscreen_t o)

Begins drawing to the offscreen texture.

Parameters:
[in]oThe object to draw to.
void offscreen_stop ( offscreen_t o)

Ends drawing to the offscreen texture.

Parameters:
[in]oThe object to stop drawing to.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines