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

gliftUtil.cpp File Reference

#include <util/gliftUtil.h>
#include <texture/subTex.h>
#include <texture/texNd.h>
#include <drawable/planarQuad.h>
#include <drawable/shadedPrim.h>
#include <texCoordGen/winTexGen2D.h>
#include <string>
#include <vector>

Go to the source code of this file.

Functions

void drawPixels (const arrayw3ub &data, SingleTex *tex, GLenum drawBuffer)
 Draw pixels in 'data' into the texture, 'tex'.

void drawSubPixels (const vec2i &dataOrig, const vec2i &texOrig, const vec2i &dimen, const arrayw3ub &data, SingleTex *tex, GLenum drawBuffer)
 Draw a 2D tile of pixels from 'data' into 'tex' - 'dataOrig' and 'dimen' denote the data tile - 'texOrig' and 'dimen' denote where in the texture the data is written - Number of color channels is determined by 'data.dim(2)' - Data is sent to texture via render-to-texture or by glCopySubTexImage2D(...).

void drawPixels (const arrayw3f &data, SingleTex *tex)
 
  • Draw pixels in 'data' into the texture, 'tex' - Dimensions of pixel rectangle are 'data.dim(1)' x 'data.dim(0)' - Number of color channels is determined by 'data.dim(2)' - Draws to the currenly set surface UNLESS 'tex->pbuff()' is a SubPBuff.


void drawSingleTexQuad (SingleTex *tex, bool drawToPbuff)
 Draw a quad to the screen that is of size 'tex->dimen()' Will draw 'tex->pbuff()' if 'drawToPbuff' is true Assumes that render mode is in appropriate state ( glOrtho2D(...)? ).

void drawSingleTexQuad (SingleTex *tex, const vec2i &dimen, bool drawToPbuff)
void drawColoredTile (const vec2i &origin, const vec2i &dimen, const vec2i &fullQuadDim, const vec3f &color, SingleTex *tex)
 Draw a quad of 'color' to lowerLeft=origin, upperRight=origin + dimen to 'tex' or current context (if pbuff==NULL).


Variables

const GLenum g_texUnitName [NUM_TEX_UNIT_NAMES]
 The OpenGL texture unit names, indexable by texUnitNumber - glim.max_tex_units should be checked for number of texture units available on GPU.


Function Documentation

void drawColoredTile const gutz::vec2i origin,
const gutz::vec2i dimen,
const gutz::vec2i fullQuadDim,
const gutz::vec3f color,
SingleTex *  tex
 

Draw a quad of 'color' to lowerLeft=origin, upperRight=origin + dimen to 'tex' or current context (if pbuff==NULL).

Definition at line 307 of file gliftUtil.cpp.

References GL_VIEWPORT, glColor3f(), glGetIntegerv(), glViewport(), tex2D(), gutz::vec2f, gutz::vec2i, and gutz::vec4i.

void drawPixels const gutz::arrayw3f data,
SingleTex *  tex
 

  • Draw pixels in 'data' into the texture, 'tex' - Dimensions of pixel rectangle are 'data.dim(1)' x 'data.dim(0)' - Number of color channels is determined by 'data.dim(2)' - Draws to the currenly set surface UNLESS 'tex->pbuff()' is a SubPBuff.

If that is the case, the surface defined in the SubPBuff is used instead

WARNINGS: 1) Assumes an orthographic projection is already set up in the pbuffer context 2) Leaves pbuffer context enabled after drawing

Definition at line 194 of file gliftUtil.cpp.

References data, GL_DRAW_BUFFER, GL_FLOAT, GL_LUMINANCE, GL_RGB, GL_RGBA, glDrawBuffer(), glDrawPixels(), GLenum, glGetIntegerv(), glRasterPos2i(), size, and gutz::vec2i.

void drawPixels const gutz::arrayw3ub data,
SingleTex *  tex,
GLenum  drawBuffer = GL_FRONT_LEFT
 

Draw pixels in 'data' into the texture, 'tex'.

Dimensions of pixel rectangle are 'data.dim(0)' x 'data.dim(1)'

Definition at line 81 of file gliftUtil.cpp.

References data, drawSubPixels(), and gutz::vec2i.

void drawSingleTexQuad SingleTex *  tex,
const vec2i &  dimen,
bool  drawToPbuff
 

Definition at line 241 of file gliftUtil.cpp.

References GL_COLOR_BUFFER_BIT, GL_RGBA, glClear(), setColorMask(), and gutz::vec2f.

Referenced by glift::drawSingleTexQuad().

void drawSingleTexQuad SingleTex *  tex,
bool  drawToPbuff = false
 

Draw a quad to the screen that is of size 'tex->dimen()' Will draw 'tex->pbuff()' if 'drawToPbuff' is true Assumes that render mode is in appropriate state ( glOrtho2D(...)? ).

Definition at line 233 of file gliftUtil.cpp.

void drawSubPixels const gutz::vec2i dataOrig,
const gutz::vec2i texOrig,
const gutz::vec2i dimen,
const gutz::arrayw3ub data,
SingleTex *  tex,
GLenum  drawBuffer = GL_FRONT_LEFT
 

Draw a 2D tile of pixels from 'data' into 'tex' - 'dataOrig' and 'dimen' denote the data tile - 'texOrig' and 'dimen' denote where in the texture the data is written - Number of color channels is determined by 'data.dim(2)' - Data is sent to texture via render-to-texture or by glCopySubTexImage2D(...).

Definition at line 89 of file gliftUtil.cpp.

References data, GL_DRAW_BUFFER, GL_LUMINANCE, GL_RGB, GL_RGBA, GL_UNSIGNED_BYTE, glDrawBuffer(), glDrawPixels(), GLenum, glGetIntegerv(), glRasterPos2i(), setColorMask(), tex2D(), ubyte, uchar, gutz::vec2i, and gutz::vec3i.

Referenced by drawPixels().


Variable Documentation

const GLenum g_texUnitName[NUM_TEX_UNIT_NAMES]
 

The OpenGL texture unit names, indexable by texUnitNumber - glim.max_tex_units should be checked for number of texture units available on GPU.

Definition at line 41 of file gliftUtil.cpp.


Send questions, comments, and bug reports to:
jmk