Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals

pge::renderer Namespace Reference


Functions

void glInit ()
void glShutdown ()
GLenum getError (bool printError)
bool isAnyError ()
void enter3DMode (float fovAngle, float aspect, float near, float far)
void enter3DMode ()
void enter2DMode (float left, float right, float bottom, float top, float near, float far)
void normal3f (Vector3f normal)
void vertex3f (float x, float y, float z)
void vertex3f (float x, float y, float z, float u, float v)
void vertex3f (Vector3f vertex)
void vertex3f (Vector3f vertex, Vector2f texCoord)
void vertex3f (Vector3f vertex, float texCoordU, float texCoordV)
void vertex3f (Vector3f vertex, Vector2f texCoord0, Vector2f texCoord1)
void vertex3f (Vector3f vertex, float texCoordU0, float texCoordV0, float texCoordU1, float texCoordV1)
void vertex3f (Vector3f vertex, float texCoord[])
void vertex3f (Vector3f vertex, Vector2f texCoord, int textureUnit)
void vertex3f (Vector3f v, float texCoordU, float texCoordV, int textureUnit)
void vertex2i (int x, int y)
void vertex2i (Vector2i v)
void vertex2i (Vector2i vertex, float u, float v)
void vertex2i (Vector2i vertex, float texCoord[])
void renderLine (Vector3f start, Vector3f end)
void renderLine (float startX, float startY, float startZ, float endX, float endY, float endZ)
void renderQuad (Vector3f q0, Vector3f q1, Vector3f q2, Vector3f q3)
void setClearColor (Vector3f color)
void color3f (float r, float g, float b)
void color3f (Vector3f color)
void color4f (Vector4f color)
void color4f (float r, float g, float b, float a)
void translate (Vector3f t)
void translate (float tx, float ty, float tz)
void rotate (float angle, Vector3f axis)
void rotate (float angle, float x, float y, float z)
void pushMatrix ()
void popMatrix ()
void setDepthTestEnabled (bool enabled)
void setBlendingEnabled (bool enabled)
void setBlendFunc (int src, int dest)
void setAlphaTestEnabled (bool enabled)
void setAlphaFunc (unsigned int func, float ref)
void setTextureAlphaBlendEnabled (bool enabled)
void setTexture (Texture *texture, GLint envMode)
void setTexture (Texture *texture)
void setTextureUnitEnabled (unsigned unit, bool enabled)
unsigned int createDisplayList (void)
void endDisplayList (void)
void executeDisplayList (unsigned int displayListId)
void deleteDisplayList (unsigned int displayListId)
void wireSphere (double radius, int slices, int stacks)
void wireSphere (Vector3f position, double radius, int slices, int stacks)
void wireSphere (Vector4f position, double radius, int slices, int stacks)
void texturedSphere (double radius, int slices, int stacks)

Variables

GLUquadric * g_quadric
float g_nearPlane = 0.1f
float g_farPlane = 1500.0f
float g_fovAngle = 45.0f


Function Documentation

void color3f Vector3f  color  )  [inline, static]
 

Definition at line 349 of file Renderer.h.

References pge::Vector3f::m_v.

00349                                                            {
00350                         glColor3fv(color.m_v);
00351                 }

void color3f float  r,
float  g,
float  b
[inline, static]
 

Definition at line 341 of file Renderer.h.

00341                                                                       {
00342                         glColor3f(r, g, b);
00343                 }

void color4f float  r,
float  g,
float  b,
float  a
[inline, static]
 

Definition at line 365 of file Renderer.h.

00365                                                                                {
00366                         glColor4f(r, g, b, a);
00367                 }

void color4f Vector4f  color  )  [inline, static]
 

Definition at line 357 of file Renderer.h.

References pge::Vector4f::m_v.

00357                                                            {
00358                         glColor4fv(color.m_v);
00359                 }

unsigned int createDisplayList void   )  [inline, static]
 

Definition at line 532 of file Renderer.h.

00532                                                                    {
00533                         GLuint displayListID = 0;
00534 
00535                         // Create place for one list.
00536                         displayListID = glGenLists(1);
00537 
00538                         // Create new display list.
00539                         glNewList(displayListID, GL_COMPILE);
00540                         return displayListID;
00541                 }

void deleteDisplayList unsigned int  displayListId  )  [inline, static]
 

Definition at line 563 of file Renderer.h.

00563                                                                                  {
00564                         glDeleteLists(displayListId, 1);
00565                 }

void endDisplayList void   )  [inline, static]
 

Definition at line 547 of file Renderer.h.

00547                                                         {
00548                         glEndList();
00549                 }

void enter2DMode float  left,
float  right,
float  bottom,
float  top,
float  near,
float  far
[inline, static]
 

Definition at line 143 of file Renderer.h.

00143                                                                                                                         {
00144                         glMatrixMode(GL_PROJECTION);
00145                         glLoadIdentity();
00146                         glOrtho(left, right, bottom, top, near, far);
00147                         glMatrixMode(GL_MODELVIEW);
00148                         glLoadIdentity();
00149                 }

void enter3DMode  )  [inline, static]
 

Definition at line 128 of file Renderer.h.

References g_farPlane, g_fovAngle, and g_nearPlane.

00128                                                  {
00129                         float aspect = (float)CoreEngine::getInstance()->getResolutionWidth() / (float)CoreEngine::getInstance()->getResolutionHeight();
00130 
00131                         //glViewport(0, 0, CoreEngine::getInstance()->getResolutionWidth(), CoreEngine::getInstance()->getResolutionHeight());
00132                         glMatrixMode(GL_PROJECTION);
00133                         glLoadIdentity();
00134                         gluPerspective(g_fovAngle, aspect, g_nearPlane, g_farPlane);
00135                         glMatrixMode(GL_MODELVIEW);
00136                         glLoadIdentity();
00137                 }

void enter3DMode float  fovAngle,
float  aspect,
float  near,
float  far
[inline, static]
 

Definition at line 112 of file Renderer.h.

References g_farPlane, g_fovAngle, and g_nearPlane.

00112                                                                                                     {
00113                         g_nearPlane = near;
00114                         g_farPlane = far;
00115                         g_fovAngle = fovAngle;
00116 
00117                         glMatrixMode(GL_PROJECTION);
00118                         glLoadIdentity();
00119                         gluPerspective(fovAngle, aspect, near, far);
00120                         glMatrixMode(GL_MODELVIEW);
00121                         glLoadIdentity();
00122                 }

void executeDisplayList unsigned int  displayListId  )  [inline, static]
 

Definition at line 555 of file Renderer.h.

00555                                                                                   {
00556                         glCallList(displayListId);
00557                 }

GLenum getError bool  printError  )  [inline, static]
 

Definition at line 54 of file Renderer.h.

00054                                                                {
00055                         GLenum errorCode = 0;
00056 
00057                         errorCode = glGetError();
00058                         if (printError) {
00059                                 switch (errorCode) {
00060                         case GL_NO_ERROR:
00061                                 printf("There was no error.");
00062                                 break;
00063                         case GL_INVALID_ENUM:
00064                                 printf("Error: enum argument out of range.");
00065                                 break;
00066                         case GL_INVALID_VALUE:
00067                                 printf("Error: numeric argument out of range.");
00068                                 break;
00069                         case GL_INVALID_OPERATION:
00070                                 printf("Error: operation illegal in current state.");
00071                                 break;
00072                         case GL_STACK_OVERFLOW:
00073                                 printf("Error: command would cause a stack overflow.");
00074                                 break;
00075                         case GL_STACK_UNDERFLOW:
00076                                 printf("Error: command would cause a stack underflow.");
00077                                 break;
00078                         case GL_OUT_OF_MEMORY:
00079                                 printf("Error: not enough memory left to execute command.");
00080                                 break;
00081                         case GL_TABLE_TOO_LARGE:
00082                                 printf("Error: the specified table is too large.");
00083                                 break;
00084                         default:
00085                                 break;
00086                                 }
00087                         }
00088                         return errorCode;
00089                 }

void glInit  )  [inline, static]
 

Definition at line 33 of file Renderer.h.

References g_quadric.

00033                                             {
00034                         glewInit();
00035                         g_quadric = gluNewQuadric();
00036                 }

void glShutdown  )  [inline, static]
 

Definition at line 42 of file Renderer.h.

References g_quadric.

00042                                                 {
00043                         if(g_quadric) {
00044                                 gluDeleteQuadric(g_quadric);
00045                         }
00046                 }

bool isAnyError  )  [inline, static]
 

Definition at line 97 of file Renderer.h.

00097                                                 {
00098                         if (glGetError() == GL_NO_ERROR) {
00099                                 return false;
00100                         } else {
00101                                 return true;
00102                         }
00103                 }

void normal3f Vector3f  normal  )  [inline, static]
 

Definition at line 158 of file Renderer.h.

References pge::Vector3f::m_v.

00158                                                              {
00159                         glNormal3fv(normal.m_v);
00160                 }

void popMatrix  )  [inline, static]
 

Definition at line 416 of file Renderer.h.

00416                                                {
00417                         glPopMatrix();
00418                 }

void pushMatrix  )  [inline, static]
 

Definition at line 408 of file Renderer.h.

00408                                                 {
00409                         glPushMatrix();
00410                 }

void renderLine float  startX,
float  startY,
float  startZ,
float  endX,
float  endY,
float  endZ
[inline, static]
 

Definition at line 303 of file Renderer.h.

00303                                                                                                                             {
00304                         glBegin(GL_LINES);
00305                         glVertex3f(startX, startY, startZ);
00306                         glVertex3f(endX, endY, endZ);
00307                         glEnd();
00308                 }

void renderLine Vector3f  start,
Vector3f  end
[inline, static]
 

Definition at line 292 of file Renderer.h.

References pge::Vector3f::m_v.

00292                                                                             {
00293                         glBegin(GL_LINES);
00294                         glVertex3fv(start.m_v);
00295                         glVertex3fv(end.m_v);
00296                         glEnd();
00297                 }

void renderQuad Vector3f  q0,
Vector3f  q1,
Vector3f  q2,
Vector3f  q3
[inline, static]
 

Definition at line 314 of file Renderer.h.

References pge::Vector3f::m_v.

00314                                                                                                   {
00315                         glBegin(GL_QUADS);
00316                                 glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0.0f);
00317                                 glVertex3fv(q0.m_v);
00318 
00319                                 glMultiTexCoord2f(GL_TEXTURE0, 1.0f, 0.0f);
00320                                 glVertex3fv(q1.m_v);
00321 
00322                                 glMultiTexCoord2f(GL_TEXTURE0, 1.0f, 1.0f);
00323                                 glVertex3fv(q2.m_v);
00324 
00325                                 glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 1.0f);
00326                                 glVertex3fv(q3.m_v);
00327                         glEnd();
00328                 }

void rotate float  angle,
float  x,
float  y,
float  z
[inline, static]
 

Definition at line 400 of file Renderer.h.

00400                                                                                   {
00401                         glRotatef(angle, x, y, z);
00402                 }

void rotate float  angle,
Vector3f  axis
[inline, static]
 

Definition at line 392 of file Renderer.h.

References pge::Vector3f::m_v.

00392                                                                       {
00393                         glRotatef(angle, axis.m_v[0], axis.m_v[1], axis.m_v[2]);
00394                 }

void setAlphaFunc unsigned int  func,
float  ref
[inline, static]
 

Definition at line 470 of file Renderer.h.

00470                                                                               {
00471                         glAlphaFunc(func, ref);
00472                 }

void setAlphaTestEnabled bool  enabled  )  [inline, static]
 

Definition at line 458 of file Renderer.h.

00458                                                                      {
00459                         if (enabled) {
00460                                 glEnable(GL_ALPHA_TEST);
00461                         } else {
00462                                 glDisable(GL_ALPHA_TEST);
00463                         }
00464                 }

void setBlendFunc int  src,
int  dest
[inline, static]
 

Definition at line 450 of file Renderer.h.

00450                                                                    {
00451                         glBlendFunc(src, dest);
00452                 }

void setBlendingEnabled bool  enabled  )  [inline, static]
 

Definition at line 438 of file Renderer.h.

00438                                                                     {
00439                         if (enabled) {
00440                                 glEnable(GL_BLEND);
00441                         } else {
00442                                 glDisable(GL_BLEND);
00443                         }
00444                 }

void setClearColor Vector3f  color  )  [inline, static]
 

Definition at line 333 of file Renderer.h.

References pge::Vector3f::m_v.

00333                                                                  {
00334                         glClearColor(color.m_v[0], color.m_v[1], color.m_v[2], 1.0f);
00335                 }

void setDepthTestEnabled bool  enabled  )  [inline, static]
 

Definition at line 426 of file Renderer.h.

00426                                                                      {
00427                         if (enabled) {
00428                                 glEnable(GL_DEPTH_TEST);
00429                         } else {
00430                                 glDisable(GL_DEPTH_TEST);
00431                         }
00432                 }

void setTexture Texture *  texture  )  [inline, static]
 

Definition at line 507 of file Renderer.h.

References pge::Texture::getDescriptor().

00507                                                                 {
00508                         glEnable(GL_TEXTURE_2D);
00509                         glBindTexture(GL_TEXTURE_2D, texture->getDescriptor());
00510                 }

Here is the call graph for this function:

void setTexture Texture *  texture,
GLint  envMode
[inline, static]
 

Definition at line 497 of file Renderer.h.

References pge::Texture::getDescriptor().

00497                                                                                {
00498                         glEnable(GL_TEXTURE_2D);
00499                         glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, envMode);
00500                         glBindTexture(GL_TEXTURE_2D, texture->getDescriptor());
00501                 }

Here is the call graph for this function:

void setTextureAlphaBlendEnabled bool  enabled  )  [inline, static]
 

Definition at line 478 of file Renderer.h.

00478                                                                              {
00479                         if (enabled) {
00480                                 glEnable(GL_BLEND);
00481                                 glEnable(GL_ALPHA_TEST);
00482                                 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00483                                 glAlphaFunc(GL_GREATER, 0);
00484                         } else {
00485                                 glDisable(GL_BLEND);
00486                                 glDisable(GL_ALPHA_TEST);
00487                         }
00488                 }

void setTextureUnitEnabled unsigned  unit,
bool  enabled
[inline, static]
 

Definition at line 516 of file Renderer.h.

00516                                                                                       {
00517                         glActiveTexture(unit);
00518                         if(enabled) {
00519                                 glEnable(GL_TEXTURE_2D);
00520                         } else {
00521                                 glDisable(GL_TEXTURE_2D);
00522                         }
00523                 }

void texturedSphere double  radius,
int  slices,
int  stacks
[inline, static]
 

Definition at line 607 of file Renderer.h.

References g_quadric.

00607                                                                                          {
00608                         //Renderer.setTexture(texture, Renderer.TEXTURE_ENV_MODE_REPLACE, true);
00609                         gluQuadricTexture(g_quadric, true);
00610                         gluSphere(g_quadric, radius, slices, stacks);
00611                 }

void translate float  tx,
float  ty,
float  tz
[inline, static]
 

Definition at line 384 of file Renderer.h.

00384                                                                            {
00385                         glTranslatef(tx, ty, tz);
00386                 }

void translate Vector3f  t  )  [inline, static]
 

Definition at line 376 of file Renderer.h.

References pge::Vector3f::m_v.

00376                                                          {
00377                         glTranslatef(t.m_v[0], t.m_v[1], t.m_v[2]);
00378                 }

void vertex2i Vector2i  vertex,
float  texCoord[]
[inline, static]
 

Definition at line 283 of file Renderer.h.

References pge::Vector2i::m_v.

00283                                                                                {
00284                         glMultiTexCoord2fv(GL_TEXTURE0, texCoord);
00285                         glVertex2iv(vertex.m_v);
00286                 }

void vertex2i Vector2i  vertex,
float  u,
float  v
[inline, static]
 

Definition at line 274 of file Renderer.h.

References pge::Vector2i::m_v.

00274                                                                                {
00275                         glMultiTexCoord2f(GL_TEXTURE0, u, v);
00276                         glVertex2iv(vertex.m_v);
00277                 }

void vertex2i Vector2i  v  )  [inline, static]
 

Definition at line 266 of file Renderer.h.

References pge::Vector2i::m_v.

00266                                                         {
00267                         glVertex2iv(v.m_v);
00268                 }

void vertex2i int  x,
int  y
[inline, static]
 

Definition at line 258 of file Renderer.h.

00258                                                           {
00259                         glVertex2i(x, y);
00260                 }

void vertex3f Vector3f  v,
float  texCoordU,
float  texCoordV,
int  textureUnit
[inline, static]
 

Definition at line 249 of file Renderer.h.

References pge::Vector3f::m_v.

00249                                                                                                            {
00250                         glMultiTexCoord2f(textureUnit, texCoordU, texCoordV);
00251                         glVertex3fv(v.m_v);
00252                 }

void vertex3f Vector3f  vertex,
Vector2f  texCoord,
int  textureUnit
[inline, static]
 

Definition at line 240 of file Renderer.h.

References pge::Vector3f::m_v, and pge::Vector2f::m_v.

00240                                                                                                  {
00241                         glMultiTexCoord2fv(textureUnit, texCoord.m_v);
00242                         glVertex3fv(vertex.m_v);
00243                 }

void vertex3f Vector3f  vertex,
float  texCoord[]
[inline, static]
 

Definition at line 231 of file Renderer.h.

References pge::Vector3f::m_v.

00231                                                                                {
00232                         glMultiTexCoord2fv(GL_TEXTURE0, texCoord);
00233                         glVertex3fv(vertex.m_v);
00234                 }

void vertex3f Vector3f  vertex,
float  texCoordU0,
float  texCoordV0,
float  texCoordU1,
float  texCoordV1
[inline, static]
 

Definition at line 220 of file Renderer.h.

References pge::Vector3f::m_v.

00221                                           {
00222                                 glMultiTexCoord2f(GL_TEXTURE0, texCoordU0, texCoordV0);
00223                                 glMultiTexCoord2f(GL_TEXTURE1, texCoordU1, texCoordV1);
00224                                 glVertex3fv(vertex.m_v);
00225                 }

void vertex3f Vector3f  vertex,
Vector2f  texCoord0,
Vector2f  texCoord1
[inline, static]
 

Definition at line 210 of file Renderer.h.

References pge::Vector3f::m_v, and pge::Vector2f::m_v.

00210                                                                                                      {
00211                         glMultiTexCoord2fv(GL_TEXTURE0, texCoord0.m_v);
00212                         glMultiTexCoord2fv(GL_TEXTURE1, texCoord1.m_v);
00213                         glVertex3fv(vertex.m_v);
00214                 }

void vertex3f Vector3f  vertex,
float  texCoordU,
float  texCoordV
[inline]
 

Definition at line 200 of file Renderer.h.

References pge::Vector3f::m_v.

00200                                                                                         {
00201                         glMultiTexCoord2f(GL_TEXTURE0, texCoordU, texCoordV);
00202                         glVertex3fv(vertex.m_v);
00203                 }

void vertex3f Vector3f  vertex,
Vector2f  texCoord
[inline, static]
 

Definition at line 191 of file Renderer.h.

References pge::Vector3f::m_v, and pge::Vector2f::m_v.

00191                                                                                 {
00192                         glMultiTexCoord2fv(GL_TEXTURE0, texCoord.m_v);
00193                         glVertex3fv(vertex.m_v);
00194                 }

void vertex3f Vector3f  vertex  )  [inline, static]
 

Definition at line 183 of file Renderer.h.

References pge::Vector3f::m_v.

00183                                                              {
00184                         glVertex3fv(vertex.m_v);
00185                 }

void vertex3f float  x,
float  y,
float  z,
float  u,
float  v
[inline, static]
 

Definition at line 174 of file Renderer.h.

00174                                                                                          {
00175                         glMultiTexCoord2f(GL_TEXTURE0, u, v);
00176                         glVertex3f(x, y, z);
00177                 }

void vertex3f float  x,
float  y,
float  z
[inline, static]
 

Definition at line 166 of file Renderer.h.

00166                                                                        {
00167                         glVertex3f(x, y, z);
00168                 }

void wireSphere Vector4f  position,
double  radius,
int  slices,
int  stacks
[inline, static]
 

Definition at line 595 of file Renderer.h.

References g_quadric, and pge::Vector4f::m_v.

00595                                                                                                         {
00596                         glPushMatrix();
00597                         glTranslatef(position.m_v[0], position.m_v[1], position.m_v[2]);
00598                         gluQuadricTexture(g_quadric, false);
00599                         gluSphere(g_quadric, radius, slices, stacks);
00600                         glPopMatrix();
00601                 }

void wireSphere Vector3f  position,
double  radius,
int  slices,
int  stacks
[inline, static]
 

Definition at line 583 of file Renderer.h.

References g_quadric, and pge::Vector3f::m_v.

00583                                                                                                         {
00584                         glPushMatrix();
00585                         glTranslatef(position.m_v[0], position.m_v[1], position.m_v[2]);
00586                         gluQuadricTexture(g_quadric, false);
00587                         gluSphere(g_quadric, radius, slices, stacks);
00588                         glPopMatrix();
00589                 }

void wireSphere double  radius,
int  slices,
int  stacks
[inline, static]
 

Definition at line 574 of file Renderer.h.

References g_quadric.

00574                                                                                      {
00575                         gluQuadricTexture(g_quadric, false);
00576                         gluSphere(g_quadric, radius, slices, stacks);
00577                 }


Variable Documentation

float pge::renderer::g_farPlane = 1500.0f [static]
 

Definition at line 26 of file Renderer.h.

Referenced by enter3DMode().

float pge::renderer::g_fovAngle = 45.0f [static]
 

Definition at line 27 of file Renderer.h.

Referenced by enter3DMode().

float pge::renderer::g_nearPlane = 0.1f [static]
 

Definition at line 25 of file Renderer.h.

Referenced by enter3DMode().

GLUquadric* pge::renderer::g_quadric [static]
 

Definition at line 22 of file Renderer.h.

Referenced by glInit(), glShutdown(), texturedSphere(), and wireSphere().


Generated on Mon Oct 16 12:10:01 2006 for Phobosengine by doxygen 1.3.4