Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

OpenGLRenderer Class Reference

#include <OpenGLRenderer.h>

Inherits Renderer.

Inheritance diagram for OpenGLRenderer:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 OpenGLRenderer ()
void init ()
void setDefaults ()
void changeDepthFunc (const int depthFunc)
void changeBlending (const int src, const int dest, const int blendMode)
void changeMask (const int mask)
void changeTextureUnit (const int tex)
void changeTexture (const TextureID textureID)
void assignNamedTextures ()
void changeShader (const ShaderID shader)
void changeShaderConstant1f (const char *name, const float constant)
void changeShaderConstant2f (const char *name, const Vec2 &constant)
void changeShaderConstant3f (const char *name, const Vec3 &constant)
void changeShaderConstant4f (const char *name, const Vec4 &constant)
void changeFragmentShader (const ShaderID shader)
void changeVertexShader (const ShaderID shader)

Protected Member Functions

bool createTexture (Texture &texture)
void removeTexture (Texture &texture)
bool createShader (Shader &shader, const char *vertexShaderText, const char *fragmentShaderText)
void removeShader (Shader &shader)
void createFragmentShader (FragmentShader &fragmentShader)
void removeFragmentShader (FragmentShader &fragmentShader)
void uploadFragmentShader (FragmentShader &fragmentShader)
void createVertexShader (VertexShader &vertexShader)
void removeVertexShader (VertexShader &vertexShader)
void uploadVertexShader (VertexShader &vertexShader)

Static Protected Attributes

static GLenum targets [] = { GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_ARB}

Detailed Description

OpenGLRenderer.h

Author: Petter Alstermark, petter@alstermark.com

Definition at line 13 of file OpenGLRenderer.h.


Constructor & Destructor Documentation

OpenGLRenderer::OpenGLRenderer  ) 
 

Definition at line 40 of file OpenGLRenderer.cpp.

References init().

Here is the call graph for this function:


Member Function Documentation

void OpenGLRenderer::assignNamedTextures  )  [virtual]
 

Implements Renderer.

Definition at line 224 of file OpenGLRenderer.cpp.

References Renderer::currentShader, glGetUniformLocationARB, glUniform1iARB, Renderer::nNamedTextures, Renderer::selectedTextureNames, SHADER_NONE, and Renderer::shaders.

void OpenGLRenderer::changeBlending const int  src,
const int  dest,
const int  blendMode
 

Definition at line 94 of file OpenGLRenderer.cpp.

References BLENDING_NONE, Renderer::currentBlendDest, Renderer::currentBlendMode, Renderer::currentBlendSrc, and glBlendEquationEXT.

void OpenGLRenderer::changeDepthFunc const int  depthFunc  )  [virtual]
 

Implements Renderer.

Definition at line 77 of file OpenGLRenderer.cpp.

References Renderer::currentDepthFunc, and DEPTH_NONE.

void OpenGLRenderer::changeFragmentShader const ShaderID  shader  )  [virtual]
 

else if (fragmentShaders[shader].type == GL_FRAGMENT_SHADER_ATI) { glBindFragmentShaderATI(fragmentShaders[shader].shaderID); } else if (fragmentShaders[shader].type == GL_REGISTER_COMBINERS_NV) { glCallList(fragmentShaders[shader].shaderID);

Implements Renderer.

Definition at line 424 of file OpenGLRenderer.cpp.

References Renderer::currentFragmentShader, Renderer::fragmentShaders, GL_FRAGMENT_PROGRAM_ARB, glBindProgramARB, and SHADER_NONE.

void OpenGLRenderer::changeMask const int  mask  )  [virtual]
 

Implements Renderer.

Definition at line 116 of file OpenGLRenderer.cpp.

References ALPHA, BLUE, COLOR, Renderer::currentMask, DEPTH, GREEN, and RED.

void OpenGLRenderer::changeShader const ShaderID  shader  )  [virtual]
 

Implements Renderer.

Definition at line 305 of file OpenGLRenderer.cpp.

References Renderer::currentShader, glUseProgramObjectARB, SHADER_NONE, and Renderer::shaders.

void OpenGLRenderer::changeShaderConstant1f const char name,
const float  constant
[virtual]
 

Implements Renderer.

Definition at line 319 of file OpenGLRenderer.cpp.

References Renderer::currentShader, glGetUniformLocationARB, glUniform1fARB, SHADER_NONE, and Renderer::shaders.

void OpenGLRenderer::changeShaderConstant2f const char name,
const Vec2 constant
[virtual]
 

Implements Renderer.

Definition at line 329 of file OpenGLRenderer.cpp.

References Renderer::currentShader, glGetUniformLocationARB, glUniform2fARB, SHADER_NONE, Renderer::shaders, Vec2::x, and Vec2::y.

void OpenGLRenderer::changeShaderConstant3f const char name,
const Vec3 constant
[virtual]
 

Implements Renderer.

Definition at line 340 of file OpenGLRenderer.cpp.

References Renderer::currentShader, glGetUniformLocationARB, glUniform3fARB, SHADER_NONE, Renderer::shaders, Vec3::x, Vec3::y, and Vec3::z.

void OpenGLRenderer::changeShaderConstant4f const char name,
const Vec4 constant
[virtual]
 

Implements Renderer.

Definition at line 351 of file OpenGLRenderer.cpp.

References Renderer::currentShader, glGetUniformLocationARB, glUniform4fARB, SHADER_NONE, Renderer::shaders, Vec4::w, Vec4::x, Vec4::y, and Vec4::z.

void OpenGLRenderer::changeTexture const TextureID  textureID  )  [virtual]
 

if (textureID == TEXTURE_NONE) { glDisable(GL_TEXTURE_2D); } else { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, textures[textureID].textureID);

Implements Renderer.

Definition at line 187 of file OpenGLRenderer.cpp.

References Renderer::currentTextures, Renderer::currentTextureUnit, targets, TEXTURE_NONE, and Renderer::textures.

void OpenGLRenderer::changeTextureUnit const int  tex  )  [virtual]
 

Implements Renderer.

Definition at line 179 of file OpenGLRenderer.cpp.

References Renderer::currentTextureUnit, GL_TEXTURE0_ARB, and glActiveTextureARB.

void OpenGLRenderer::changeVertexShader const ShaderID  shader  )  [virtual]
 

Implements Renderer.

Definition at line 456 of file OpenGLRenderer.cpp.

References Renderer::currentVertexShader, GL_VERTEX_PROGRAM_ARB, glBindProgramARB, SHADER_NONE, and Renderer::vertexShaders.

void OpenGLRenderer::createFragmentShader FragmentShader fragmentShader  )  [protected, virtual]
 

else

Implements Renderer.

Definition at line 363 of file OpenGLRenderer.cpp.

References GL_FRAGMENT_PROGRAM_ARB, glBindProgramARB, glGenProgramsARB, and FragmentShader::shaderID.

bool OpenGLRenderer::createShader Shader shader,
const char vertexShaderText,
const char fragmentShaderText
[protected, virtual]
 

Implements Renderer.

Definition at line 236 of file OpenGLRenderer.cpp.

References Shader::fragmentShader, GL_FRAGMENT_SHADER_ARB, GL_OBJECT_COMPILE_STATUS_ARB, GL_OBJECT_LINK_STATUS_ARB, GL_VERTEX_SHADER_ARB, glAttachObjectARB, glCompileShaderARB, glCreateProgramObjectARB, glCreateShaderObjectARB, glGetInfoLogARB, glGetObjectParameterivARB, glLinkProgramARB, glShaderSourceARB, LOG_ERROR, Shader::programObj, removeShader(), and Shader::vertexShader.

Here is the call graph for this function:

bool OpenGLRenderer::createTexture Texture texture  )  [protected, virtual]
 

Implements Renderer.

Definition at line 131 of file OpenGLRenderer.cpp.

References Texture::clampS, Texture::clampT, Image::getData(), Image::getFormat(), Image::getHeight(), Image::getWidth(), GL_CLAMP_TO_EDGE_EXT, GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, Texture::images, targets, TEXTURE_2D, TEXTURE_CUBEMAP, Texture::textureID, and Texture::textureKind.

Here is the call graph for this function:

void OpenGLRenderer::createVertexShader VertexShader vertexShader  )  [protected, virtual]
 

Implements Renderer.

Definition at line 402 of file OpenGLRenderer.cpp.

References GL_VERTEX_PROGRAM_ARB, glBindProgramARB, glGenProgramsARB, and VertexShader::shaderID.

void OpenGLRenderer::init  ) 
 

Definition at line 47 of file OpenGLRenderer.cpp.

References GL_ARB_multitexture_supported, GL_MAX_TEXTURE_UNITS_ARB, MAX_TEXTURES, Renderer::maxTextures, Renderer::resetToDefaults(), and setDefaults().

Referenced by OpenGLRenderer().

Here is the call graph for this function:

void OpenGLRenderer::removeFragmentShader FragmentShader fragmentShader  )  [protected, virtual]
 

Implements Renderer.

Definition at line 380 of file OpenGLRenderer.cpp.

References GL_FRAGMENT_PROGRAM_ARB, glDeleteProgramsARB, FragmentShader::shaderID, and FragmentShader::type.

void OpenGLRenderer::removeShader Shader shader  )  [protected, virtual]
 

Implements Renderer.

Definition at line 296 of file OpenGLRenderer.cpp.

References Shader::fragmentShader, glDeleteObjectARB, Shader::programObj, and Shader::vertexShader.

Referenced by createShader().

void OpenGLRenderer::removeTexture Texture texture  )  [protected, virtual]
 

Implements Renderer.

Definition at line 172 of file OpenGLRenderer.cpp.

References Texture::textureID.

void OpenGLRenderer::removeVertexShader VertexShader vertexShader  )  [protected, virtual]
 

Implements Renderer.

Definition at line 410 of file OpenGLRenderer.cpp.

References glDeleteProgramsARB, and VertexShader::shaderID.

void OpenGLRenderer::setDefaults  )  [virtual]
 

Implements Renderer.

Definition at line 63 of file OpenGLRenderer.cpp.

Referenced by init().

void OpenGLRenderer::uploadFragmentShader FragmentShader fragmentShader  )  [protected, virtual]
 

Implements Renderer.

Definition at line 395 of file OpenGLRenderer.cpp.

References GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, glProgramStringARB, FragmentShader::length, and FragmentShader::program.

void OpenGLRenderer::uploadVertexShader VertexShader vertexShader  )  [protected, virtual]
 

Implements Renderer.

Definition at line 417 of file OpenGLRenderer.cpp.

References GL_PROGRAM_FORMAT_ASCII_ARB, GL_VERTEX_PROGRAM_ARB, glProgramStringARB, VertexShader::length, and VertexShader::program.


Member Data Documentation

GLenum OpenGLRenderer::targets = { GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_ARB} [static, protected]
 

Definition at line 38 of file OpenGLRenderer.cpp.

Referenced by changeTexture(), and createTexture().


Generated on Sun Jun 5 15:50:34 2005 for Defacto by  doxygen 1.4.3