Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

gl::pixel_buffer Class Reference

A off screen pixel buffer. More...

#include <pbuffer.h>

Collaboration diagram for gl::pixel_buffer:

Collaboration graph
[legend]
List of all members.

Public Methods

 pixel_buffer (void)
 Default Constructor.

virtual ~pixel_buffer (void)
 Destructor.

virtual bool init (unsigned int w, unsigned int h, unsigned int bpp, GLXContext shared)
 Initializes the pixel buffer. More...

virtual bool init (unsigned int w, unsigned int h, unsigned int bpp, const int attributes[], GLXContext shared)
 Initialize the pixel buffer. More...

virtual void activate (void)
 Activates the GL context for the pixel buffer.

virtual void shutdown (void)
 Destroys the pixel buffer. More...

unsigned int get_width (void) const
 Returns the width of the pixel buffer.

unsigned int get_height (void) const
 Returns the height of the pixel buffer.

bool error (void) const
 Returns true if an error has occurred.

std::string get_error (void)
 Returns the error message.

gl::texture get_texture (void) const
 Returns a gl::texture object to the pbuffer.


Protected Methods

void clear_error (void)
 Clears the internal error state.

void set_error (const std::string &msg)
 Sets the internal error state.


Protected Attributes

unsigned int m_width
 Pixel buffer width.

unsigned int m_height
 Pixel buffer height.

unsigned int m_bpp
 Bits per pixel.

bool m_initialized
 Flag indicating the pixel buffer has been initialized.

bool m_error
 If an error has occured.

std::string m_error_msg
 Error message.

gl::texture m_texture
 Texture object for the pbuffer.


Detailed Description

A off screen pixel buffer.

This class handles pixel buffer creation. The programmer will still need to activate the GL context of the pixel buffer in order to draw in it.

Definition at line 21 of file pbuffer.h.


Member Function Documentation

bool gl::pixel_buffer::init unsigned int    w,
unsigned int    h,
unsigned int    bpp,
const int    attributes[],
GLXContext    shared
[virtual]
 

Initialize the pixel buffer.

Creates a pixel buffer w pixels wide by h pixels in height, using a set of framebuffer attributes passed as attributes.

Parameters:
w  Width of pixel buffer.
h  Height of pixel buffer.
bpp  Bits per pixel of the buffer (the framebuffer attributes may override this, but it should still be passed as a hint at least).
attributes  Desired framebuffer configuration attributes.
shared  A list of GL contexts that will share texture memory and display lists with the pixel buffer.
Returns:
true if the pixel buffer was successfully initialized.

Definition at line 132 of file pbuffer.cpp.

References m_bpp, m_height, m_initialized, m_texture, m_width, gl::texture::set, and set_error.

bool gl::pixel_buffer::init unsigned int    w,
unsigned int    h,
unsigned int    bpp,
GLXContext    shared
[virtual]
 

Initializes the pixel buffer.

Creates a pixel buffer w pixels wide by h pixels in height.

Parameters:
w  Width of pixel buffer.
h  Height of pixel buffer.
bpp  Bits per pixel of the buffer (generally, 16, 24, or 32).
shared  A list of GL contexts that will share texture memory and display lists with the pixel buffer.
Returns:
true if the pixel buffer was successfully initialized.

Definition at line 60 of file pbuffer.cpp.

References m_bpp, m_height, m_initialized, m_texture, m_width, gl::texture::set, and set_error.

void gl::pixel_buffer::shutdown void    [virtual]
 

Destroys the pixel buffer.

This method should be called to release the pixel buffer when it is no longer needed.

Definition at line 208 of file pbuffer.cpp.

References m_initialized.


Generated on Tue Feb 11 18:49:48 2003 for uber by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002