fixed #1522: CCEGLView class of desktop platforms should override CCEGLViewProtocol::setScissorInPoints.

This commit is contained in:
James Chen 2012-10-24 10:03:19 +08:00
parent 0fd3a541f2
commit c797af0fe9
6 changed files with 32 additions and 0 deletions

View File

@ -261,6 +261,15 @@ void CCEGLView::setViewPortInPoints(float x , float y , float w , float h)
(GLsizei)(h * m_fScaleY * m_fFrameZoomFactor));
}
void CCEGLView::setScissorInPoints(float x , float y , float w , float h)
{
glScissor((GLint)(x * m_fScaleX * m_fFrameZoomFactor + m_obViewPortRect.origin.x * m_fFrameZoomFactor),
(GLint)(y * m_fScaleY * m_fFrameZoomFactor + m_obViewPortRect.origin.y * m_fFrameZoomFactor),
(GLsizei)(w * m_fScaleX * m_fFrameZoomFactor),
(GLsizei)(h * m_fScaleY * m_fFrameZoomFactor));
}
bool CCEGLView::isOpenGLReady()
{
return bIsInit;

View File

@ -33,6 +33,8 @@ public:
*/
virtual void setFrameSize(float width, float height);
virtual void setViewPortInPoints(float x , float y , float w , float h);
virtual void setScissorInPoints(float x , float y , float w , float h);
/*
* Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop.
*/

View File

@ -49,6 +49,7 @@ public:
* Set opengl view port rectangle with points.
*/
virtual void setViewPortInPoints(float x , float y , float w , float h);
virtual void setScissorInPoints(float x , float y , float w , float h);
virtual void setIMEKeyboardState(bool bOpen);
virtual void setMultiTouchMask(bool mask);

View File

@ -98,6 +98,16 @@ void CCEGLView::setViewPortInPoints(float x , float y , float w , float h)
(GLsizei)(h * m_fScaleY * frameZoomFactor));
}
void CCEGLView::setScissorInPoints(float x , float y , float w , float h)
{
float frameZoomFactor = [[EAGLView sharedEGLView] frameZoomFactor];
glScissor((GLint)(x * m_fScaleX * frameZoomFactor + m_obViewPortRect.origin.x * frameZoomFactor),
(GLint)(y * m_fScaleY * frameZoomFactor + m_obViewPortRect.origin.y * frameZoomFactor),
(GLsizei)(w * m_fScaleX * frameZoomFactor),
(GLsizei)(h * m_fScaleY * frameZoomFactor));
}
void CCEGLView::setMultiTouchMask(bool mask)
{
//EAGLView *glView = [EAGLView sharedEGLView];

View File

@ -697,6 +697,14 @@ void CCEGLView::setViewPortInPoints(float x , float y , float w , float h)
(GLsizei)(h * m_fScaleY * m_fFrameZoomFactor));
}
void CCEGLView::setScissorInPoints(float x , float y , float w , float h)
{
glScissor((GLint)(x * m_fScaleX * m_fFrameZoomFactor + m_obViewPortRect.origin.x * m_fFrameZoomFactor),
(GLint)(y * m_fScaleY * m_fFrameZoomFactor + m_obViewPortRect.origin.y * m_fFrameZoomFactor),
(GLsizei)(w * m_fScaleX * m_fFrameZoomFactor),
(GLsizei)(h * m_fScaleY * m_fFrameZoomFactor));
}
CCEGLView* CCEGLView::sharedOpenGLView()
{
static CCEGLView* s_pEglView = NULL;

View File

@ -73,6 +73,8 @@ public:
void setAccelerometerKeyHook( LPFN_ACCELEROMETER_KEYHOOK lpfnAccelerometerKeyHook );
virtual void setViewPortInPoints(float x , float y , float w , float h);
virtual void setScissorInPoints(float x , float y , float w , float h);
// static function
/**
@brief get the shared main open gl window