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
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="libcocos2d.lib"
|
AdditionalDependencies="opengl32.lib glew32.lib libcocos2d.lib"
|
||||||
OutputFile="$(OutDir)\$(ProjectName).exe"
|
OutputFile="$(OutDir)\$(ProjectName).exe"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
AdditionalLibraryDirectories="$(OutDir)"
|
AdditionalLibraryDirectories="$(OutDir)"
|
||||||
|
@ -138,7 +138,7 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="libcocos2d.lib"
|
AdditionalDependencies="opengl32.lib glew32.lib libcocos2d.lib"
|
||||||
OutputFile="$(OutDir)\$(ProjectName).exe"
|
OutputFile="$(OutDir)\$(ProjectName).exe"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
AdditionalLibraryDirectories="$(OutDir)"
|
AdditionalLibraryDirectories="$(OutDir)"
|
||||||
|
|
|
@ -336,10 +336,9 @@ 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() );
|
|
||||||
if (m_pobOpenGLView)
|
if (m_pobOpenGLView)
|
||||||
{
|
{
|
||||||
m_pobOpenGLView->setViewPortInPoints(0, 0, size.width, size.height);
|
m_pobOpenGLView->setViewPortInPoints(0, 0, sizePoint.width, sizePoint.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (kProjection)
|
switch (kProjection)
|
||||||
|
|
|
@ -97,6 +97,8 @@ CCSize CCEGLViewProtocol::getSize()
|
||||||
CCSize size;
|
CCSize size;
|
||||||
if (m_bNeedScale)
|
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);
|
size.setSize(m_sSizeInPoint.width, m_sSizeInPoint.height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -135,6 +137,7 @@ void CCEGLViewProtocol::setViewPortInPoints(float x , float y , float w , float
|
||||||
{
|
{
|
||||||
if (m_bNeedScale)
|
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();
|
float factor = m_fScreenScaleFactor / CC_CONTENT_SCALE_FACTOR();
|
||||||
glViewport((GLint)(x * factor + m_rcViewPort.origin.x),
|
glViewport((GLint)(x * factor + m_rcViewPort.origin.x),
|
||||||
(GLint)(y * factor + m_rcViewPort.origin.y),
|
(GLint)(y * factor + m_rcViewPort.origin.y),
|
||||||
|
@ -143,10 +146,11 @@ void CCEGLViewProtocol::setViewPortInPoints(float x , float y , float w , float
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glViewport((GLint)x,
|
glViewport(
|
||||||
(GLint)y,
|
(GLint)(x*CC_CONTENT_SCALE_FACTOR()),
|
||||||
(GLsizei)w,
|
(GLint)(y*CC_CONTENT_SCALE_FACTOR()),
|
||||||
(GLsizei)h);
|
(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)
|
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();
|
float factor = m_fScreenScaleFactor / CC_CONTENT_SCALE_FACTOR();
|
||||||
glScissor((GLint)(x * factor + m_rcViewPort.origin.x),
|
glScissor((GLint)(x * factor + m_rcViewPort.origin.x),
|
||||||
(GLint)(y * factor + m_rcViewPort.origin.y),
|
(GLint)(y * factor + m_rcViewPort.origin.y),
|
||||||
|
@ -162,10 +167,11 @@ void CCEGLViewProtocol::setScissorInPoints(float x , float y , float w , float h
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glScissor((GLint)x,
|
glScissor(
|
||||||
(GLint)y,
|
(GLint)(x * CC_CONTENT_SCALE_FACTOR()),
|
||||||
(GLsizei)w,
|
(GLint)(y * CC_CONTENT_SCALE_FACTOR()),
|
||||||
(GLsizei)h);
|
(GLsizei)(w * CC_CONTENT_SCALE_FACTOR()),
|
||||||
|
(GLsizei)(h * CC_CONTENT_SCALE_FACTOR()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue