fixed #544 The bug reaised by CCGrid render texture in another FBO.

This commit is contained in:
yangws 2011-06-28 14:32:59 +08:00
parent e8853583df
commit 0dec97a303
1 changed files with 9 additions and 4 deletions

View File

@ -210,8 +210,10 @@ namespace cocos2d
CCSize winSize = CCDirector::sharedDirector()->getWinSizeInPixels(); CCSize winSize = CCDirector::sharedDirector()->getWinSizeInPixels();
glLoadIdentity(); glLoadIdentity();
// glViewport((GLsizei)0, (GLsizei)0, (GLsizei)winSize.width, (GLsizei)winSize.height);
CCDirector::sharedDirector()->getOpenGLView()->setViewPortInPoints(0, 0, winSize.width, winSize.height); // set view port for user FBO, fixed bug #543 #544
glViewport((GLsizei)0, (GLsizei)0, (GLsizei)winSize.width, (GLsizei)winSize.height);
// CCDirector::sharedDirector()->getOpenGLView()->setViewPortInPoints(0, 0, winSize.width, winSize.height);
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
ccglOrtho(0, winSize.width, 0, winSize.height, -1024, 1024); ccglOrtho(0, winSize.width, 0, winSize.height, -1024, 1024);
@ -223,8 +225,9 @@ namespace cocos2d
{ {
CCSize winSize = CCDirector::sharedDirector()->getDisplaySizeInPixels(); CCSize winSize = CCDirector::sharedDirector()->getDisplaySizeInPixels();
// glViewport(0, 0, (GLsizei)winSize.width, (GLsizei)winSize.height); // set view port for user FBO, fixed bug #543 #544
CCDirector::sharedDirector()->getOpenGLView()->setViewPortInPoints(0, 0, winSize.width, winSize.height); glViewport(0, 0, (GLsizei)winSize.width, (GLsizei)winSize.height);
// CCDirector::sharedDirector()->getOpenGLView()->setViewPortInPoints(0, 0, winSize.width, winSize.height);
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
gluPerspective(60, (GLfloat)winSize.width/winSize.height, 0.5f, 1500.0f); gluPerspective(60, (GLfloat)winSize.width/winSize.height, 0.5f, 1500.0f);
@ -264,6 +267,8 @@ namespace cocos2d
glBindTexture(GL_TEXTURE_2D, m_pTexture->getName()); glBindTexture(GL_TEXTURE_2D, m_pTexture->getName());
// restore projection for default FBO .fixed bug #543 #544
CCDirector::sharedDirector()->setProjection(CCDirector::sharedDirector()->getProjection());
blit(); blit();
} }