本文整理汇总了C++中GpuProgramParametersSharedPtr::getIntPointer方法的典型用法代码示例。如果您正苦于以下问题:C++ GpuProgramParametersSharedPtr::getIntPointer方法的具体用法?C++ GpuProgramParametersSharedPtr::getIntPointer怎么用?C++ GpuProgramParametersSharedPtr::getIntPointer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GpuProgramParametersSharedPtr
的用法示例。
在下文中一共展示了GpuProgramParametersSharedPtr::getIntPointer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _updateParameter
void FixedFuncPrograms::_updateParameter( GpuProgramParametersSharedPtr & programParameters, const String paramName, const void * value, const size_t sizeInBytes )
{
const GpuConstantDefinition& def = programParameters->getConstantDefinition(paramName);
if (def.isFloat())
{
memcpy((programParameters->getFloatPointer(def.physicalIndex)), value, sizeInBytes);
}
else
{
memcpy((programParameters->getIntPointer(def.physicalIndex)), value, sizeInBytes);
}
}
示例2: updateUniforms
//-----------------------------------------------------------------------
void GLSLESProgramPipeline::updateUniforms(GpuProgramParametersSharedPtr params,
uint16 mask, GpuProgramType fromProgType)
{
// Iterate through uniform reference list and update uniform values
GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
GLUniformReferenceIterator endUniform = mGLUniformReferences.end();
#if OGRE_PLATFORM != OGRE_PLATFORM_NACL
GLuint progID = 0;
GLUniformCache* uniformCache=0;
if(fromProgType == GPT_VERTEX_PROGRAM)
{
progID = getVertexProgram()->getGLProgramHandle();
uniformCache = getVertexProgram()->getUniformCache();
}
else if(fromProgType == GPT_FRAGMENT_PROGRAM)
{
progID = mFragmentProgram->getGLProgramHandle();
uniformCache = mFragmentProgram->getUniformCache();
}
for (;currentUniform != endUniform; ++currentUniform)
{
// Only pull values from buffer it's supposed to be in (vertex or fragment)
// This method will be called twice, once for vertex program params,
// and once for fragment program params.
if (fromProgType == currentUniform->mSourceProgType)
{
const GpuConstantDefinition* def = currentUniform->mConstantDef;
if (def->variability & mask)
{
GLsizei glArraySize = (GLsizei)def->arraySize;
bool shouldUpdate = true;
switch (def->constType)
{
case GCT_INT1:
case GCT_INT2:
case GCT_INT3:
case GCT_INT4:
case GCT_SAMPLER1D:
case GCT_SAMPLER1DSHADOW:
case GCT_SAMPLER2D:
case GCT_SAMPLER2DSHADOW:
case GCT_SAMPLER3D:
case GCT_SAMPLERCUBE:
#if OGRE_NO_GLES3_SUPPORT == 0
case GCT_SAMPLER2DARRAY:
#endif
shouldUpdate = uniformCache->updateUniform(currentUniform->mLocation,
params->getIntPointer(def->physicalIndex),
static_cast<GLsizei>(def->elementSize * def->arraySize * sizeof(int)));
break;
default:
shouldUpdate = uniformCache->updateUniform(currentUniform->mLocation,
params->getFloatPointer(def->physicalIndex),
static_cast<GLsizei>(def->elementSize * def->arraySize * sizeof(float)));
break;
}
if(!shouldUpdate)
continue;
// Get the index in the parameter real list
switch (def->constType)
{
case GCT_FLOAT1:
OGRE_CHECK_GL_ERROR(glProgramUniform1fvEXT(progID, currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex)));
break;
case GCT_FLOAT2:
OGRE_CHECK_GL_ERROR(glProgramUniform2fvEXT(progID, currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex)));
break;
case GCT_FLOAT3:
OGRE_CHECK_GL_ERROR(glProgramUniform3fvEXT(progID, currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex)));
break;
case GCT_FLOAT4:
OGRE_CHECK_GL_ERROR(glProgramUniform4fvEXT(progID, currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex)));
break;
case GCT_MATRIX_2X2:
OGRE_CHECK_GL_ERROR(glProgramUniformMatrix2fvEXT(progID, currentUniform->mLocation, glArraySize,
GL_FALSE, params->getFloatPointer(def->physicalIndex)));
break;
case GCT_MATRIX_3X3:
OGRE_CHECK_GL_ERROR(glProgramUniformMatrix3fvEXT(progID, currentUniform->mLocation, glArraySize,
GL_FALSE, params->getFloatPointer(def->physicalIndex)));
break;
case GCT_MATRIX_4X4:
OGRE_CHECK_GL_ERROR(glProgramUniformMatrix4fvEXT(progID, currentUniform->mLocation, glArraySize,
GL_FALSE, params->getFloatPointer(def->physicalIndex)));
break;
case GCT_INT1:
OGRE_CHECK_GL_ERROR(glProgramUniform1ivEXT(progID, currentUniform->mLocation, glArraySize,
params->getIntPointer(def->physicalIndex)));
break;
case GCT_INT2:
OGRE_CHECK_GL_ERROR(glProgramUniform2ivEXT(progID, currentUniform->mLocation, glArraySize,
params->getIntPointer(def->physicalIndex)));
//.........这里部分代码省略.........
示例3: updateUniforms
void GLSLSeparableProgram::updateUniforms(GpuProgramParametersSharedPtr params,
uint16 mask, GpuProgramType fromProgType)
{
// Iterate through uniform reference list and update uniform values
GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
GLUniformReferenceIterator endUniform = mGLUniformReferences.end();
// determine if we need to transpose matrices when binding
int transpose = GL_TRUE;
if ((fromProgType == GPT_FRAGMENT_PROGRAM && mVertexShader && (!mVertexShader->getColumnMajorMatrices())) ||
(fromProgType == GPT_VERTEX_PROGRAM && mFragmentShader && (!mFragmentShader->getColumnMajorMatrices())) ||
(fromProgType == GPT_GEOMETRY_PROGRAM && mGeometryShader && (!mGeometryShader->getColumnMajorMatrices())) ||
(fromProgType == GPT_HULL_PROGRAM && mHullShader && (!mHullShader->getColumnMajorMatrices())) ||
(fromProgType == GPT_DOMAIN_PROGRAM && mDomainShader && (!mDomainShader->getColumnMajorMatrices())) ||
(fromProgType == GPT_COMPUTE_PROGRAM && mComputeShader && (!mComputeShader->getColumnMajorMatrices())))
{
transpose = GL_FALSE;
}
GLuint progID = 0;
if (fromProgType == GPT_VERTEX_PROGRAM)
{
progID = mVertexShader->getGLProgramHandle();
}
else if (fromProgType == GPT_FRAGMENT_PROGRAM)
{
progID = mFragmentShader->getGLProgramHandle();
}
else if (fromProgType == GPT_GEOMETRY_PROGRAM)
{
progID = mGeometryShader->getGLProgramHandle();
}
else if (fromProgType == GPT_HULL_PROGRAM)
{
progID = mHullShader->getGLProgramHandle();
}
else if (fromProgType == GPT_DOMAIN_PROGRAM)
{
progID = mDomainShader->getGLProgramHandle();
}
else if (fromProgType == GPT_COMPUTE_PROGRAM)
{
progID = mComputeShader->getGLProgramHandle();
}
for (; currentUniform != endUniform; ++currentUniform)
{
// Only pull values from buffer it's supposed to be in (vertex or fragment)
// This method will be called once per shader stage.
if (fromProgType == currentUniform->mSourceProgType)
{
const GpuConstantDefinition* def = currentUniform->mConstantDef;
if (def->variability & mask)
{
GLsizei glArraySize = (GLsizei)def->arraySize;
// Get the index in the parameter real list
switch (def->constType)
{
case GCT_FLOAT1:
OGRE_CHECK_GL_ERROR(glProgramUniform1fv(progID, currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex)));
break;
case GCT_FLOAT2:
OGRE_CHECK_GL_ERROR(glProgramUniform2fv(progID, currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex)));
break;
case GCT_FLOAT3:
OGRE_CHECK_GL_ERROR(glProgramUniform3fv(progID, currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex)));
break;
case GCT_FLOAT4:
OGRE_CHECK_GL_ERROR(glProgramUniform4fv(progID, currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex)));
break;
case GCT_MATRIX_2X2:
OGRE_CHECK_GL_ERROR(glProgramUniformMatrix2fv(progID, currentUniform->mLocation, glArraySize,
transpose, params->getFloatPointer(def->physicalIndex)));
break;
case GCT_MATRIX_3X3:
OGRE_CHECK_GL_ERROR(glProgramUniformMatrix3fv(progID, currentUniform->mLocation, glArraySize,
transpose, params->getFloatPointer(def->physicalIndex)));
break;
case GCT_MATRIX_4X4:
OGRE_CHECK_GL_ERROR(glProgramUniformMatrix4fv(progID, currentUniform->mLocation, glArraySize,
transpose, params->getFloatPointer(def->physicalIndex)));
break;
case GCT_INT1:
OGRE_CHECK_GL_ERROR(glProgramUniform1iv(progID, currentUniform->mLocation, glArraySize,
params->getIntPointer(def->physicalIndex)));
break;
case GCT_INT2:
OGRE_CHECK_GL_ERROR(glProgramUniform2iv(progID, currentUniform->mLocation, glArraySize,
params->getIntPointer(def->physicalIndex)));
break;
case GCT_INT3:
OGRE_CHECK_GL_ERROR(glProgramUniform3iv(progID, currentUniform->mLocation, glArraySize,
params->getIntPointer(def->physicalIndex)));
break;
case GCT_INT4:
//.........这里部分代码省略.........
示例4: updateUniforms
//-----------------------------------------------------------------------
void GLSLLinkProgram::updateUniforms(GpuProgramParametersSharedPtr params,
uint16 mask, GpuProgramType fromProgType)
{
// iterate through uniform reference list and update uniform values
GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
GLUniformReferenceIterator endUniform = mGLUniformReferences.end();
for (; currentUniform != endUniform; ++currentUniform)
{
// Only pull values from buffer it's supposed to be in (vertex or fragment)
// This method will be called twice, once for vertex program params,
// and once for fragment program params.
if (fromProgType == currentUniform->mSourceProgType)
{
const GpuConstantDefinition* def = currentUniform->mConstantDef;
if (def->variability & mask)
{
GLsizei glArraySize = (GLsizei)def->arraySize;
// get the index in the parameter real list
switch (def->constType)
{
case GCT_FLOAT1:
glUniform1fvARB(currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex));
break;
case GCT_FLOAT2:
glUniform2fvARB(currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex));
break;
case GCT_FLOAT3:
glUniform3fvARB(currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex));
break;
case GCT_FLOAT4:
glUniform4fvARB(currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex));
break;
case GCT_MATRIX_2X2:
glUniformMatrix2fvARB(currentUniform->mLocation, glArraySize,
GL_TRUE, params->getFloatPointer(def->physicalIndex));
break;
case GCT_MATRIX_2X3:
if (GLEW_VERSION_2_1)
{
glUniformMatrix2x3fv(currentUniform->mLocation, glArraySize,
GL_TRUE, params->getFloatPointer(def->physicalIndex));
}
break;
case GCT_MATRIX_2X4:
if (GLEW_VERSION_2_1)
{
glUniformMatrix2x4fv(currentUniform->mLocation, glArraySize,
GL_TRUE, params->getFloatPointer(def->physicalIndex));
}
break;
case GCT_MATRIX_3X2:
if (GLEW_VERSION_2_1)
{
glUniformMatrix3x2fv(currentUniform->mLocation, glArraySize,
GL_TRUE, params->getFloatPointer(def->physicalIndex));
}
break;
case GCT_MATRIX_3X3:
glUniformMatrix3fvARB(currentUniform->mLocation, glArraySize,
GL_TRUE, params->getFloatPointer(def->physicalIndex));
break;
case GCT_MATRIX_3X4:
if (GLEW_VERSION_2_1)
{
glUniformMatrix3x4fv(currentUniform->mLocation, glArraySize,
GL_TRUE, params->getFloatPointer(def->physicalIndex));
}
break;
case GCT_MATRIX_4X2:
if (GLEW_VERSION_2_1)
{
glUniformMatrix4x2fv(currentUniform->mLocation, glArraySize,
GL_TRUE, params->getFloatPointer(def->physicalIndex));
}
break;
case GCT_MATRIX_4X3:
if (GLEW_VERSION_2_1)
{
glUniformMatrix4x3fv(currentUniform->mLocation, glArraySize,
GL_TRUE, params->getFloatPointer(def->physicalIndex));
}
break;
case GCT_MATRIX_4X4:
glUniformMatrix4fvARB(currentUniform->mLocation, glArraySize,
GL_TRUE, params->getFloatPointer(def->physicalIndex));
break;
case GCT_INT1:
glUniform1ivARB(currentUniform->mLocation, glArraySize,
(GLint*)params->getIntPointer(def->physicalIndex));
break;
case GCT_INT2:
glUniform2ivARB(currentUniform->mLocation, glArraySize,
//.........这里部分代码省略.........