mirror of https://github.com/axmolengine/axmol.git
issue #1177: fixed a bug about retina in CCDirector.
This commit is contained in:
parent
521155e9e2
commit
8fd3518160
|
@ -328,7 +328,7 @@ void CCDirector::setNextDeltaTimeZero(bool bNextDeltaTimeZero)
|
||||||
void CCDirector::setProjection(ccDirectorProjection kProjection)
|
void CCDirector::setProjection(ccDirectorProjection kProjection)
|
||||||
{
|
{
|
||||||
CCSize size = m_obWinSizeInPixels;
|
CCSize size = m_obWinSizeInPixels;
|
||||||
//CCSize sizePoint = m_obWinSizeInPoints;
|
CCSize sizePoint = m_obWinSizeInPoints;
|
||||||
|
|
||||||
//glViewport(0, 0, size.width * CC_CONTENT_SCALE_FACTOR(), size.height * CC_CONTENT_SCALE_FACTOR() );
|
//glViewport(0, 0, size.width * CC_CONTENT_SCALE_FACTOR(), size.height * CC_CONTENT_SCALE_FACTOR() );
|
||||||
if (m_pobOpenGLView)
|
if (m_pobOpenGLView)
|
||||||
|
@ -354,6 +354,12 @@ void CCDirector::setProjection(ccDirectorProjection kProjection)
|
||||||
|
|
||||||
case kCCDirectorProjection3D:
|
case kCCDirectorProjection3D:
|
||||||
{
|
{
|
||||||
|
// reset the viewport if 3d proj & retina display
|
||||||
|
if( CC_CONTENT_SCALE_FACTOR() != 1.0f )
|
||||||
|
{
|
||||||
|
glViewport(-size.width/2, -size.height/2, size.width * CC_CONTENT_SCALE_FACTOR(), size.height * CC_CONTENT_SCALE_FACTOR() );
|
||||||
|
}
|
||||||
|
|
||||||
float zeye = this->getZEye();
|
float zeye = this->getZEye();
|
||||||
|
|
||||||
kmMat4 matrixPerspective, matrixLookup;
|
kmMat4 matrixPerspective, matrixLookup;
|
||||||
|
@ -377,8 +383,8 @@ void CCDirector::setProjection(ccDirectorProjection kProjection)
|
||||||
kmGLMatrixMode(KM_GL_MODELVIEW);
|
kmGLMatrixMode(KM_GL_MODELVIEW);
|
||||||
kmGLLoadIdentity();
|
kmGLLoadIdentity();
|
||||||
kmVec3 eye, center, up;
|
kmVec3 eye, center, up;
|
||||||
kmVec3Fill( &eye, size.width/2, size.height/2, zeye );
|
kmVec3Fill( &eye, sizePoint.width/2, sizePoint.height/2, zeye );
|
||||||
kmVec3Fill( ¢er, size.width/2, size.height/2, 0.0f );
|
kmVec3Fill( ¢er, sizePoint.width/2, sizePoint.height/2, 0.0f );
|
||||||
kmVec3Fill( &up, 0.0f, 1.0f, 0.0f);
|
kmVec3Fill( &up, 0.0f, 1.0f, 0.0f);
|
||||||
kmMat4LookAt(&matrixLookup, &eye, ¢er, &up);
|
kmMat4LookAt(&matrixLookup, &eye, ¢er, &up);
|
||||||
kmGLMultMatrix(&matrixLookup);
|
kmGLMultMatrix(&matrixLookup);
|
||||||
|
|
|
@ -503,7 +503,7 @@ void CCEGLView::setContentScaleFactor(float contentScaleFactor)
|
||||||
{
|
{
|
||||||
CCEGLViewProtocol::setContentScaleFactor(contentScaleFactor);
|
CCEGLViewProtocol::setContentScaleFactor(contentScaleFactor);
|
||||||
|
|
||||||
resize((int)(m_sSizeInPoint.width * contentScaleFactor), (int)(m_sSizeInPoint.height * contentScaleFactor));
|
resize((int)(m_sSizeInPixel.width * contentScaleFactor), (int)(m_sSizeInPixel.height * contentScaleFactor));
|
||||||
centerWindow();
|
centerWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue