[SailfishDevel] Landscape mode in Sailfish?
Iosif Hamlatzis
i.hamlatzis at gmail.com
Mon Apr 7 11:00:24 UTC 2014
ok I have managed to rotate my display and convert the touch co-ordinates
but I have a lot flashes on the screen. I presume it has to do with the
call to glScissor
At some places in my code I call glScissor and glGetIntegerv modify and
retrieve the scissor box. If I don't call these there is no problem I have
no flashes but obviously my rendering is wrong as I render outside my
rectangle.
Does the rotation matrix (either in projection or model view mode) affect
the glScissor and glGetIntegerv calls or do I have to manually calculate
the rotation for the scissor box?
The code I use for scissoring is:
//---------------------------------------------------------------------------------------------------------
RECT Presenter::ClippingRegion() const
{
RECT rc;
SetRect( &rc, 0, 0, mnScreenWidth, mnScreenHeight);
if ( glIsEnabled(GL_SCISSOR_TEST) )
{
GLint clip[4];
glGetIntegerv( GL_SCISSOR_BOX, &(clip[0]) );
SetRect( &rc, clip[0], clip[1], (clip[0]+clip[2]), (clip[1]+clip[3] );
}
return rc;
}
//---------------------------------------------------------------------------------------------------------
void Presenter::ClippingRegion(const RECT& rc)
{
glEnable( GL_SCISSOR_TEST );
GLsizei width = rc.right - rc.left;
GLsizei height = rc.bottom - rc.top;
GLint x = rc.left;
GLint y = rc.top;
GLint y_modified = mnScreenHeight-(y+height);
glScissor(x, y_modified, width, height);
}
Where in the above code RECT is a struct similar to Microsoft's RECT and
SetRect(left, top, right, bottom) is a function similar to Microsoft's for
setting left, top, right and bottom co-ordinates for a RECT.
So do I have to calculate the rotation for the parameters or is it
automatically done by the rotation matrix?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20140407/a66dbaed/attachment.html>
More information about the Devel
mailing list