Now compatible with GLKView's
--HG-- extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%40112
This commit is contained in:
@@ -132,6 +132,9 @@ void KRCamera::setPosition(const KRVector3 &position) {
|
||||
|
||||
void KRCamera::renderFrame(KRScene &scene, KRMat4 &viewMatrix)
|
||||
{
|
||||
GLint defaultFBO;
|
||||
GLDEBUG(glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFBO));
|
||||
|
||||
m_pContext->rotateBuffers(true);
|
||||
KRMat4 invViewMatrix = viewMatrix;
|
||||
invViewMatrix.invert();
|
||||
@@ -185,6 +188,8 @@ void KRCamera::renderFrame(KRScene &scene, KRMat4 &viewMatrix)
|
||||
}
|
||||
|
||||
renderFrame(scene, viewMatrix, lightDirection, cameraPosition);
|
||||
|
||||
GLDEBUG(glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO));
|
||||
renderPost();
|
||||
|
||||
m_iFrame++;
|
||||
@@ -341,8 +346,9 @@ void KRCamera::renderFrame(KRScene &scene, KRMat4 &viewMatrix, KRVector3 &lightD
|
||||
// Disable alpha blending
|
||||
GLDEBUG(glDisable(GL_BLEND));
|
||||
|
||||
GLDEBUG(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
|
||||
GLDEBUG(glClearColor(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
GLDEBUG(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
|
||||
|
||||
|
||||
// Enable backface culling
|
||||
GLDEBUG(glCullFace(GL_BACK));
|
||||
@@ -633,9 +639,6 @@ void KRCamera::renderShadowBuffer(KRScene &scene, int iShadow)
|
||||
|
||||
void KRCamera::renderPost()
|
||||
{
|
||||
|
||||
GLDEBUG(glBindFramebuffer(GL_FRAMEBUFFER, 1)); // renderFramebuffer
|
||||
|
||||
// Disable alpha blending
|
||||
GLDEBUG(glDisable(GL_BLEND));
|
||||
|
||||
|
||||
@@ -69,6 +69,9 @@ KRMat4 &KRInstance::getModelMatrix() {
|
||||
void KRInstance::loadModel() {
|
||||
if(m_pModel == NULL) {
|
||||
m_pModel = m_pContext->getModelManager()->getModel(m_model_name.c_str());
|
||||
if(m_pModel == NULL) {
|
||||
fprintf(stderr, "KREngine - Model not found: %s\n", m_model_name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user