Contents User Forum Source Index APIs by Task APIs by Level Data


G3D::VertexAndPixelShader::GPUShader Class Reference

#include <Shader.h>

List of all members.

Public Member Functions

bool fixedFunction () const
GLhandleARB glShaderObject () const
GLenum glShaderType () const
void init (const std::string &name, const std::string &code, bool fromFile, bool debug, GLenum glType, const std::string &type, UseG3DUniforms u)
const std::string & messages () const
bool ok () const
const std::string & shaderType () const
 ~GPUShader ()

Protected Member Functions

void compile ()
void replaceG3DSize (std::string &code, std::string &uniformString)

Static Protected Member Functions

static GPUShaderinit (GPUShader *shader, bool debug)

Protected Attributes

std::string _code
bool _fixedFunction
GLhandleARB _glShaderObject
GLenum _glShaderType
std::string _messages
std::string _name
bool _ok
std::string _shaderType
bool fromFile

Static Protected Attributes

static std::string ignore


Constructor & Destructor Documentation

G3D::VertexAndPixelShader::GPUShader::~GPUShader (  ) 

Deletes the underlying glShaderObject.

Between GL's reference counting and G3D's reference counting, an underlying object can never be deleted while in use.


Member Function Documentation

void G3D::VertexAndPixelShader::GPUShader::compile (  )  [protected]

Returns true on success.

Called from init.

bool G3D::VertexAndPixelShader::GPUShader::fixedFunction (  )  const [inline]

GLhandleARB G3D::VertexAndPixelShader::GPUShader::glShaderObject (  )  const [inline]

Returns the underlying OpenGL shader object for this shader.

GLenum G3D::VertexAndPixelShader::GPUShader::glShaderType (  )  const [inline]

Shader type, e.g.

GL_VERTEX_SHADER_ARB

void G3D::VertexAndPixelShader::GPUShader::init ( const std::string &  name,
const std::string &  code,
bool  fromFile,
bool  debug,
GLenum  glType,
const std::string &  type,
UseG3DUniforms  u 
)

static GPUShader* G3D::VertexAndPixelShader::GPUShader::init ( GPUShader shader,
bool  debug 
) [static, protected]

Initialize a shader object and returns object.

Called from subclass create methods.

const std::string& G3D::VertexAndPixelShader::GPUShader::messages (  )  const [inline]

Why compilation failed, or any compiler warnings if it succeeded.

bool G3D::VertexAndPixelShader::GPUShader::ok (  )  const [inline]

Returns true if compilation and loading succeeded.

If they failed, check the message string.

void G3D::VertexAndPixelShader::GPUShader::replaceG3DSize ( std::string &  code,
std::string &  uniformString 
) [protected]

Replaces all instances of "g3d_sampler2DSize(name)" with " (g3d_sz2D_name.xy)" and.

"g3d_sampler2DInvSize(name)" with " (g3d_sz2D_name.zw)"

Note that both replacements will leave column numbers the same in error messages. The () wrapper ensures that .xy fields are accessible using normal syntax off the result; it is the same as the standard practice of wrapping macros in parentheses.

and adds "uniform vec4 g3d_sz2D_name;" to the uniform string.

Called from init.

const std::string& G3D::VertexAndPixelShader::GPUShader::shaderType (  )  const [inline]


Member Data Documentation

Set to true when name and code both == "".

std::string G3D::VertexAndPixelShader::GPUShader::ignore [static, protected]

argument for output on subclasses


The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:48 2007 for G3D by doxygen 1.5.2
Hosted by SourceForge.net Logo