mirror of https://github.com/axmolengine/axmol.git
fixed #1301: CCEGLView::sharedOpenGLView().setScissorInPoints() should apply scissor in points.
This commit is contained in:
parent
d827cdacc0
commit
2238db301b
|
@ -61,7 +61,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libcocos2d.lib"
|
||||
AdditionalDependencies="opengl32.lib glew32.lib libcocos2d.lib"
|
||||
OutputFile="$(OutDir)\$(ProjectName).exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="$(OutDir)"
|
||||
|
@ -138,7 +138,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libcocos2d.lib"
|
||||
AdditionalDependencies="opengl32.lib glew32.lib libcocos2d.lib"
|
||||
OutputFile="$(OutDir)\$(ProjectName).exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="$(OutDir)"
|
||||
|
|
|
@ -336,10 +336,9 @@ void CCDirector::setProjection(ccDirectorProjection kProjection)
|
|||
CCSize size = m_obWinSizeInPixels;
|
||||
CCSize sizePoint = m_obWinSizeInPoints;
|
||||
|
||||
//glViewport(0, 0, size.width * CC_CONTENT_SCALE_FACTOR(), size.height * CC_CONTENT_SCALE_FACTOR() );
|
||||
if (m_pobOpenGLView)
|
||||
{
|
||||
m_pobOpenGLView->setViewPortInPoints(0, 0, size.width, size.height);
|
||||
m_pobOpenGLView->setViewPortInPoints(0, 0, sizePoint.width, sizePoint.height);
|
||||
}
|
||||
|
||||
switch (kProjection)
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue