diff --git a/HelloWorld/proj.win32/HelloWorld.win32.vcproj b/HelloWorld/proj.win32/HelloWorld.win32.vcproj
index a691858006..9dc1b267d0 100644
--- a/HelloWorld/proj.win32/HelloWorld.win32.vcproj
+++ b/HelloWorld/proj.win32/HelloWorld.win32.vcproj
@@ -61,7 +61,7 @@
/>
setViewPortInPoints(0, 0, size.width, size.height);
+ m_pobOpenGLView->setViewPortInPoints(0, 0, sizePoint.width, sizePoint.height);
}
switch (kProjection)
diff --git a/cocos2dx/platform/CCEGLViewProtocol.cpp b/cocos2dx/platform/CCEGLViewProtocol.cpp
index ccf65b5a57..9b0607e532 100644
--- a/cocos2dx/platform/CCEGLViewProtocol.cpp
+++ b/cocos2dx/platform/CCEGLViewProtocol.cpp
@@ -97,6 +97,8 @@ CCSize CCEGLViewProtocol::getSize()
CCSize size;
if (m_bNeedScale)
{
+ // retina and scale mode can't be opened at the same time
+ CCAssert(CC_CONTENT_SCALE_FACTOR() == 1.0f, "retina and scale mode can't be opened at the same time!");
size.setSize(m_sSizeInPoint.width, m_sSizeInPoint.height);
}
else
@@ -135,6 +137,7 @@ void CCEGLViewProtocol::setViewPortInPoints(float x , float y , float w , float
{
if (m_bNeedScale)
{
+ CCAssert(CC_CONTENT_SCALE_FACTOR() == 1.0f, "retina and scale mode can't be opened at the same time!");
float factor = m_fScreenScaleFactor / CC_CONTENT_SCALE_FACTOR();
glViewport((GLint)(x * factor + m_rcViewPort.origin.x),
(GLint)(y * factor + m_rcViewPort.origin.y),
@@ -143,10 +146,11 @@ void CCEGLViewProtocol::setViewPortInPoints(float x , float y , float w , float
}
else
{
- glViewport((GLint)x,
- (GLint)y,
- (GLsizei)w,
- (GLsizei)h);
+ glViewport(
+ (GLint)(x*CC_CONTENT_SCALE_FACTOR()),
+ (GLint)(y*CC_CONTENT_SCALE_FACTOR()),
+ (GLsizei)(w*CC_CONTENT_SCALE_FACTOR()),
+ (GLsizei)(h*CC_CONTENT_SCALE_FACTOR()));
}
}
@@ -154,6 +158,7 @@ void CCEGLViewProtocol::setScissorInPoints(float x , float y , float w , float h
{
if (m_bNeedScale)
{
+ CCAssert(CC_CONTENT_SCALE_FACTOR() == 1.0f, "retina and scale mode can't be opened at the same time!");
float factor = m_fScreenScaleFactor / CC_CONTENT_SCALE_FACTOR();
glScissor((GLint)(x * factor + m_rcViewPort.origin.x),
(GLint)(y * factor + m_rcViewPort.origin.y),
@@ -162,10 +167,11 @@ void CCEGLViewProtocol::setScissorInPoints(float x , float y , float w , float h
}
else
{
- glScissor((GLint)x,
- (GLint)y,
- (GLsizei)w,
- (GLsizei)h);
+ glScissor(
+ (GLint)(x * CC_CONTENT_SCALE_FACTOR()),
+ (GLint)(y * CC_CONTENT_SCALE_FACTOR()),
+ (GLsizei)(w * CC_CONTENT_SCALE_FACTOR()),
+ (GLsizei)(h * CC_CONTENT_SCALE_FACTOR()));
}
}