Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Unmaintained
KDE Workspace
Commits
e59ea71f
Commit
e59ea71f
authored
Jan 16, 2011
by
Martin Flöser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FlipSwitch supports MultiScreen with GLES.
parent
2c5b74b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
14 deletions
+35
-14
kwin/effects/flipswitch/flipswitch.cpp
kwin/effects/flipswitch/flipswitch.cpp
+35
-14
No files found.
kwin/effects/flipswitch/flipswitch.cpp
View file @
e59ea71f
...
...
@@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kwinconfig.h>
#include <QFont>
#include <QMatrix4x4>
#include <kconfiggroup.h>
#include <kdebug.h>
...
...
@@ -234,15 +235,13 @@ void FlipSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData& d
// multiscreen part taken from coverswitch.cpp
// TODO: move to kwinglutils
QMatrix4x4
origProjection
;
QMatrix4x4
origModelview
;
ShaderManager
*
shaderManager
=
ShaderManager
::
instance
();
if
(
effects
->
numScreens
()
>
1
)
{
// TODO: GLES variant
#ifndef KWIN_HAVE_OPENGLES
// unfortunatelly we have to change the projection matrix in dual screen mode
QRect
fullRect
=
effects
->
clientArea
(
FullArea
,
effects
->
activeScreen
(),
effects
->
currentDesktop
()
);
glMatrixMode
(
GL_PROJECTION
);
glPushMatrix
();
glLoadIdentity
();
float
fovy
=
60.0
f
;
float
aspect
=
1.0
f
;
float
zNear
=
0.1
f
;
...
...
@@ -285,12 +284,27 @@ void FlipSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData& d
ymaxFactor
=
((
float
)
fullRect
.
height
()
-
(
float
)
m_screenArea
.
height
()
*
0.5
f
)
/
((
float
)
fullRect
.
height
()
*
0.5
f
);
yTranslate
=
(
float
)
fullRect
.
height
()
*
0.5
f
-
(
float
)
m_screenArea
.
height
()
*
0.5
f
;
}
glFrustum
(
xmin
*
xminFactor
,
xmax
*
xmaxFactor
,
ymin
*
yminFactor
,
ymax
*
ymaxFactor
,
zNear
,
zFar
);
glMatrixMode
(
GL_MODELVIEW
);
glPushMatrix
();
glTranslatef
(
xTranslate
,
yTranslate
,
0.0
);
QMatrix4x4
projection
;
projection
.
frustum
(
xmin
*
xminFactor
,
xmax
*
xmaxFactor
,
ymin
*
yminFactor
,
ymax
*
ymaxFactor
,
zNear
,
zFar
);
QMatrix4x4
modelview
;
modelview
.
translate
(
xTranslate
,
yTranslate
,
0.0
);
if
(
shaderManager
->
isShaderBound
())
{
GLShader
*
shader
=
shaderManager
->
pushShader
(
ShaderManager
::
GenericShader
);
origProjection
=
shader
->
getUniformMatrix4x4
(
"projection"
);
origModelview
=
shader
->
getUniformMatrix4x4
(
"modelview"
);
shader
->
setUniform
(
"projection"
,
projection
);
shader
->
setUniform
(
"modelview"
,
origModelview
*
modelview
);
shaderManager
->
popShader
();
}
else
{
#ifndef KWIN_HAVE_OPENGLES
glMatrixMode
(
GL_PROJECTION
);
pushMatrix
();
loadMatrix
(
projection
);
glMatrixMode
(
GL_MODELVIEW
);
pushMatrix
(
modelview
);
#endif
}
}
int
winMask
=
PAINT_WINDOW_TRANSFORMED
|
PAINT_WINDOW_TRANSLUCENT
;
RotationData
rot
;
...
...
@@ -402,14 +416,21 @@ void FlipSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData& d
if
(
effects
->
numScreens
()
>
1
)
{
if
(
shaderManager
->
isShaderBound
())
{
GLShader
*
shader
=
shaderManager
->
pushShader
(
ShaderManager
::
GenericShader
);
shader
->
setUniform
(
"projection"
,
origProjection
);
shader
->
setUniform
(
"modelview"
,
origModelview
);
shaderManager
->
popShader
();
}
else
{
#ifndef KWIN_HAVE_OPENGLES
glP
opMatrix
();
// revert change of projection matrix
glMatrixMode
(
GL_PROJECTION
);
glP
opMatrix
();
glMatrixMode
(
GL_MODELVIEW
);
p
opMatrix
();
// revert change of projection matrix
glMatrixMode
(
GL_PROJECTION
);
p
opMatrix
();
glMatrixMode
(
GL_MODELVIEW
);
#endif
}
}
if
(
m_windowTitle
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment