G3D::VertexProgram Class ReferenceAbstraction of OpenGL vertex programs.
More...
#include <VertexProgram.h>
Inherits G3D::GPUProgram.
List of all members.
|
Public Types |
| enum | Source { VARIABLE,
CONSTANT
} |
| enum | Type {
FLOAT4X4,
FLOAT3X3,
FLOAT2X2,
FLOAT4,
FLOAT3,
FLOAT2,
FLOAT1,
SAMPLER1D,
SAMPLER2D,
SAMPLER3D,
SAMPLERCUBE,
SAMPLERRECT
} |
Public Member Functions |
| void | bind () |
| void | disable () |
| GLuint | getOpenGLID () const |
| void | ReferenceCountedObject_zeroWeakPointers () |
| void | reload (const std::string &code="") |
Static Public Member Functions |
| static bool | CgType (const std::string &s, Type &t) |
| static VertexProgramRef | fromCode (const std::string &name, const std::string &code) |
| static VertexProgramRef | fromFile (const std::string &filename) |
| static std::string | toString (const Type &t) |
Public Attributes |
| AtomicInt32 | ReferenceCountedObject_refCount |
| _WeakPtrLinkedList * | ReferenceCountedObject_weakPointer |
Protected Types |
| enum | Extension { ARB,
NVIDIA
} |
Protected Member Functions |
| void | bindProgram (int unit, unsigned int glProgram) const |
| void | deletePrograms (int num, unsigned int *id) const |
| void | genPrograms (int num, unsigned int *id) const |
| void | getProgramError (int &pos, const unsigned char *&msg) const |
| void | loadConstant (int slot, const Vector4 &value) const |
| void | loadProgram (const std::string &code) const |
| void | setArgs (class RenderDevice *, const ArgList &args) |
Static Protected Member Functions |
| static GLenum | getUnitFromCode (const std::string &code, Extension &extension) |
Protected Attributes |
| BindingTable | bindingTable |
| enum G3D::GPUProgram::Extension | extension |
| std::string | filename |
| GLuint | glProgram |
| std::string | name |
| GLenum | unit |
Detailed Description
Abstraction of OpenGL vertex programs.
This class can be used with raw OpenGL, without RenderDevice or SDL.
If you use VertexProgramRef instead of VertexProgram*, the texture memory will be garbage collected.
The vertex program must be written in the vertex program assembly languages specified by either:
http://oss.sgi.com/projects/ogl-sample/registry/ARB/vertex_program.txt
http://oss.sgi.com/projects/ogl-sample/registry/NV/vertex_program2.txt
You can also write your programs in the NVIDIA Cg language and compile them with cgc to assembly language. You cannot load Cg programs directly with a VertexProgram.
If an error is encountered inside a shader in debug mode, that error is printed to the debug window (under MSVC) and the programmer can fix the error and reload the shader without reloading the program.
See G3D::GPUProgram for information on how constants and variable assignments generated by the Cg compiler are handled.
- Deprecated:
- Use G3D::VertexShader
Member Enumeration Documentation
Which extension set to use.
- Enumerator:
-
Internal use only.
- Enumerator:
-
Internal use only.
- Enumerator:
-
| FLOAT4X4 |
|
| FLOAT3X3 |
|
| FLOAT2X2 |
|
| FLOAT4 |
|
| FLOAT3 |
|
| FLOAT2 |
|
| FLOAT1 |
|
| SAMPLER1D |
|
| SAMPLER2D |
|
| SAMPLER3D |
|
| SAMPLERCUBE |
|
| SAMPLERRECT |
|
Member Function Documentation
| void G3D::GPUProgram::bind |
( |
|
) |
[inherited] |
| void G3D::GPUProgram::bindProgram |
( |
int |
unit, |
|
|
unsigned int |
glProgram | |
|
) |
| | const [protected, inherited] |
| static bool G3D::GPUProgram::CgType |
( |
const std::string & |
s, |
|
|
Type & |
t | |
|
) |
| | [static, inherited] |
Internal use only Converts a string name (e.g.
"float4") to a Cg type. Returns false if it can't match the type.
| void G3D::GPUProgram::deletePrograms |
( |
int |
num, |
|
|
unsigned int * |
id | |
|
) |
| | const [protected, inherited] |
| void G3D::GPUProgram::disable |
( |
|
) |
[inherited] |
| static VertexProgramRef G3D::VertexProgram::fromCode |
( |
const std::string & |
name, |
|
|
const std::string & |
code | |
|
) |
| | [static] |
| static VertexProgramRef G3D::VertexProgram::fromFile |
( |
const std::string & |
filename |
) |
[static] |
| void G3D::GPUProgram::genPrograms |
( |
int |
num, |
|
|
unsigned int * |
id | |
|
) |
| | const [protected, inherited] |
| GLuint G3D::GPUProgram::getOpenGLID |
( |
|
) |
const [inherited] |
| void G3D::GPUProgram::getProgramError |
( |
int & |
pos, |
|
|
const unsigned char *& |
msg | |
|
) |
| | const [protected, inherited] |
| static GLenum G3D::GPUProgram::getUnitFromCode |
( |
const std::string & |
code, |
|
|
Extension & |
extension | |
|
) |
| | [static, protected, inherited] |
Determines which unit and extension API a shader uses from the first line.
| void G3D::GPUProgram::loadConstant |
( |
int |
slot, |
|
|
const Vector4 & |
value | |
|
) |
| | const [protected, inherited] |
| void G3D::GPUProgram::loadProgram |
( |
const std::string & |
code |
) |
const [protected, inherited] |
| void G3D::ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers |
( |
|
) |
[inline, inherited] |
Automatically called immediately before the object is deleted.
This is not called from the destructor because it needs to be invoked before the subclass destructor.
| void G3D::GPUProgram::reload |
( |
const std::string & |
code = "" |
) |
[inherited] |
Reload from supplied code or from the original file that was specified (handy when debugging shaders).
| void G3D::GPUProgram::setArgs |
( |
class RenderDevice * |
, |
|
|
const ArgList & |
args | |
|
) |
| | [protected, inherited] |
| static std::string G3D::GPUProgram::toString |
( |
const Type & |
t |
) |
[static, inherited] |
Internal use only.
For printing error messages.
Member Data Documentation
Which extension set to use.
The long name is to keep this from accidentally conflicting with a subclass's variable name.
Do not use or explicitly manipulate this value--its type may change in the future and is not part of the supported API.
Linked list of all weak pointers that reference this (some may be on the stack!).
Do not use or explicitly manipulate this value.
e.g.
GL_VERTEX_PROGRAM_ARB, GL_FRAGMENT_PROGRAM_ARB
The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:48 2007 for G3D by
1.5.2
Hosted by
|