本文整理汇总了C++中ogl::CObject::getM方法的典型用法代码示例。如果您正苦于以下问题:C++ CObject::getM方法的具体用法?C++ CObject::getM怎么用?C++ CObject::getM使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogl::CObject
的用法示例。
在下文中一共展示了CObject::getM方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onDraw
void onDraw(int nTime)
{
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
math::mat4 mM;
math::mat4 mV;
math::mat4 mP;
mM = pObject1->getM();
mV = pCamera->getViewMatrix();
mP = pCamera->getProjectionMatrix();
pProgramRender->enable(); // ::enable() ::disable()
pProgramRender->setUniform("u_mM", mM);
pProgramRender->setUniform("u_mMV", mV * mM);
pProgramRender->setUniform("u_mP", mP);
pProgramRender->setUniform("u_oDirectLight.vColor", pDirectLight->mColor);
pProgramRender->setUniform("u_oDirectLight.vDirection", math::normalize(pDirectLight->mDirection)); // left to rigth
pProgramRender->setUniform("u_oDirectLight.fAmbientIntensity", pDirectLight->mAmbientIntensity);
pProgramRender->setUniform("u_oDirectLight.fDiffuseIntensity", pDirectLight->mDiffuseIntensity);
pProgramRender->setUniform("u_fSpecularIntensity", 0.0f);
pProgramRender->setUniform("u_fSpecularPower", 0.0f);
pProgramRender->setUniform("u_fEyePosition", pCamera->getPosition());
// pObjectP->draw(); // DEPRICATED
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
pProgramBillboard->enable();
pProgramBillboard->setUniform("u_mVP", pCamera->getProjectionMatrix() * pCamera->getViewMatrix());
pProgramBillboard->setUniform("u_vCameraPosition", pCamera->getPosition());
// pObjectB->draw(); // DEPRICATED
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
GLint prevCullFace;
glGetIntegerv(GL_CULL_FACE_MODE, &prevCullFace);
GLint prevDepthFunc;
glGetIntegerv(GL_DEPTH_FUNC, &prevDepthFunc);
glCullFace(GL_FRONT);
glDepthFunc(GL_LEQUAL);
pProgramSkybox->enable();
mM = math::translate(pCamera->getPosition()) * pObjectS->getM();
mV = pCamera->getViewMatrix();
mP = pCamera->getProjectionMatrix();
pProgramSkybox->setUniform("u_mMVP", mP * mV * mM);
// pObjectS->draw(); // DEPRICATED
glCullFace(prevCullFace);
glDepthFunc(prevDepthFunc);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//CApp::exit();
}
示例2: onDraw
void onDraw(int nTime)
{
const float fTime = nTime / 1000.0f;
sys::info << "app::COGLDev02App::onDraw(" << nTime << ") > " << fTime << sys::endl;
static const GLfloat gray[] = { 0.1f, 0.1f, 0.1f, 0.0f };
static const GLfloat ones[] = { 1.0f };
glClearBufferfv(GL_COLOR, 0, gray);
glClearBufferfv(GL_DEPTH, 0, ones);
math::mat4 mM = pObject->getM() *
math::rotate(fTime * 13.25f, math::Y);
math::mat4 mV = pCamera->getViewMatrix();
math::mat4 mP = pCamera->getProjectionMatrix();
// math::mat4 mV = math::lookat(math::vec3(0.0f, 1.0f, 0.0f), math::vec3(0.0f, 0.8f, 0.5f), math::Y);
// math::mat4 mP = math::perspective(60.0f, mConfig.mRatio, 0.1f, 100.0f);
//math::mat4 mMV = math::translate(0.0f, 0.0f, -5.0f) *
// math::rotate(fTime * 13.75f, math::Y);
glViewport(0, 0, mConfig.mWidth, mConfig.mHeight);
pProgram->use();
pProgram->setUniform("u_fTime", fTime);
//pProgram->setUniform("u_mM", mM);
//pProgram->setUniform("u_mMV", mMV);
pProgram->setUniform("u_mMV", mV * mM);
pProgram->setUniform("u_mP", mP);
pProgram->setUniform("u_bWireframe", false);
pProgram->setUniform("u_oDirectLight.vColor", oDirectionalLight.vColor);
pProgram->setUniform("u_oDirectLight.vDirection", math::normalize(oDirectionalLight.vDirection));
pProgram->setUniform("u_oDirectLight.fAmbientIntensity", oDirectionalLight.fAmbientIntensity);
pProgram->setUniform("u_vEyePos", pCamera->getPosition());
pProgram->setUniform("u_fSpecularIntensity", 1.0f);
pProgram->setUniform("u_fSpecularPower", 64.0f);
pTexture->bind(GL_TEXTURE0);
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
// pObject->draw(); // DEPRICATED
// pProgram->setUniform("u_bWireframe", true);
pTexture->unbind();
// glEnable(GL_POLYGON_OFFSET_LINE);
// glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
// glLineWidth(1.0f);
// pObject->draw();
// glDisable(GL_POLYGON_OFFSET_LINE);
pProgram->unuse();
}