本文整理汇总了C++中GLSLShader::getProgramHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ GLSLShader::getProgramHandle方法的具体用法?C++ GLSLShader::getProgramHandle怎么用?C++ GLSLShader::getProgramHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLSLShader
的用法示例。
在下文中一共展示了GLSLShader::getProgramHandle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Enable
bool GLInputVertexAttribute::Enable()
{
if (isCreateOK())
{
bool result = false;
GLSLShader* shader = (dynamic_cast<GLRenderable*>(this->getRenderable()))->getShader();
GLMesh* mesh = (dynamic_cast<GLRenderable*>(this->getRenderable()))->getMesh();
if (shader->isCreateOK() && shader->isEnableOK() && mesh != NULL)
{
m_IAHandle = glGetAttribLocation(shader->getProgramHandle(), m_InputVertexAttributeName.c_str());
LOGD("call glGetAttribLocation(%d, %s), get the input attribute handle is %d", shader->getProgramHandle(), m_InputVertexAttributeName.c_str(), m_IAHandle);
if (m_IAHandle != -1)
{
glEnableVertexAttribArray(m_IAHandle);
if (mesh->isUseCPUBuffer())
{
// use cpu memory's vertex buffer pointer
glVertexAttribPointer(m_IAHandle, m_IAElementNum, m_IAType, m_IANormalized, m_IAStride, (BYTE*)(mesh->getVertexDataPointer()) + m_IAOffset);
}
else
{
// use gpu memory's vertex buffer
glBindBuffer(GL_ARRAY_BUFFER, mesh->getVBOHandle());
glVertexAttribPointer(m_IAHandle, m_IAElementNum, m_IAType, m_IANormalized, m_IAStride, (BYTE*)m_IAOffset);
}
result = true;
}
else
{
LOGE("glGetAttribLocation return -1");
result = false;
}
}
m_bIsEnableOK = result;
}
return isEnableOK();
}