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
339b136d
Commit
339b136d
authored
Jan 16, 2011
by
Martin Flöser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CoverSwitch supports multi screen in GLES.
parent
e59ea71f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
18 deletions
+34
-18
kwin/effects/coverswitch/coverswitch.cpp
kwin/effects/coverswitch/coverswitch.cpp
+34
-18
No files found.
kwin/effects/coverswitch/coverswitch.cpp
View file @
339b136d
...
...
@@ -134,14 +134,13 @@ void CoverSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData&
if
(
mActivated
||
stop
||
stopRequested
)
{
QMatrix4x4
origProjection
;
QMatrix4x4
origModelview
;
ShaderManager
*
shaderManager
=
ShaderManager
::
instance
();
if
(
effects
->
numScreens
()
>
1
)
{
#ifndef KWIN_HAVE_OPENGLES
// unfortunatelly we have to change the projection matrix in dual screen mode
QRect
fullRect
=
effects
->
clientArea
(
FullArea
,
activeScreen
,
effects
->
currentDesktop
()
);
glMatrixMode
(
GL_PROJECTION
);
glPushMatrix
();
glLoadIdentity
();
float
fovy
=
60.0
f
;
float
aspect
=
1.0
f
;
float
zNear
=
0.1
f
;
...
...
@@ -184,12 +183,27 @@ void CoverSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData&
ymaxFactor
=
((
float
)
fullRect
.
height
()
-
(
float
)
area
.
height
()
*
0.5
f
)
/
((
float
)
fullRect
.
height
()
*
0.5
f
);
yTranslate
=
(
float
)
fullRect
.
height
()
*
0.5
f
-
(
float
)
area
.
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
}
}
QList
<
EffectWindow
*
>
tempList
=
currentWindowList
;
int
index
=
tempList
.
indexOf
(
selected_window
);
...
...
@@ -304,14 +318,9 @@ void CoverSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData&
glScissor
(
area
.
x
(),
y
,
area
.
width
(),
area
.
height
()
);
glEnable
(
GL_SCISSOR_TEST
);
ShaderManager
*
shaderManager
=
ShaderManager
::
instance
();
if
(
shaderManager
->
isValid
()
&&
m_reflectionShader
->
isValid
())
{
shaderManager
->
pushShader
(
m_reflectionShader
);
QMatrix4x4
windowTransformation
;
if
(
effects
->
numScreens
()
>
1
&&
area
.
x
()
!=
fullRect
.
x
())
{
// have to change the reflection area in horizontal layout and right screen
windowTransformation
.
translate
(
-
area
.
x
(),
0.0
,
0.0
);
}
windowTransformation
.
translate
(
area
.
x
()
+
area
.
width
()
*
0.5
f
,
0.0
,
0.0
);
m_reflectionShader
->
setUniform
(
"windowTransformation"
,
windowTransformation
);
m_reflectionShader
->
setUniform
(
"u_frontColor"
,
QVector4D
(
mirrorColor
[
0
][
0
],
mirrorColor
[
0
][
1
],
mirrorColor
[
0
][
2
],
mirrorColor
[
0
][
3
]));
...
...
@@ -368,14 +377,21 @@ void CoverSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData&
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
}
}
// Render the caption frame
if
(
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