Classes | Modules | Functions

Wavepacket Glut Library Wrapper
[Wavepacket GLUT Libraries]


Mostly this library is here only as a convenient placeholder. More...

Collaboration diagram for Wavepacket Glut Library Wrapper:

Classes

class  glut::Viewer
struct  glut::fcolor_t
 base floating point color object More...
class  glut::Host
 If a client wants to use this library's glut helper entry point, it needs to supply an object that supports this interface. More...
class  glut::Task
 Create one of these (you'll have to inherit) if you have openGL work you need to submit to requestTask(). More...
class  glut::Material
 A Material is anything that needs to be set up prior to drawing, and possibly requiring some cleanup afterwards. More...

Modules

 Cameras and OpenGL
 

Basically, use GL_PROJECTION to set up the camera properties but NOT position or rotation.


 Wavepacket OpenGL Threading
 


Threading in OpenGL is non-trivial! Just do some internet searches for "OpenGL multithreading context" and you'll see what I mean.


 OpenGL Effects Library
 

Several useful OpenGL effects.


Functions

void glut::start (int argc,const char *argv[],int width,int height,const char *title,const char *gameModeString,smart_ptr< Host > &host)
 clients can call this to get common glut setup



typedef rect2d_t< int > glut::recti_t



void glut::getViewFrustum (const camera_t &camera,const Viewer &viewer,frustum_t &viewFrustum) throw ()
 This is a method to determine the view frustum given the current camera settings and viewer orientation.
void glut::drawFrustumEdges (const frustum_t &f,const glut_color_t &color) throw ()
 helper method to draw the edges of a frustum



void glut::push2D (int screenWidth,int screenHeight)
 switches to 2D drawing.
void glut::pop2D (void)
 restores 3D drawing (make sure to call this after calling push2D()!).
void glut::drawCursor (int x, int y)



int glut::createTextureFromImage (const media::image_t &image)

Detailed Description


Mostly this library is here only as a convenient placeholder.

Code with glut dependencies can refer to this module in the build, and then the right directories will be searched for include files, the right libraries linked, etc.

This library does provide a few helper objects and methods to make using glut easier, and to abstract away common setup code.


Typedef Documentation

typedef rect2d_t<int> glut::recti_t

Definition at line 50 of file renderable.h.


Function Documentation

void glut::getViewFrustum ( const camera_t &  camera,
const Viewer &  viewer,
frustum_t viewFrustum 
) throw ()

This is a method to determine the view frustum given the current camera settings and viewer orientation.

What is a frustum? It is a basic 3D solid. See http://en.wikipedia.org/wiki/Frustum In particular, this is a clipped 4-sided pyramid, also called a right square frustum. In 3D rendering, a frustum defines the area of space that can be seen from the current camera, given its position and orientation. This is called the view frustrum. Given other objects, we can quickly test if they are inside the view frustrum or not. If not, we can avoid rendering them altogether. This is called culling. If you have partitioned your object space (always a good idea), you can cull dozens or hundreds of objects with a single frustum/rectangle test.

For more links on view frustrum culling try:

Or for an up-to-date search: http://www.google.com/search?q=opengl+view+frustum+culling

Parameters:
viewFrustum view frustum
void glut::start ( int  argc,
const char *  argv[],
int  width,
int  height,
const char *  title,
const char *  gameModeString,
smart_ptr< Host > &  host 
)

clients can call this to get common glut setup

Parameters:
width window width, pixels
height window height, pixels
title window title
gameModeString optional
void glut::push2D ( int  screenWidth,
int  screenHeight 
)

switches to 2D drawing.

NOTE: for historical reasons, I don't follow the usual OpenGL coordinate conventions here. In 2D coordinates, positive Y down, not up. y=0 is the top of the screen. (OpenGL is flipped: positive Y is up). So be aware when 2D drawing.

int glut::createTextureFromImage ( const media::image_t image  ) 

creates a texture from the given image, and returns the new texture ID

void glut::drawFrustumEdges ( const frustum_t f,
const glut_color_t c 
) throw ()

helper method to draw the edges of a frustum

void glut::pop2D ( void   ) 

restores 3D drawing (make sure to call this after calling push2D()!).

void glut::drawCursor ( int  x,
int  y 
)