Merge lp:~compiz-linaro-team/compiz/gles2 into lp:compiz/0.9.8
- gles2
- Merge into 0.9.8
Status: | Merged | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Approved by: | Sam Spilsbury | ||||||||||||||||||||||||||||
Approved revision: | 3378 | ||||||||||||||||||||||||||||
Merged at revision: | 3320 | ||||||||||||||||||||||||||||
Proposed branch: | lp:~compiz-linaro-team/compiz/gles2 | ||||||||||||||||||||||||||||
Merge into: | lp:compiz/0.9.8 | ||||||||||||||||||||||||||||
Diff against target: |
16838 lines (+7498/-4718) 104 files modified
cmake/CMakeLists.txt (+2/-0) cmake/CompizCommon.cmake (+12/-0) cmake/CompizPlugin.cmake (+14/-10) cmake/FindCompiz.cmake (+1/-1) cmake/FindOpenGLES2.cmake (+51/-0) cmake/base.cmake (+3/-0) cmake/plugin_extensions/CompizOpenGLFixups.cmake (+22/-0) include/core/wrapsystem.h (+8/-0) plugins/CMakeLists.txt (+30/-0) plugins/animation/CMakeLists.txt (+3/-5) plugins/animation/include/animation/animation.h (+1/-1) plugins/animation/include/animation/animeffect.h (+3/-3) plugins/animation/include/animation/grid.h (+0/-2) plugins/animation/src/animation.cpp (+85/-27) plugins/animation/src/grid.cpp (+25/-258) plugins/animation/src/private.h (+3/-3) plugins/annotate/src/annotate.cpp (+149/-71) plugins/blur/CMakeLists.txt (+12/-12) plugins/clone/src/clone.cpp (+0/-5) plugins/compiztoolbox/src/compiztoolbox.cpp (+5/-18) plugins/copytex/src/copytex.cpp (+9/-0) plugins/cube/include/cube/cube.h (+9/-6) plugins/cube/src/cube.cpp (+85/-80) plugins/decor/src/decor.cpp (+29/-27) plugins/decor/src/decor.h (+2/-2) plugins/expo/CMakeLists.txt (+4/-8) plugins/expo/src/expo.cpp (+256/-111) plugins/expo/src/expo.h (+3/-4) plugins/ezoom/src/ezoom.cpp (+118/-52) plugins/grid/src/grid.cpp (+108/-53) plugins/imgsvg/src/imgsvg.cpp (+9/-6) plugins/imgsvg/src/imgsvg.h (+2/-1) plugins/kdecompat/src/kdecompat.cpp (+7/-22) plugins/mag/src/mag.cpp (+102/-73) plugins/mag/src/mag.h (+2/-0) plugins/neg/src/neg.cpp (+33/-106) plugins/neg/src/neg.h (+3/-6) plugins/obs/src/obs.cpp (+8/-7) plugins/obs/src/obs.h (+1/-1) plugins/opengl/CMakeLists.txt (+14/-4) plugins/opengl/compiz-opengl.pc.in (+1/-1) plugins/opengl/include/opengl/doublebuffer.h (+39/-0) plugins/opengl/include/opengl/fragment.h (+0/-125) plugins/opengl/include/opengl/framebufferobject.h (+104/-0) plugins/opengl/include/opengl/matrix.h (+2/-0) plugins/opengl/include/opengl/opengl.h (+441/-73) plugins/opengl/include/opengl/program.h (+75/-0) plugins/opengl/include/opengl/programcache.h (+51/-0) plugins/opengl/include/opengl/shadercache.h (+100/-0) plugins/opengl/include/opengl/texture.h (+5/-0) plugins/opengl/include/opengl/vector.h (+3/-3) plugins/opengl/include/opengl/vertexbuffer.h (+130/-0) plugins/opengl/opengl.xml.in (+15/-0) plugins/opengl/src/doublebuffer/CMakeLists.txt (+31/-0) plugins/opengl/src/doublebuffer/src/double-buffer.cpp (+76/-0) plugins/opengl/src/doublebuffer/tests/CMakeLists.txt (+24/-0) plugins/opengl/src/doublebuffer/tests/test-opengl-double-buffer.cpp (+98/-0) plugins/opengl/src/fragment.cpp (+0/-1146) plugins/opengl/src/framebufferobject.cpp (+221/-0) plugins/opengl/src/matrix.cpp (+54/-0) plugins/opengl/src/paint.cpp (+472/-443) plugins/opengl/src/privatefragment.h (+0/-54) plugins/opengl/src/privates.h (+101/-13) plugins/opengl/src/privatetexture.h (+32/-0) plugins/opengl/src/privatevertexbuffer.h (+149/-0) plugins/opengl/src/program.cpp (+262/-0) plugins/opengl/src/programcache.cpp (+175/-0) plugins/opengl/src/screen.cpp (+938/-154) plugins/opengl/src/shadercache.cpp (+246/-0) plugins/opengl/src/texture.cpp (+152/-22) plugins/opengl/src/vector.cpp (+2/-2) plugins/opengl/src/vertexbuffer.cpp (+634/-0) plugins/opengl/src/window.cpp (+65/-83) plugins/resize/src/resize.cpp (+84/-31) plugins/resizeinfo/src/resizeinfo.cpp (+45/-27) plugins/resizeinfo/src/resizeinfo.h (+2/-1) plugins/ring/src/ring.cpp (+19/-37) plugins/ring/src/ring.h (+1/-1) plugins/scale/src/scale.cpp (+10/-17) plugins/scaleaddon/src/scaleaddon.cpp (+51/-21) plugins/scaleaddon/src/scaleaddon.h (+2/-2) plugins/scalefilter/src/scalefilter.cpp (+1/-6) plugins/screenshot/src/screenshot.cpp (+47/-20) plugins/shift/src/shift.cpp (+95/-98) plugins/shift/src/shift.h (+1/-1) plugins/staticswitcher/src/staticswitcher.cpp (+156/-64) plugins/staticswitcher/src/staticswitcher.h (+5/-3) plugins/switcher/src/switcher.cpp (+45/-42) plugins/text/include/text/text.h (+2/-1) plugins/text/src/text.cpp (+53/-24) plugins/thumbnail/src/thumbnail.cpp (+301/-118) plugins/thumbnail/src/thumbnail.h (+3/-1) plugins/wall/src/wall.cpp (+60/-46) plugins/wall/src/wall.h (+1/-1) plugins/water/src/shaders.h (+200/-0) plugins/water/src/water.cpp (+281/-801) plugins/water/src/water.h (+33/-63) plugins/water/water.xml.in (+26/-2) plugins/wobbly/src/wobbly.cpp (+20/-176) plugins/wobbly/src/wobbly.h (+0/-1) plugins/workarounds/src/workarounds.cpp (+14/-0) plugins/workarounds/src/workarounds.h (+4/-0) plugins/workspacenames/src/workspacenames.cpp (+4/-8) plugins/workspacenames/src/workspacenames.h (+1/-1) |
||||||||||||||||||||||||||||
To merge this branch: | bzr merge lp:~compiz-linaro-team/compiz/gles2 | ||||||||||||||||||||||||||||
Related bugs: |
|
||||||||||||||||||||||||||||
Related blueprints: |
Compiz GLES2 Handover
(Undefined)
Compiz GLES2 Handover
(Undefined)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel van Vugt | Approve | ||
Sam Spilsbury | Approve | ||
Tim Penhey | Pending | ||
Alan Griffiths | Pending | ||
jenkins | continuous-integration | Pending | |
Review via email: mp+120361@code.launchpad.net |
This proposal supersedes a proposal from 2012-08-10.
Commit message
This branch contains the code to make compiz work on GLES. This includes
several changes to the compiz API.
* GLVertexBuffer class added for managing vertices, normals, texture
coordinates, and colors
* GLProgram class added for managing GLSL programs
* GLProgramCache class added for managing per-plugin GLSL programs
efficiently, uses an LRU cache to avoid recompiling recently used GLSL
programs all the time
* GLShaderCache class added for managing dynamically created shader source
code.
* GLFragment class removed as fragment programs are no longer used (replaced
with GLSL programs)
* EGL context setup added
* EglTexture class added to use EGL_image extension instead of
GLX_EXT_
Description of the change
WARNING: The Preview diff is incomplete due to Launchpad limitations. Please click Download diff to get the whole thing.
BUGS: Yes, there a quite a few still but I think they're acceptable now. The full list of known bugs in this branch is: https:/
and the bugs it causes in Unity:
https:/
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Thanks Sam. Please try to keep your comments a manageable size. Or make each point in a new comment.
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Initially I thought *project should go in GLMatrix too. However then I cleaned up project() and realized it should not be using GLMatrix. It looks like unproject similarly should not be using GLMatrix. Though *project() should probably live somewhere in the opengl plugin, I agree.
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Set to work in progress again.
We cannot realistically consider merging this until the incompatibilities with Unity are also fixed:
https:/
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
> 2. It's ugly, bad design. Member data should not be repeatedly passed as
a parameter. I know there is a limitation in the current wrapping/
interface design that makes it impossible to access vertexBuffer as a
member, but that's no excuse for making the code worse than it already
was.
Can you clarify this please? It didn't come up in the original review and I'm suprised you've put it as a reason for reverting it now.
While passing member data through function arguments is not great, it at least restricts the scope in which that data can be accessed, which is the correct thing to do.
I can understand reverting it in the meantime because unity is difficult to port with ifdefs, but if you're going to do so please consult with the person who wrote it (who happens to live in the same timezone as you, so its really not an issue to do so) for advice on how to handle it rather than taking the unilateral approach of just reverting code.
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
I was extremely frustrated yesterday and just wanted the code to build. I wasn't feeling like consulting.
Sorry, I thought it did come up in the original review. I was thinking it all along but (as usual) failed to articulate all of my thoughts into words.
It's foreseeable that I will approve the changes again. But not until Unity has been updated to support them first. That would be enclosed in "#if COMPIZ_OPENGL_ABI >= 6", I imagine.
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
> I was extremely frustrated yesterday and just wanted the code to build. I
> wasn't feeling like consulting.
>
> Sorry, I thought it did come up in the original review. I was thinking it all
> along but (as usual) failed to articulate all of my thoughts into words.
>
> It's foreseeable that I will approve the changes again. But not until Unity
> has been updated to support them first. That would be enclosed in "#if
> COMPIZ_OPENGL_ABI >= 6", I imagine.
Okay, thanks. Noted, will re-propose the unrevert of those changes at an appropriate time.
Cheers,
Sam
Daniel van Vugt (vanvugt) wrote : | # |
OK, I /think/ the worst of the Unity regressions are now fixed, or at least with fixes proposed:
https:/
Let's open this for review again. But be aware I may not action some of the optional cleanups (already mentioned) before this branch lands.
Omer Akram (om26er) wrote : | # |
Nice work btw, working through all those regression along the way :-)
Sam Spilsbury (smspillaz) wrote : | # |
Tested on nouveau, intel and ongoing testing was done on ARM/PowerVR too.
I'm happy enough for this to go in as-is, obviously it isn't yet release quality, however we need to put it in before feature freeze.
Things I would like to see actioned during the rest of the release period.
1. Tests. Tests. Tests
a. Specifically on the behaviour of GLVertexBuffer, GLFramebufferObject and GLShaderCache
b. No need for test coverage on areas where the API changed
2. GLVertexBuffer begin/end - that's bad design we need to fix it
3. Need to remove direct access to GLVertexBuffer in GLWindow
4. Sort out the mipmapping story on mesa drivers (add a driver workaround?)
5. project/unproject need to go somewhere common
6. Port/Drop blur
7. Port the rest of mag.
8. compiz-
9. Remove spurious ifdefs
10. Remove the options to control rendering features.
Daniel van Vugt (vanvugt) wrote : | # |
A couple of new blockers were found/introduced today :(
Daniel van Vugt (vanvugt) wrote : | # |
Daniel van Vugt (vanvugt) : | # |
Unity Merger (unity-merger) wrote : | # |
The Jenkins job https:/
Not merging it.
Preview Diff
1 | === modified file 'cmake/CMakeLists.txt' | |||
2 | --- cmake/CMakeLists.txt 2012-07-29 03:23:28 +0000 | |||
3 | +++ cmake/CMakeLists.txt 2012-08-22 06:16:22 +0000 | |||
4 | @@ -17,6 +17,8 @@ | |||
5 | 17 | plugin_extensions/CompizGenInstallData.cmake) | 17 | plugin_extensions/CompizGenInstallData.cmake) |
6 | 18 | list (APPEND _PluginExtensionFiles | 18 | list (APPEND _PluginExtensionFiles |
7 | 19 | plugin_extensions/CompizGenInstallImages.cmake) | 19 | plugin_extensions/CompizGenInstallImages.cmake) |
8 | 20 | list (APPEND _PluginExtensionFiles | ||
9 | 21 | plugin_extensions/CompizOpenGLFixups.cmake) | ||
10 | 20 | 22 | ||
11 | 21 | if (USE_GCONF) | 23 | if (USE_GCONF) |
12 | 22 | list (APPEND _files CompizGconf.cmake) | 24 | list (APPEND _files CompizGconf.cmake) |
13 | 23 | 25 | ||
14 | === modified file 'cmake/CompizCommon.cmake' | |||
15 | --- cmake/CompizCommon.cmake 2012-08-16 03:24:02 +0000 | |||
16 | +++ cmake/CompizCommon.cmake 2012-08-22 06:16:22 +0000 | |||
17 | @@ -18,6 +18,7 @@ | |||
18 | 18 | 18 | ||
19 | 19 | set (CMAKE_SKIP_RPATH FALSE) | 19 | set (CMAKE_SKIP_RPATH FALSE) |
20 | 20 | 20 | ||
21 | 21 | option (BUILD_GLES "Build against GLESv2 instead of GL" OFF) | ||
22 | 21 | option (COMPIZ_BUILD_WITH_RPATH "Leave as ON unless building packages" ON) | 22 | option (COMPIZ_BUILD_WITH_RPATH "Leave as ON unless building packages" ON) |
23 | 22 | option (COMPIZ_RUN_LDCONFIG "Leave OFF unless you need to run ldconfig after install") | 23 | option (COMPIZ_RUN_LDCONFIG "Leave OFF unless you need to run ldconfig after install") |
24 | 23 | option (COMPIZ_PACKAGING_ENABLED "Enable to manually set prefix, exec_prefix, libdir, includedir, datadir" OFF) | 24 | option (COMPIZ_PACKAGING_ENABLED "Enable to manually set prefix, exec_prefix, libdir, includedir, datadir" OFF) |
25 | @@ -70,6 +71,17 @@ | |||
26 | 70 | set(IS_BZR_REPO 0) | 71 | set(IS_BZR_REPO 0) |
27 | 71 | endif (IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.bzr) | 72 | endif (IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.bzr) |
28 | 72 | 73 | ||
29 | 74 | set (USE_GLES ${BUILD_GLES}) | ||
30 | 75 | |||
31 | 76 | if (USE_GLES) | ||
32 | 77 | find_package(OpenGLES2) | ||
33 | 78 | |||
34 | 79 | if (NOT OPENGLES2_FOUND) | ||
35 | 80 | set (USE_GLES 0) | ||
36 | 81 | message (SEND_ERROR "OpenGLESv2 not found") | ||
37 | 82 | endif (NOT OPENGLES2_FOUND) | ||
38 | 83 | endif (USE_GLES) | ||
39 | 84 | |||
40 | 73 | # Parse arguments passed to a function into several lists separated by | 85 | # Parse arguments passed to a function into several lists separated by |
41 | 74 | # upper-case identifiers and options that do not have an associated list e.g.: | 86 | # upper-case identifiers and options that do not have an associated list e.g.: |
42 | 75 | # | 87 | # |
43 | 76 | 88 | ||
44 | === modified file 'cmake/CompizPlugin.cmake' | |||
45 | --- cmake/CompizPlugin.cmake 2012-05-24 00:55:17 +0000 | |||
46 | +++ cmake/CompizPlugin.cmake 2012-08-22 06:16:22 +0000 | |||
47 | @@ -257,6 +257,16 @@ | |||
48 | 257 | NO_DEFAULT_PATH | 257 | NO_DEFAULT_PATH |
49 | 258 | ) | 258 | ) |
50 | 259 | 259 | ||
51 | 260 | set (COMPIZ_CURRENT_PLUGIN ${plugin}) | ||
52 | 261 | set (COMPIZ_CURRENT_XML_FILE ${_translated_xml}) | ||
53 | 262 | |||
54 | 263 | # find extension files | ||
55 | 264 | file (GLOB _extension_files "${COMPIZ_CMAKE_MODULE_PATH}/plugin_extensions/*.cmake") | ||
56 | 265 | |||
57 | 266 | foreach (_file ${_extension_files}) | ||
58 | 267 | include (${_file}) | ||
59 | 268 | endforeach () | ||
60 | 269 | |||
61 | 260 | # generate pkgconfig file and install it and the plugin header file | 270 | # generate pkgconfig file and install it and the plugin header file |
62 | 261 | if (_${plugin}_pkg AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include/${plugin}) | 271 | if (_${plugin}_pkg AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include/${plugin}) |
63 | 262 | if ("${PLUGIN_BUILDTYPE}" STREQUAL "local") | 272 | if ("${PLUGIN_BUILDTYPE}" STREQUAL "local") |
64 | @@ -269,11 +279,15 @@ | |||
65 | 269 | set (VERSION 0.0.1-git) | 279 | set (VERSION 0.0.1-git) |
66 | 270 | endif (NOT VERSION) | 280 | endif (NOT VERSION) |
67 | 271 | 281 | ||
68 | 282 | #add CFLAGSADD so pkg-config file has correct flags | ||
69 | 283 | set (COMPIZ_CFLAGS ${COMPIZ_CFLAGS} ${${_PLUGIN}_CFLAGSADD}) | ||
70 | 284 | |||
71 | 272 | compiz_configure_file ( | 285 | compiz_configure_file ( |
72 | 273 | ${_${plugin}_pkg} | 286 | ${_${plugin}_pkg} |
73 | 274 | ${CMAKE_BINARY_DIR}/generated/compiz-${plugin}.pc | 287 | ${CMAKE_BINARY_DIR}/generated/compiz-${plugin}.pc |
74 | 275 | COMPIZ_REQUIRES | 288 | COMPIZ_REQUIRES |
75 | 276 | COMPIZ_CFLAGS | 289 | COMPIZ_CFLAGS |
76 | 290 | PKGCONFIG_LIBS | ||
77 | 277 | ) | 291 | ) |
78 | 278 | 292 | ||
79 | 279 | install ( | 293 | install ( |
80 | @@ -287,16 +301,6 @@ | |||
81 | 287 | endif () | 301 | endif () |
82 | 288 | endif () | 302 | endif () |
83 | 289 | 303 | ||
84 | 290 | set (COMPIZ_CURRENT_PLUGIN ${plugin}) | ||
85 | 291 | set (COMPIZ_CURRENT_XML_FILE ${_translated_xml}) | ||
86 | 292 | |||
87 | 293 | # find extension files | ||
88 | 294 | file (GLOB _extension_files "${COMPIZ_CMAKE_MODULE_PATH}/plugin_extensions/*.cmake") | ||
89 | 295 | |||
90 | 296 | foreach (_file ${_extension_files}) | ||
91 | 297 | include (${_file}) | ||
92 | 298 | endforeach () | ||
93 | 299 | |||
94 | 300 | # find files for build | 304 | # find files for build |
95 | 301 | file (GLOB _h_files "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h") | 305 | file (GLOB _h_files "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h") |
96 | 302 | file (GLOB _h_ins_files "${CMAKE_CURRENT_SOURCE_DIR}/include/${plugin}/*.h") | 306 | file (GLOB _h_ins_files "${CMAKE_CURRENT_SOURCE_DIR}/include/${plugin}/*.h") |
97 | 303 | 307 | ||
98 | === modified file 'cmake/FindCompiz.cmake' | |||
99 | --- cmake/FindCompiz.cmake 2012-07-29 03:23:28 +0000 | |||
100 | +++ cmake/FindCompiz.cmake 2012-08-22 06:16:22 +0000 | |||
101 | @@ -89,7 +89,7 @@ | |||
102 | 89 | if (COMPIZ_FOUND AND _compiz_def_macro) | 89 | if (COMPIZ_FOUND AND _compiz_def_macro) |
103 | 90 | # everything found. Set module path and include defaults module | 90 | # everything found. Set module path and include defaults module |
104 | 91 | set (COMPIZ_CMAKE_MODULE_PATH ${COMPIZ_PREFIX}/share/compiz/cmake) | 91 | set (COMPIZ_CMAKE_MODULE_PATH ${COMPIZ_PREFIX}/share/compiz/cmake) |
106 | 92 | set (CMAKE_MODULE_PATH ${COMPIZ_CMAKE_MODULE_PATH}) | 92 | set (CMAKE_MODULE_PATH ${COMPIZ_CMAKE_MODULE_PATH} ${CMAKE_MODULE_PATH}) |
107 | 93 | include (CompizDefaults) | 93 | include (CompizDefaults) |
108 | 94 | else () | 94 | else () |
109 | 95 | set (COMPIZ_FOUND 0) | 95 | set (COMPIZ_FOUND 0) |
110 | 96 | 96 | ||
111 | === added file 'cmake/FindOpenGLES2.cmake' | |||
112 | --- cmake/FindOpenGLES2.cmake 1970-01-01 00:00:00 +0000 | |||
113 | +++ cmake/FindOpenGLES2.cmake 2012-08-22 06:16:22 +0000 | |||
114 | @@ -0,0 +1,51 @@ | |||
115 | 1 | # - Try to find OpenGLES | ||
116 | 2 | # Once done this will define | ||
117 | 3 | # | ||
118 | 4 | # OPENGLES2_FOUND - system has OpenGLES | ||
119 | 5 | # OPENGLES2_INCLUDE_DIR - the GLES include directory | ||
120 | 6 | # OPENGLES2_LIBRARY - the GLES library | ||
121 | 7 | # OPENGLES2_LIBRARIES - Link this to use OpenGLES | ||
122 | 8 | # | ||
123 | 9 | |||
124 | 10 | FIND_PATH(OPENGLES2_INCLUDE_DIR GLES2/gl2.h | ||
125 | 11 | /usr/openwin/share/include | ||
126 | 12 | /opt/graphics/OpenGL/include /usr/X11R6/include | ||
127 | 13 | /usr/include | ||
128 | 14 | ) | ||
129 | 15 | |||
130 | 16 | FIND_LIBRARY(OPENGLES2_LIBRARY | ||
131 | 17 | NAMES GLESv2 | ||
132 | 18 | PATHS /opt/graphics/OpenGL/lib | ||
133 | 19 | /usr/openwin/lib | ||
134 | 20 | /usr/shlib /usr/X11R6/lib | ||
135 | 21 | /usr/lib | ||
136 | 22 | ) | ||
137 | 23 | |||
138 | 24 | FIND_LIBRARY(OPENGLES2_EGL_LIBRARY | ||
139 | 25 | NAMES EGL | ||
140 | 26 | PATHS /usr/shlib /usr/X11R6/lib | ||
141 | 27 | /usr/lib | ||
142 | 28 | ) | ||
143 | 29 | |||
144 | 30 | # On Unix OpenGL most certainly always requires X11. | ||
145 | 31 | # Feel free to tighten up these conditions if you don't | ||
146 | 32 | # think this is always true. | ||
147 | 33 | # It's not true on OSX. | ||
148 | 34 | |||
149 | 35 | IF (OPENGLES2_LIBRARY) | ||
150 | 36 | IF(NOT X11_FOUND) | ||
151 | 37 | INCLUDE(FindX11) | ||
152 | 38 | ENDIF(NOT X11_FOUND) | ||
153 | 39 | IF (X11_FOUND) | ||
154 | 40 | IF (NOT APPLE) | ||
155 | 41 | SET (OPENGLES2_LIBRARIES ${X11_LIBRARIES}) | ||
156 | 42 | ENDIF (NOT APPLE) | ||
157 | 43 | ENDIF (X11_FOUND) | ||
158 | 44 | ENDIF(OPENGLES2_LIBRARY) | ||
159 | 45 | |||
160 | 46 | SET( OPENGLES2_FOUND "NO" ) | ||
161 | 47 | IF(OPENGLES2_LIBRARY AND OPENGLES2_EGL_LIBRARY) | ||
162 | 48 | SET( OPENGLES2_LIBRARIES ${OPENGLES2_LIBRARY} ${OPENGLES2_EGL_LIBRARY} ${OPENGLES2_LIBRARIES}) | ||
163 | 49 | SET( OPENGLES2_FOUND "YES" ) | ||
164 | 50 | ENDIF(OPENGLES2_LIBRARY AND OPENGLES2_EGL_LIBRARY) | ||
165 | 51 | |||
166 | 0 | 52 | ||
167 | === modified file 'cmake/base.cmake' | |||
168 | --- cmake/base.cmake 2012-05-24 00:55:17 +0000 | |||
169 | +++ cmake/base.cmake 2012-08-22 06:16:22 +0000 | |||
170 | @@ -24,6 +24,7 @@ | |||
171 | 24 | compiz_print_configure_header ("Compiz") | 24 | compiz_print_configure_header ("Compiz") |
172 | 25 | compiz_color_message ("\n${_escape}[4mOptional features:${_escape}[0m\n") | 25 | compiz_color_message ("\n${_escape}[4mOptional features:${_escape}[0m\n") |
173 | 26 | 26 | ||
174 | 27 | compiz_print_result_message ("GLESv2" USE_GLES) | ||
175 | 27 | compiz_print_result_message ("gtk window decorator" USE_GTK) | 28 | compiz_print_result_message ("gtk window decorator" USE_GTK) |
176 | 28 | compiz_print_result_message ("metacity theme support" USE_METACITY) | 29 | compiz_print_result_message ("metacity theme support" USE_METACITY) |
177 | 29 | compiz_print_result_message ("gconf schemas" USE_GCONF) | 30 | compiz_print_result_message ("gconf schemas" USE_GCONF) |
178 | @@ -50,11 +51,13 @@ | |||
179 | 50 | endif () | 51 | endif () |
180 | 51 | install (FILES | 52 | install (FILES |
181 | 52 | ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindCompiz.cmake | 53 | ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindCompiz.cmake |
182 | 54 | ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindOpenGLES2.cmake | ||
183 | 53 | DESTINATION | 55 | DESTINATION |
184 | 54 | ${CMAKE_INSTALL_PREFIX}/share/cmake-${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}/) | 56 | ${CMAKE_INSTALL_PREFIX}/share/cmake-${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}/) |
185 | 55 | add_custom_target (findcompiz_install | 57 | add_custom_target (findcompiz_install |
186 | 56 | ${CMAKE_COMMAND} -E make_directory ${CMAKE_ROOT}/Modules && | 58 | ${CMAKE_COMMAND} -E make_directory ${CMAKE_ROOT}/Modules && |
187 | 57 | ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/cmake/FindCompiz.cmake ${CMAKE_ROOT}/Modules | 59 | ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/cmake/FindCompiz.cmake ${CMAKE_ROOT}/Modules |
188 | 60 | ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/cmake/FindOpenGLES2.cmake ${CMAKE_ROOT}/Modules | ||
189 | 58 | ) | 61 | ) |
190 | 59 | find_file (_find_compizconfig FindCompizConfig.cmake PATHS ${CMAKE_ROOT}/Modules ${ARGN}) | 62 | find_file (_find_compizconfig FindCompizConfig.cmake PATHS ${CMAKE_ROOT}/Modules ${ARGN}) |
191 | 60 | if (NOT _find_compizconfig) | 63 | if (NOT _find_compizconfig) |
192 | 61 | 64 | ||
193 | === added file 'cmake/plugin_extensions/CompizOpenGLFixups.cmake' | |||
194 | --- cmake/plugin_extensions/CompizOpenGLFixups.cmake 1970-01-01 00:00:00 +0000 | |||
195 | +++ cmake/plugin_extensions/CompizOpenGLFixups.cmake 2012-08-22 06:16:22 +0000 | |||
196 | @@ -0,0 +1,22 @@ | |||
197 | 1 | |||
198 | 2 | # modify pkg-config libs for opengl based on if we found GLES or not | ||
199 | 3 | if (${COMPIZ_CURRENT_PLUGIN} STREQUAL "opengl") | ||
200 | 4 | if (USE_GLES) | ||
201 | 5 | set (PKGCONFIG_LIBS "-lGLESv2 -lEGL") | ||
202 | 6 | else (USE_GLES) | ||
203 | 7 | set (PKGCONFIG_LIBS "-lGL") | ||
204 | 8 | endif (USE_GLES) | ||
205 | 9 | endif (${COMPIZ_CURRENT_PLUGIN} STREQUAL "opengl") | ||
206 | 10 | |||
207 | 11 | # if plugin is using opengl plugin check for GLES library and set correct define | ||
208 | 12 | if (NOT "${${_PLUGIN}_PLUGINDEPS}" STREQUAL "") | ||
209 | 13 | string (REGEX MATCH "opengl" opengl_found ${${_PLUGIN}_PLUGINDEPS}) | ||
210 | 14 | |||
211 | 15 | if (opengl_found STREQUAL "opengl") | ||
212 | 16 | if (USE_GLES) | ||
213 | 17 | set (${_PLUGIN}_CFLAGSADD ${${_PLUGIN}_CFLAGSADD} " -DUSE_GLES") | ||
214 | 18 | string (REPLACE ";" " " ${_PLUGIN}_CFLAGSADD ${${_PLUGIN}_CFLAGSADD}) | ||
215 | 19 | endif (USE_GLES) | ||
216 | 20 | endif (opengl_found STREQUAL "opengl") | ||
217 | 21 | endif (NOT "${${_PLUGIN}_PLUGINDEPS}" STREQUAL "") | ||
218 | 22 | |||
219 | 0 | 23 | ||
220 | === modified file 'include/core/wrapsystem.h' | |||
221 | --- include/core/wrapsystem.h 2012-05-14 16:55:59 +0000 | |||
222 | +++ include/core/wrapsystem.h 2012-08-22 06:16:22 +0000 | |||
223 | @@ -52,6 +52,10 @@ | |||
224 | 52 | } \ | 52 | } \ |
225 | 53 | enum { func ## Index = num }; | 53 | enum { func ## Index = num }; |
226 | 54 | 54 | ||
227 | 55 | // For compatability ignore num and forward | ||
228 | 56 | #define WRAPABLE_HND_FUNC(num, func, ...) \ | ||
229 | 57 | WRAPABLE_HND_FUNCTN(func, __VA_ARGS__) | ||
230 | 58 | |||
231 | 55 | // New macro that doesn't need magic number | 59 | // New macro that doesn't need magic number |
232 | 56 | #define WRAPABLE_HND_FUNCTN(func, ...) \ | 60 | #define WRAPABLE_HND_FUNCTN(func, ...) \ |
233 | 57 | { \ | 61 | { \ |
234 | @@ -69,6 +73,10 @@ | |||
235 | 69 | mCurrFunction[num] = curr; \ | 73 | mCurrFunction[num] = curr; \ |
236 | 70 | } | 74 | } |
237 | 71 | 75 | ||
238 | 76 | // For compatability ignore num and forward | ||
239 | 77 | #define WRAPABLE_HND_FUNC_RETURN(num, rtype, func, ...) \ | ||
240 | 78 | WRAPABLE_HND_FUNCTN_RETURN(rtype, func, __VA_ARGS__) | ||
241 | 79 | |||
242 | 72 | // New macro that doesn't need magic number | 80 | // New macro that doesn't need magic number |
243 | 73 | #define WRAPABLE_HND_FUNCTN_RETURN(rtype, func, ...) \ | 81 | #define WRAPABLE_HND_FUNCTN_RETURN(rtype, func, ...) \ |
244 | 74 | { \ | 82 | { \ |
245 | 75 | 83 | ||
246 | === modified file 'plugins/CMakeLists.txt' | |||
247 | --- plugins/CMakeLists.txt 2012-06-24 09:00:27 +0000 | |||
248 | +++ plugins/CMakeLists.txt 2012-08-22 06:16:22 +0000 | |||
249 | @@ -25,4 +25,34 @@ | |||
250 | 25 | ${CMAKE_CURRENT_SOURCE_DIR}/../logmessage/include | 25 | ${CMAKE_CURRENT_SOURCE_DIR}/../logmessage/include |
251 | 26 | ) | 26 | ) |
252 | 27 | 27 | ||
253 | 28 | # temporarily disable plugins that aren't ported yed | ||
254 | 29 | set (COMPIZ_DISABLE_PLUGIN_ANIMATIONADDON ON) | ||
255 | 30 | set (COMPIZ_DISABLE_PLUGIN_BICUBIC ON) | ||
256 | 31 | set (COMPIZ_DISABLE_PLUGIN_BLUR ON) | ||
257 | 32 | set (COMPIZ_DISABLE_PLUGIN_COLORFILTER ON) | ||
258 | 33 | set (COMPIZ_DISABLE_PLUGIN_CUBEADDON ON) | ||
259 | 34 | set (COMPIZ_DISABLE_PLUGIN_GEARS ON) | ||
260 | 35 | set (COMPIZ_DISABLE_PLUGIN_GROUP ON) | ||
261 | 36 | set (COMPIZ_DISABLE_PLUGIN_LOGINOUT ON) | ||
262 | 37 | set (COMPIZ_DISABLE_PLUGIN_REFLEX ON) | ||
263 | 38 | set (COMPIZ_DISABLE_PLUGIN_THUMBNAIL ON) | ||
264 | 39 | set (COMPIZ_DISABLE_PLUGIN_STACKSWITCH ON) | ||
265 | 40 | set (COMPIZ_DISABLE_PLUGIN_WALLPAPER ON) | ||
266 | 41 | set (COMPIZ_DISABLE_PLUGIN_TRIP ON) | ||
267 | 42 | |||
268 | 43 | # disable plugins which won't work on ES2 builds | ||
269 | 44 | if (BUILD_GLES) | ||
270 | 45 | |||
271 | 46 | set (COMPIZ_DISABLE_PLUGIN_TD ON) | ||
272 | 47 | set (COMPIZ_DISABLE_PLUGIN_COLORFILTER ON) | ||
273 | 48 | set (COMPIZ_DISABLE_PLUGIN_MBLUR ON) | ||
274 | 49 | set (COMPIZ_DISABLE_PLUGIN_BENCH ON) | ||
275 | 50 | set (COMPIZ_DISABLE_PLUGIN_FIREPAINT ON) | ||
276 | 51 | set (COMPIZ_DISABLE_PLUGIN_SHOWREPAINT ON) | ||
277 | 52 | set (COMPIZ_DISABLE_PLUGIN_WIDGET ON) | ||
278 | 53 | set (COMPIZ_DISABLE_PLUGIN_SHOWMOUSE ON) | ||
279 | 54 | set (COMPIZ_DISABLE_PLUGIN_SPLASH ON) | ||
280 | 55 | |||
281 | 56 | endif (BUILD_GLES) | ||
282 | 57 | |||
283 | 28 | compiz_add_plugins_in_folder (${CMAKE_CURRENT_SOURCE_DIR}) | 58 | compiz_add_plugins_in_folder (${CMAKE_CURRENT_SOURCE_DIR}) |
284 | 29 | 59 | ||
285 | === modified file 'plugins/animation/CMakeLists.txt' | |||
286 | --- plugins/animation/CMakeLists.txt 2012-05-16 17:40:41 +0000 | |||
287 | +++ plugins/animation/CMakeLists.txt 2012-08-22 06:16:22 +0000 | |||
288 | @@ -1,7 +1,5 @@ | |||
289 | 1 | find_package (Compiz REQUIRED) | 1 | find_package (Compiz REQUIRED) |
290 | 2 | include (CompizPlugin) | 2 | include (CompizPlugin) |
296 | 3 | include (FindOpenGL) | 3 | |
297 | 4 | 4 | compiz_plugin (animation PLUGINDEPS composite opengl) | |
298 | 5 | if (OPENGL_GLU_FOUND) | 5 | |
294 | 6 | compiz_plugin (animation PLUGINDEPS composite opengl LIBRARIES ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR}) | ||
295 | 7 | endif (OPENGL_GLU_FOUND) | ||
299 | 8 | 6 | ||
300 | === modified file 'plugins/animation/include/animation/animation.h' | |||
301 | --- plugins/animation/include/animation/animation.h 2012-08-16 09:47:15 +0000 | |||
302 | +++ plugins/animation/include/animation/animation.h 2012-08-22 06:16:22 +0000 | |||
303 | @@ -3,8 +3,8 @@ | |||
304 | 3 | 3 | ||
305 | 4 | #define ANIMATION_ABI 20091205 | 4 | #define ANIMATION_ABI 20091205 |
306 | 5 | 5 | ||
307 | 6 | #include <core/core.h> | ||
308 | 6 | #include <core/pluginclasshandler.h> | 7 | #include <core/pluginclasshandler.h> |
309 | 7 | #include <opengl/fragment.h> | ||
310 | 8 | 8 | ||
311 | 9 | typedef enum | 9 | typedef enum |
312 | 10 | { | 10 | { |
313 | 11 | 11 | ||
314 | === modified file 'plugins/animation/include/animation/animeffect.h' | |||
315 | --- plugins/animation/include/animation/animeffect.h 2012-08-20 14:24:34 +0000 | |||
316 | +++ plugins/animation/include/animation/animeffect.h 2012-08-22 06:16:22 +0000 | |||
317 | @@ -88,7 +88,7 @@ | |||
318 | 88 | 88 | ||
319 | 89 | int mOverrideProgressDir; ///< 0: default dir, 1: forward, 2: backward | 89 | int mOverrideProgressDir; ///< 0: default dir, 1: forward, 2: backward |
320 | 90 | 90 | ||
322 | 91 | GLFragment::Attrib mCurPaintAttrib; | 91 | GLWindowPaintAttrib mCurPaintAttrib; |
323 | 92 | GLushort mStoredOpacity; | 92 | GLushort mStoredOpacity; |
324 | 93 | WindowEvent mCurWindowEvent; | 93 | WindowEvent mCurWindowEvent; |
325 | 94 | bool mInitialized; ///< whether the animation is initialized (in preparePaint) | 94 | bool mInitialized; ///< whether the animation is initialized (in preparePaint) |
326 | @@ -195,7 +195,7 @@ | |||
327 | 195 | virtual ExtensionPluginInfo *getExtensionPluginInfo (); | 195 | virtual ExtensionPluginInfo *getExtensionPluginInfo (); |
328 | 196 | 196 | ||
329 | 197 | void drawTexture (GLTexture *texture, | 197 | void drawTexture (GLTexture *texture, |
331 | 198 | GLFragment::Attrib &attrib, | 198 | const GLWindowPaintAttrib &attrib, |
332 | 199 | unsigned int mask); | 199 | unsigned int mask); |
333 | 200 | 200 | ||
334 | 201 | // Utility methods | 201 | // Utility methods |
335 | @@ -221,7 +221,7 @@ | |||
336 | 221 | GLMatrix &transform); | 221 | GLMatrix &transform); |
337 | 222 | void setInitialized () { mInitialized = true; } | 222 | void setInitialized () { mInitialized = true; } |
338 | 223 | inline bool initialized () { return mInitialized; } | 223 | inline bool initialized () { return mInitialized; } |
340 | 224 | inline void setCurPaintAttrib (GLFragment::Attrib &newAttrib) | 224 | inline void setCurPaintAttrib (const GLWindowPaintAttrib &newAttrib) |
341 | 225 | { mCurPaintAttrib = newAttrib; } | 225 | { mCurPaintAttrib = newAttrib; } |
342 | 226 | }; | 226 | }; |
343 | 227 | #endif | 227 | #endif |
344 | 228 | 228 | ||
345 | === modified file 'plugins/animation/include/animation/grid.h' | |||
346 | --- plugins/animation/include/animation/grid.h 2012-04-10 06:13:37 +0000 | |||
347 | +++ plugins/animation/include/animation/grid.h 2012-08-22 06:16:22 +0000 | |||
348 | @@ -78,8 +78,6 @@ | |||
349 | 78 | /// ( http://www.r3.nu/~cass/qcoord/ ) | 78 | /// ( http://www.r3.nu/~cass/qcoord/ ) |
350 | 79 | bool mUseQTexCoord; | 79 | bool mUseQTexCoord; |
351 | 80 | 80 | ||
352 | 81 | GLWindow::Geometry mGeometry; ///< geometry for grid mesh | ||
353 | 82 | |||
354 | 83 | virtual bool using3D () { return false; } | 81 | virtual bool using3D () { return false; } |
355 | 84 | 82 | ||
356 | 85 | virtual bool requiresTransformedWindow () const { return true; } | 83 | virtual bool requiresTransformedWindow () const { return true; } |
357 | 86 | 84 | ||
358 | === modified file 'plugins/animation/src/animation.cpp' | |||
359 | --- plugins/animation/src/animation.cpp 2012-08-20 14:24:34 +0000 | |||
360 | +++ plugins/animation/src/animation.cpp 2012-08-22 06:16:22 +0000 | |||
361 | @@ -26,6 +26,10 @@ | |||
362 | 26 | * Particle system added by : (C) 2006 Dennis Kasprzyk | 26 | * Particle system added by : (C) 2006 Dennis Kasprzyk |
363 | 27 | * E-mail : onestone@beryl-project.org | 27 | * E-mail : onestone@beryl-project.org |
364 | 28 | * | 28 | * |
365 | 29 | * Ported to GLES by : Travis Watkins | ||
366 | 30 | * (C) 2011 Linaro Limited | ||
367 | 31 | * E-mail : travis.watkins@linaro.org | ||
368 | 32 | * | ||
369 | 29 | * This program is free software; you can redistribute it and/or | 33 | * This program is free software; you can redistribute it and/or |
370 | 30 | * modify it under the terms of the GNU General Public License | 34 | * modify it under the terms of the GNU General Public License |
371 | 31 | * as published by the Free Software Foundation; either version 2 | 35 | * as published by the Free Software Foundation; either version 2 |
372 | @@ -80,8 +84,9 @@ | |||
373 | 80 | * | 84 | * |
374 | 81 | */ | 85 | */ |
375 | 82 | 86 | ||
376 | 83 | #include <GL/glu.h> | ||
377 | 84 | #include <core/atoms.h> | 87 | #include <core/atoms.h> |
378 | 88 | #include <core/core.h> | ||
379 | 89 | #include <opengl/opengl.h> | ||
380 | 85 | #include <sys/time.h> | 90 | #include <sys/time.h> |
381 | 86 | #include <assert.h> | 91 | #include <assert.h> |
382 | 87 | #include "private.h" | 92 | #include "private.h" |
383 | @@ -807,6 +812,58 @@ | |||
384 | 807 | coordsTransformed[GLVector::y]); | 812 | coordsTransformed[GLVector::y]); |
385 | 808 | } | 813 | } |
386 | 809 | 814 | ||
387 | 815 | static bool | ||
388 | 816 | project (float objx, float objy, float objz, | ||
389 | 817 | const float modelview[16], const float projection[16], | ||
390 | 818 | const GLint viewport[4], | ||
391 | 819 | float *winx, float *winy, float *winz) | ||
392 | 820 | { | ||
393 | 821 | unsigned int i; | ||
394 | 822 | float in[4]; | ||
395 | 823 | float out[4]; | ||
396 | 824 | |||
397 | 825 | in[0] = objx; | ||
398 | 826 | in[1] = objy; | ||
399 | 827 | in[2] = objz; | ||
400 | 828 | in[3] = 1.0; | ||
401 | 829 | |||
402 | 830 | for (i = 0; i < 4; i++) { | ||
403 | 831 | out[i] = | ||
404 | 832 | in[0] * modelview[i] + | ||
405 | 833 | in[1] * modelview[4 + i] + | ||
406 | 834 | in[2] * modelview[8 + i] + | ||
407 | 835 | in[3] * modelview[12 + i]; | ||
408 | 836 | } | ||
409 | 837 | |||
410 | 838 | for (i = 0; i < 4; i++) { | ||
411 | 839 | in[i] = | ||
412 | 840 | out[0] * projection[i] + | ||
413 | 841 | out[1] * projection[4 + i] + | ||
414 | 842 | out[2] * projection[8 + i] + | ||
415 | 843 | out[3] * projection[12 + i]; | ||
416 | 844 | } | ||
417 | 845 | |||
418 | 846 | if (in[3] == 0.0) | ||
419 | 847 | return false; | ||
420 | 848 | |||
421 | 849 | in[0] /= in[3]; | ||
422 | 850 | in[1] /= in[3]; | ||
423 | 851 | in[2] /= in[3]; | ||
424 | 852 | /* Map x, y and z to range 0-1 */ | ||
425 | 853 | in[0] = in[0] * 0.5 + 0.5; | ||
426 | 854 | in[1] = in[1] * 0.5 + 0.5; | ||
427 | 855 | in[2] = in[2] * 0.5 + 0.5; | ||
428 | 856 | |||
429 | 857 | /* Map x,y to viewport */ | ||
430 | 858 | in[0] = in[0] * viewport[2] + viewport[0]; | ||
431 | 859 | in[1] = in[1] * viewport[3] + viewport[1]; | ||
432 | 860 | |||
433 | 861 | *winx = in[0]; | ||
434 | 862 | *winy = in[1]; | ||
435 | 863 | *winz = in[2]; | ||
436 | 864 | return true; | ||
437 | 865 | } | ||
438 | 866 | |||
439 | 810 | /// Either points or objects should be non-0. | 867 | /// Either points or objects should be non-0. |
440 | 811 | bool | 868 | bool |
441 | 812 | AnimWindow::expandBBWithPoints3DTransform (CompOutput &output, | 869 | AnimWindow::expandBBWithPoints3DTransform (CompOutput &output, |
442 | @@ -815,27 +872,24 @@ | |||
443 | 815 | GridAnim::GridModel::GridObject *objects, | 872 | GridAnim::GridModel::GridObject *objects, |
444 | 816 | unsigned int nPoints) | 873 | unsigned int nPoints) |
445 | 817 | { | 874 | { |
454 | 818 | GLdouble dModel[16]; | 875 | GLfloat x, y, z; |
447 | 819 | GLdouble dProjection[16]; | ||
448 | 820 | GLdouble x, y, z; | ||
449 | 821 | for (unsigned int i = 0; i < 16; i++) | ||
450 | 822 | { | ||
451 | 823 | dModel[i] = transform[i]; | ||
452 | 824 | dProjection[i] = GLScreen::get (::screen)->projectionMatrix ()[i]; | ||
453 | 825 | } | ||
455 | 826 | GLint viewport[4] = | 876 | GLint viewport[4] = |
456 | 827 | {output.region ()->extents.x1, | 877 | {output.region ()->extents.x1, |
457 | 828 | output.region ()->extents.y1, | 878 | output.region ()->extents.y1, |
458 | 829 | output.width (), | 879 | output.width (), |
459 | 830 | output.height ()}; | 880 | output.height ()}; |
460 | 831 | 881 | ||
461 | 882 | const float *projection = | ||
462 | 883 | GLScreen::get (::screen)->projectionMatrix ()->getMatrix (); | ||
463 | 884 | |||
464 | 832 | if (points) // use points | 885 | if (points) // use points |
465 | 833 | { | 886 | { |
466 | 834 | for (; nPoints; nPoints--, points += 3) | 887 | for (; nPoints; nPoints--, points += 3) |
467 | 835 | { | 888 | { |
471 | 836 | if (!gluProject (points[0], points[1], points[2], | 889 | if (!project (points[0], points[1], points[2], |
472 | 837 | dModel, dProjection, viewport, | 890 | transform.getMatrix (), projection, |
473 | 838 | &x, &y, &z)) | 891 | viewport, |
474 | 892 | &x, &y, &z)) | ||
475 | 839 | return false; | 893 | return false; |
476 | 840 | 894 | ||
477 | 841 | expandBBWithPoint (x + 0.5, (::screen->height () - y) + 0.5); | 895 | expandBBWithPoint (x + 0.5, (::screen->height () - y) + 0.5); |
478 | @@ -846,11 +900,12 @@ | |||
479 | 846 | GridAnim::GridModel::GridObject *object = objects; | 900 | GridAnim::GridModel::GridObject *object = objects; |
480 | 847 | for (; nPoints; nPoints--, object++) | 901 | for (; nPoints; nPoints--, object++) |
481 | 848 | { | 902 | { |
487 | 849 | if (!gluProject (object->position ().x (), | 903 | if (!project (object->position ().x (), |
488 | 850 | object->position ().y (), | 904 | object->position ().y (), |
489 | 851 | object->position ().z (), | 905 | object->position ().z (), |
490 | 852 | dModel, dProjection, viewport, | 906 | transform.getMatrix (), projection, |
491 | 853 | &x, &y, &z)) | 907 | viewport, |
492 | 908 | &x, &y, &z)) | ||
493 | 854 | return false; | 909 | return false; |
494 | 855 | 910 | ||
495 | 856 | expandBBWithPoint (x + 0.5, (::screen->height () - y) + 0.5); | 911 | expandBBWithPoint (x + 0.5, (::screen->height () - y) + 0.5); |
496 | @@ -906,15 +961,10 @@ | |||
497 | 906 | void | 961 | void |
498 | 907 | PrivateAnimWindow::damageThisAndLastStepRegion () | 962 | PrivateAnimWindow::damageThisAndLastStepRegion () |
499 | 908 | { | 963 | { |
500 | 909 | #ifdef COMPIZ_OPENGL_SWAPBUFFERS_ALWAYS // when LP: #901097 is fixed | ||
501 | 910 | // Find union of the regions for this step and last step | 964 | // Find union of the regions for this step and last step |
502 | 911 | CompRegion totalRegionToDamage (mStepRegion + mLastStepRegion); | 965 | CompRegion totalRegionToDamage (mStepRegion + mLastStepRegion); |
503 | 912 | 966 | ||
504 | 913 | mPAScreen->cScreen->damageRegion (totalRegionToDamage); | 967 | mPAScreen->cScreen->damageRegion (totalRegionToDamage); |
505 | 914 | #else | ||
506 | 915 | // Ugly fix for LP: #930192 while LP: #901097 is not resolved | ||
507 | 916 | mPAScreen->cScreen->damageScreen (); | ||
508 | 917 | #endif | ||
509 | 918 | } | 968 | } |
510 | 919 | 969 | ||
511 | 920 | CompOutput & | 970 | CompOutput & |
512 | @@ -1435,7 +1485,7 @@ | |||
513 | 1435 | { | 1485 | { |
514 | 1436 | gWindow->glPaintSetEnabled (this, enabling); | 1486 | gWindow->glPaintSetEnabled (this, enabling); |
515 | 1437 | gWindow->glAddGeometrySetEnabled (this, enabling); | 1487 | gWindow->glAddGeometrySetEnabled (this, enabling); |
517 | 1438 | gWindow->glDrawGeometrySetEnabled (this, enabling); | 1488 | //gWindow->glDrawGeometrySetEnabled (this, enabling); |
518 | 1439 | gWindow->glDrawTextureSetEnabled (this, enabling); | 1489 | gWindow->glDrawTextureSetEnabled (this, enabling); |
519 | 1440 | } | 1490 | } |
520 | 1441 | 1491 | ||
521 | @@ -1509,7 +1559,8 @@ | |||
522 | 1509 | 1559 | ||
523 | 1510 | void | 1560 | void |
524 | 1511 | PrivateAnimWindow::glDrawTexture (GLTexture *texture, | 1561 | PrivateAnimWindow::glDrawTexture (GLTexture *texture, |
526 | 1512 | GLFragment::Attrib &attrib, | 1562 | const GLMatrix &transform, |
527 | 1563 | const GLWindowPaintAttrib &attrib, | ||
528 | 1513 | unsigned int mask) | 1564 | unsigned int mask) |
529 | 1514 | { | 1565 | { |
530 | 1515 | if (mCurAnimation) | 1566 | if (mCurAnimation) |
531 | @@ -1517,9 +1568,10 @@ | |||
532 | 1517 | mCurAnimation->setCurPaintAttrib (attrib); | 1568 | mCurAnimation->setCurPaintAttrib (attrib); |
533 | 1518 | } | 1569 | } |
534 | 1519 | 1570 | ||
536 | 1520 | gWindow->glDrawTexture (texture, attrib, mask); | 1571 | gWindow->glDrawTexture (texture, transform, attrib, mask); |
537 | 1521 | } | 1572 | } |
538 | 1522 | 1573 | ||
539 | 1574 | #if 0 // Not ported yet | ||
540 | 1523 | void | 1575 | void |
541 | 1524 | PrivateAnimWindow::glDrawGeometry () | 1576 | PrivateAnimWindow::glDrawGeometry () |
542 | 1525 | { | 1577 | { |
543 | @@ -1533,10 +1585,11 @@ | |||
544 | 1533 | gWindow->glDrawGeometry (); | 1585 | gWindow->glDrawGeometry (); |
545 | 1534 | } | 1586 | } |
546 | 1535 | } | 1587 | } |
547 | 1588 | #endif | ||
548 | 1536 | 1589 | ||
549 | 1537 | void | 1590 | void |
550 | 1538 | Animation::drawTexture (GLTexture *texture, | 1591 | Animation::drawTexture (GLTexture *texture, |
552 | 1539 | GLFragment::Attrib &attrib, | 1592 | const GLWindowPaintAttrib &attrib, |
553 | 1540 | unsigned int mask) | 1593 | unsigned int mask) |
554 | 1541 | { | 1594 | { |
555 | 1542 | mCurPaintAttrib = attrib; | 1595 | mCurPaintAttrib = attrib; |
556 | @@ -1545,7 +1598,9 @@ | |||
557 | 1545 | void | 1598 | void |
558 | 1546 | Animation::drawGeometry () | 1599 | Animation::drawGeometry () |
559 | 1547 | { | 1600 | { |
560 | 1601 | #if 0 // Not ported yet | ||
561 | 1548 | mAWindow->priv->gWindow->glDrawGeometry (); | 1602 | mAWindow->priv->gWindow->glDrawGeometry (); |
562 | 1603 | #endif | ||
563 | 1549 | } | 1604 | } |
564 | 1550 | 1605 | ||
565 | 1551 | bool | 1606 | bool |
566 | @@ -1614,13 +1669,16 @@ | |||
567 | 1614 | 1669 | ||
568 | 1615 | if (mCurAnimation->postPaintWindowUsed ()) | 1670 | if (mCurAnimation->postPaintWindowUsed ()) |
569 | 1616 | { | 1671 | { |
570 | 1672 | #if 0 // Not ported yet | ||
571 | 1617 | // Transform to make post-paint coincide with the window | 1673 | // Transform to make post-paint coincide with the window |
572 | 1618 | glPushMatrix (); | 1674 | glPushMatrix (); |
573 | 1619 | glLoadMatrixf (wTransform.getMatrix ()); | 1675 | glLoadMatrixf (wTransform.getMatrix ()); |
575 | 1620 | 1676 | #endif | |
576 | 1621 | mCurAnimation->postPaintWindow (); | 1677 | mCurAnimation->postPaintWindow (); |
577 | 1622 | 1678 | ||
578 | 1679 | #if 0 // Not ported yet | ||
579 | 1623 | glPopMatrix (); | 1680 | glPopMatrix (); |
580 | 1681 | #endif | ||
581 | 1624 | } | 1682 | } |
582 | 1625 | 1683 | ||
583 | 1626 | return status; | 1684 | return status; |
584 | 1627 | 1685 | ||
585 | === modified file 'plugins/animation/src/grid.cpp' | |||
586 | --- plugins/animation/src/grid.cpp 2010-10-23 15:41:33 +0000 | |||
587 | +++ plugins/animation/src/grid.cpp 2012-08-22 06:16:22 +0000 | |||
588 | @@ -19,6 +19,8 @@ | |||
589 | 19 | * Hexagon tessellator added by : Mike Slegeir | 19 | * Hexagon tessellator added by : Mike Slegeir |
590 | 20 | * E-mail : mikeslegeir@mail.utexas.edu> | 20 | * E-mail : mikeslegeir@mail.utexas.edu> |
591 | 21 | * | 21 | * |
592 | 22 | * Ported to GLVertexBuffer by: Daniel van Vugt <daniel.van.vugt@canonical.com> | ||
593 | 23 | * | ||
594 | 22 | * This program is free software; you can redistribute it and/or | 24 | * This program is free software; you can redistribute it and/or |
595 | 23 | * modify it under the terms of the GNU General Public License | 25 | * modify it under the terms of the GNU General Public License |
596 | 24 | * as published by the Free Software Foundation; either version 2 | 26 | * as published by the Free Software Foundation; either version 2 |
597 | @@ -217,34 +219,19 @@ | |||
598 | 217 | unsigned int maxGridWidth, | 219 | unsigned int maxGridWidth, |
599 | 218 | unsigned int maxGridHeight) | 220 | unsigned int maxGridHeight) |
600 | 219 | { | 221 | { |
606 | 220 | unsigned int nMatrix = matrix.size (); | 222 | |
607 | 221 | int nVertices, nIndices; | 223 | GLfloat *v, *vMax; |
608 | 222 | GLushort *i; | 224 | int y1, x2, y2; |
604 | 223 | GLfloat *v; | ||
605 | 224 | int x1, y1, x2, y2; | ||
609 | 225 | float winContentsY, winContentsHeight; | 225 | float winContentsY, winContentsHeight; |
610 | 226 | float deformedX, deformedY; | 226 | float deformedX, deformedY; |
611 | 227 | float deformedZ = 0; | 227 | float deformedZ = 0; |
612 | 228 | int nVertX, nVertY; | ||
613 | 229 | int vSize; | 228 | int vSize; |
614 | 230 | float gridW, gridH; | 229 | float gridW, gridH; |
615 | 231 | bool rect = true; | ||
616 | 232 | bool notUsing3dCoords = !using3D (); | 230 | bool notUsing3dCoords = !using3D (); |
617 | 233 | 231 | ||
618 | 234 | if (region.isEmpty ()) // nothing to do | 232 | if (region.isEmpty ()) // nothing to do |
619 | 235 | return; | 233 | return; |
620 | 236 | 234 | ||
621 | 237 | GLWindow::Geometry &geometry = GLWindow::get (mWindow)->geometry (); | ||
622 | 238 | |||
623 | 239 | for (unsigned int it = 0; it < nMatrix; it++) | ||
624 | 240 | { | ||
625 | 241 | if (matrix[it].xy != 0.0f || matrix[it].yx != 0.0f) | ||
626 | 242 | { | ||
627 | 243 | rect = false; | ||
628 | 244 | break; | ||
629 | 245 | } | ||
630 | 246 | } | ||
631 | 247 | |||
632 | 248 | CompRect outRect (mAWindow->savedRectsValid () ? | 235 | CompRect outRect (mAWindow->savedRectsValid () ? |
633 | 249 | mAWindow->savedOutRect () : | 236 | mAWindow->savedOutRect () : |
634 | 250 | mWindow->outputRect ()); | 237 | mWindow->outputRect ()); |
635 | @@ -262,30 +249,15 @@ | |||
636 | 262 | winContentsY = oy + outExtents.top; | 249 | winContentsY = oy + outExtents.top; |
637 | 263 | winContentsHeight = oheight - outExtents.top - outExtents.bottom; | 250 | winContentsHeight = oheight - outExtents.top - outExtents.bottom; |
638 | 264 | 251 | ||
663 | 265 | geometry.texUnits = (int)nMatrix; | 252 | GLWindow *gWindow = GLWindow::get (mWindow); |
664 | 266 | 253 | GLVertexBuffer *vertexBuffer = gWindow->vertexBuffer (); | |
665 | 267 | if (geometry.vCount == 0) | 254 | vSize = vertexBuffer->getVertexStride (); |
666 | 268 | { | 255 | |
667 | 269 | // reset | 256 | // Indentation kept to provide a clean diff with the old code, for now... |
668 | 270 | geometry.indexCount = 0; | 257 | { |
669 | 271 | geometry.texCoordSize = 4; | 258 | y1 = outRect.y1 (); |
670 | 272 | } | 259 | x2 = outRect.x2 (); |
671 | 273 | geometry.vertexStride = 3 + geometry.texUnits * geometry.texCoordSize; | 260 | y2 = outRect.y2 (); |
648 | 274 | vSize = geometry.vertexStride; | ||
649 | 275 | |||
650 | 276 | nVertices = geometry.vCount; | ||
651 | 277 | nIndices = geometry.indexCount; | ||
652 | 278 | |||
653 | 279 | v = geometry.vertices + (nVertices * vSize); | ||
654 | 280 | i = geometry.indices + nIndices; | ||
655 | 281 | |||
656 | 282 | // For each clip passed to this function | ||
657 | 283 | foreach (const CompRect &pClip, region.rects ()) | ||
658 | 284 | { | ||
659 | 285 | x1 = pClip.x1 (); | ||
660 | 286 | y1 = pClip.y1 (); | ||
661 | 287 | x2 = pClip.x2 (); | ||
662 | 288 | y2 = pClip.y2 (); | ||
672 | 289 | 261 | ||
673 | 290 | gridW = (float)owidth / (mGridWidth - 1); | 262 | gridW = (float)owidth / (mGridWidth - 1); |
674 | 291 | 263 | ||
675 | @@ -310,64 +282,22 @@ | |||
676 | 310 | else | 282 | else |
677 | 311 | gridH = (float)oheight / (mGridHeight - 1); | 283 | gridH = (float)oheight / (mGridHeight - 1); |
678 | 312 | 284 | ||
724 | 313 | // nVertX, nVertY: number of vertices for this clip in x and y dimensions | 285 | int oldCount = vertexBuffer->countVertices (); |
725 | 314 | // + 2 to avoid running short of vertices in some cases | 286 | gWindow->glAddGeometry (matrix, region, clip, gridW, gridH); |
726 | 315 | nVertX = ceil ((x2 - x1) / gridW) + 2; | 287 | int newCount = vertexBuffer->countVertices (); |
727 | 316 | nVertY = (gridH ? ceil ((y2 - y1) / gridH) : 0) + 2; | 288 | v = vertexBuffer->getVertices () + (oldCount * vSize); |
728 | 317 | 289 | vMax = vertexBuffer->getVertices () + (newCount * vSize); | |
729 | 318 | // Allocate 4 indices for each quad | 290 | |
685 | 319 | int newIndexSize = nIndices + ((nVertX - 1) * (nVertY - 1) * 4); | ||
686 | 320 | |||
687 | 321 | if (newIndexSize > geometry.indexSize) | ||
688 | 322 | { | ||
689 | 323 | if (!geometry.moreIndices (newIndexSize)) | ||
690 | 324 | return; | ||
691 | 325 | |||
692 | 326 | i = geometry.indices + nIndices; | ||
693 | 327 | } | ||
694 | 328 | // Assign quad vertices to indices | ||
695 | 329 | for (int jy = 0; jy < nVertY - 1; jy++) | ||
696 | 330 | { | ||
697 | 331 | for (int jx = 0; jx < nVertX - 1; jx++) | ||
698 | 332 | { | ||
699 | 333 | *i++ = nVertices + nVertX * (2 * jy + 1) + jx; | ||
700 | 334 | *i++ = nVertices + nVertX * (2 * jy + 1) + jx + 1; | ||
701 | 335 | *i++ = nVertices + nVertX * 2 * jy + jx + 1; | ||
702 | 336 | *i++ = nVertices + nVertX * 2 * jy + jx; | ||
703 | 337 | |||
704 | 338 | nIndices += 4; | ||
705 | 339 | } | ||
706 | 340 | } | ||
707 | 341 | |||
708 | 342 | // Allocate vertices | ||
709 | 343 | int newVertexSize = | ||
710 | 344 | (nVertices + nVertX * (2 * nVertY - 2)) * vSize; | ||
711 | 345 | if (newVertexSize > geometry.vertexSize) | ||
712 | 346 | { | ||
713 | 347 | if (!geometry.moreVertices (newVertexSize)) | ||
714 | 348 | return; | ||
715 | 349 | |||
716 | 350 | v = geometry.vertices + (nVertices * vSize); | ||
717 | 351 | } | ||
718 | 352 | |||
719 | 353 | float rowTexCoordQ = 1; | ||
720 | 354 | float prevRowCellWidth = 0; // this initial value won't be used | ||
721 | 355 | float rowCellWidth = 0; | ||
722 | 356 | int clipRowSize = nVertX * vSize; | ||
723 | 357 | |||
730 | 358 | // For each vertex | 291 | // For each vertex |
733 | 359 | float y = y1; | 292 | for (; v < vMax; v += vSize) |
732 | 360 | for (int jy = 0; jy < nVertY; jy++) | ||
734 | 361 | { | 293 | { |
735 | 294 | float x = v[0]; | ||
736 | 295 | float y = v[1]; | ||
737 | 362 | float topiyFloat; | 296 | float topiyFloat; |
738 | 363 | bool applyOffsets = true; | ||
739 | 364 | 297 | ||
740 | 365 | if (y > y2) | 298 | if (y > y2) |
741 | 366 | y = y2; | 299 | y = y2; |
742 | 367 | 300 | ||
743 | 368 | // Do calculations for y here to avoid repeating | ||
744 | 369 | // them unnecessarily in the x loop | ||
745 | 370 | |||
746 | 371 | if (mCurWindowEvent == WindowEventShade || | 301 | if (mCurWindowEvent == WindowEventShade || |
747 | 372 | mCurWindowEvent == WindowEventUnshade) | 302 | mCurWindowEvent == WindowEventUnshade) |
748 | 373 | { | 303 | { |
749 | @@ -375,7 +305,6 @@ | |||
750 | 375 | { | 305 | { |
751 | 376 | topiyFloat = (y - oy) / mDecorTopHeight; | 306 | topiyFloat = (y - oy) / mDecorTopHeight; |
752 | 377 | topiyFloat = MIN (topiyFloat, 0.999); // avoid 1.0 | 307 | topiyFloat = MIN (topiyFloat, 0.999); // avoid 1.0 |
753 | 378 | applyOffsets = false; | ||
754 | 379 | } | 308 | } |
755 | 380 | else if (y2 > winContentsY + winContentsHeight) // if at bottom | 309 | else if (y2 > winContentsY + winContentsHeight) // if at bottom |
756 | 381 | { | 310 | { |
757 | @@ -383,7 +312,6 @@ | |||
758 | 383 | (mDecorBottomHeight ? (y - winContentsY - | 312 | (mDecorBottomHeight ? (y - winContentsY - |
759 | 384 | winContentsHeight) / | 313 | winContentsHeight) / |
760 | 385 | mDecorBottomHeight : 0); | 314 | mDecorBottomHeight : 0); |
761 | 386 | applyOffsets = false; | ||
762 | 387 | } | 315 | } |
763 | 388 | else // in window contents (only in Y coords) | 316 | else // in window contents (only in Y coords) |
764 | 389 | { | 317 | { |
765 | @@ -406,8 +334,7 @@ | |||
766 | 406 | 334 | ||
767 | 407 | // End of calculations for y | 335 | // End of calculations for y |
768 | 408 | 336 | ||
771 | 409 | float x = x1; | 337 | // Indentation kept to provide a clean diff with the old code... |
770 | 410 | for (int jx = 0; jx < nVertX; jx++) | ||
772 | 411 | { | 338 | { |
773 | 412 | if (x > x2) | 339 | if (x > x2) |
774 | 413 | x = x2; | 340 | x = x2; |
775 | @@ -461,179 +388,19 @@ | |||
776 | 461 | deformedY = inyRest * hor1y + iny * hor2y; | 388 | deformedY = inyRest * hor1y + iny * hor2y; |
777 | 462 | deformedZ = inyRest * hor1z + iny * hor2z; | 389 | deformedZ = inyRest * hor1z + iny * hor2z; |
778 | 463 | 390 | ||
779 | 464 | // Texture coordinates (s, t, r, q) | ||
780 | 465 | |||
781 | 466 | if (mUseQTexCoord) | ||
782 | 467 | { | ||
783 | 468 | if (jx == 1) | ||
784 | 469 | rowCellWidth = deformedX - v[-3]; | ||
785 | 470 | |||
786 | 471 | // do only once per row for all rows except row 0 | ||
787 | 472 | if (jy > 0 && jx == 1) | ||
788 | 473 | { | ||
789 | 474 | rowTexCoordQ = (rowCellWidth / prevRowCellWidth); | ||
790 | 475 | |||
791 | 476 | for (unsigned int it = 0; it < nMatrix; it++, v += 4) | ||
792 | 477 | { | ||
793 | 478 | // update first column | ||
794 | 479 | // (since we didn't know rowTexCoordQ before) | ||
795 | 480 | v[-vSize] *= rowTexCoordQ; // multiply s & t by q | ||
796 | 481 | v[-vSize + 1] *= rowTexCoordQ; | ||
797 | 482 | v[-vSize + 3] = rowTexCoordQ; // copy q | ||
798 | 483 | } | ||
799 | 484 | v -= nMatrix * 4; | ||
800 | 485 | } | ||
801 | 486 | } | ||
802 | 487 | |||
803 | 488 | // Loop for each texture element | ||
804 | 489 | // (4 texture coordinates for each one) | ||
805 | 490 | for (unsigned int it = 0; it < nMatrix; it++, v += 4) | ||
806 | 491 | { | ||
807 | 492 | float offsetY = 0; | ||
808 | 493 | |||
809 | 494 | if (rect) | ||
810 | 495 | { | ||
811 | 496 | if (applyOffsets && y < y2) | ||
812 | 497 | offsetY = objToTopLeft->mOffsetTexCoordForQuadAfter.y (); | ||
813 | 498 | v[0] = COMP_TEX_COORD_X (matrix[it], x); // s | ||
814 | 499 | v[1] = COMP_TEX_COORD_Y (matrix[it], y + offsetY); // t | ||
815 | 500 | } | ||
816 | 501 | else | ||
817 | 502 | { | ||
818 | 503 | if (applyOffsets && y < y2) | ||
819 | 504 | // FIXME: | ||
820 | 505 | // The correct y offset below produces wrong | ||
821 | 506 | // texture coordinates for some reason. | ||
822 | 507 | offsetY = 0; | ||
823 | 508 | // offsetY = objToTopLeft->offsetTexCoordForQuadAfter.y; | ||
824 | 509 | v[0] = COMP_TEX_COORD_XY (matrix[it], x, y + offsetY); // s | ||
825 | 510 | v[1] = COMP_TEX_COORD_YX (matrix[it], x, y + offsetY); // t | ||
826 | 511 | } | ||
827 | 512 | v[2] = 0; // r | ||
828 | 513 | |||
829 | 514 | if (0 < jy && jy < nVertY - 1) | ||
830 | 515 | { | ||
831 | 516 | // copy s, t, r to duplicate row | ||
832 | 517 | memcpy (v + clipRowSize, v, 3 * sizeof (GLfloat)); | ||
833 | 518 | v[3 + clipRowSize] = 1; // q | ||
834 | 519 | } | ||
835 | 520 | |||
836 | 521 | if (applyOffsets && | ||
837 | 522 | objToTopLeft->mOffsetTexCoordForQuadBefore.y () != 0) | ||
838 | 523 | { | ||
839 | 524 | // After copying to next row, update texture y coord | ||
840 | 525 | // by following object's offset | ||
841 | 526 | offsetY = objToTopLeft->mOffsetTexCoordForQuadBefore.y (); | ||
842 | 527 | if (rect) | ||
843 | 528 | { | ||
844 | 529 | v[1] = COMP_TEX_COORD_Y (matrix[it], y + offsetY); | ||
845 | 530 | } | ||
846 | 531 | else | ||
847 | 532 | { | ||
848 | 533 | v[0] = COMP_TEX_COORD_XY (matrix[it], | ||
849 | 534 | x, y + offsetY); | ||
850 | 535 | v[1] = COMP_TEX_COORD_YX (matrix[it], | ||
851 | 536 | x, y + offsetY); | ||
852 | 537 | } | ||
853 | 538 | } | ||
854 | 539 | if (mUseQTexCoord) | ||
855 | 540 | { | ||
856 | 541 | v[3] = rowTexCoordQ; // q | ||
857 | 542 | |||
858 | 543 | if (jx > 0) // since column 0 is updated when jx == 1 | ||
859 | 544 | { | ||
860 | 545 | // multiply s & t by q | ||
861 | 546 | v[0] *= rowTexCoordQ; | ||
862 | 547 | v[1] *= rowTexCoordQ; | ||
863 | 548 | } | ||
864 | 549 | } | ||
865 | 550 | else | ||
866 | 551 | { | ||
867 | 552 | v[3] = 1; // q | ||
868 | 553 | } | ||
869 | 554 | } | ||
870 | 555 | |||
871 | 556 | v[0] = deformedX; | 391 | v[0] = deformedX; |
872 | 557 | v[1] = deformedY; | 392 | v[1] = deformedY; |
873 | 558 | v[2] = deformedZ; | 393 | v[2] = deformedZ; |
874 | 559 | 394 | ||
875 | 560 | // Copy vertex coordinates to duplicate row | ||
876 | 561 | if (0 < jy && jy < nVertY - 1) | ||
877 | 562 | memcpy (v + clipRowSize, v, 3 * sizeof (GLfloat)); | ||
878 | 563 | |||
879 | 564 | nVertices++; | ||
880 | 565 | |||
881 | 566 | // increment x properly (so that coordinates fall on grid intersections) | ||
882 | 567 | x = rightix * gridW + ox; | ||
883 | 568 | |||
884 | 569 | v += 3; // move on to next vertex | ||
885 | 570 | } | ||
886 | 571 | if (mUseQTexCoord) | ||
887 | 572 | prevRowCellWidth = rowCellWidth; | ||
888 | 573 | |||
889 | 574 | if (0 < jy && jy < nVertY - 1) | ||
890 | 575 | { | ||
891 | 576 | v += clipRowSize; // skip the duplicate row | ||
892 | 577 | nVertices += nVertX; | ||
893 | 578 | } | ||
894 | 579 | // increment y properly (so that coordinates fall on grid intersections) | ||
895 | 580 | if (mCurWindowEvent == WindowEventShade || | ||
896 | 581 | mCurWindowEvent == WindowEventUnshade) | ||
897 | 582 | { | ||
898 | 583 | y += gridH; | ||
899 | 584 | } | ||
900 | 585 | else | ||
901 | 586 | { | ||
902 | 587 | y = bottomiy * gridH + oy; | ||
903 | 588 | } | 395 | } |
904 | 589 | } | 396 | } |
905 | 590 | } | 397 | } |
906 | 591 | geometry.vCount = nVertices; | ||
907 | 592 | geometry.indexCount = nIndices; | ||
908 | 593 | } | 398 | } |
909 | 594 | 399 | ||
910 | 595 | void | 400 | void |
911 | 596 | GridAnim::drawGeometry () | 401 | GridAnim::drawGeometry () |
912 | 597 | { | 402 | { |
952 | 598 | GLWindow::Geometry &geometry = GLWindow::get (mWindow)->geometry (); | 403 | // Deprecated |
914 | 599 | |||
915 | 600 | int texUnit = geometry.texUnits; | ||
916 | 601 | int currentTexUnit = 0; | ||
917 | 602 | int stride = geometry.vertexStride; | ||
918 | 603 | GLfloat *vertices = geometry.vertices + (stride - 3); | ||
919 | 604 | |||
920 | 605 | stride *= (int) sizeof (GLfloat); | ||
921 | 606 | |||
922 | 607 | glVertexPointer (3, GL_FLOAT, stride, vertices); | ||
923 | 608 | |||
924 | 609 | while (texUnit--) | ||
925 | 610 | { | ||
926 | 611 | if (texUnit != currentTexUnit) | ||
927 | 612 | { | ||
928 | 613 | (*GL::clientActiveTexture) ((GLenum)(GL_TEXTURE0_ARB + texUnit)); | ||
929 | 614 | glEnableClientState (GL_TEXTURE_COORD_ARRAY); | ||
930 | 615 | currentTexUnit = texUnit; | ||
931 | 616 | } | ||
932 | 617 | vertices -= geometry.texCoordSize; | ||
933 | 618 | glTexCoordPointer (geometry.texCoordSize, | ||
934 | 619 | GL_FLOAT, stride, vertices); | ||
935 | 620 | } | ||
936 | 621 | |||
937 | 622 | glDrawElements (GL_QUADS, geometry.indexCount, | ||
938 | 623 | GL_UNSIGNED_SHORT, geometry.indices); | ||
939 | 624 | |||
940 | 625 | // disable all texture coordinate arrays except 0 | ||
941 | 626 | texUnit = geometry.texUnits; | ||
942 | 627 | if (texUnit > 1) | ||
943 | 628 | { | ||
944 | 629 | while (--texUnit) | ||
945 | 630 | { | ||
946 | 631 | (*GL::clientActiveTexture) ((GLenum)(GL_TEXTURE0_ARB + texUnit)); | ||
947 | 632 | glDisableClientState (GL_TEXTURE_COORD_ARRAY); | ||
948 | 633 | } | ||
949 | 634 | |||
950 | 635 | (*GL::clientActiveTexture) (GL_TEXTURE0_ARB); | ||
951 | 636 | } | ||
953 | 637 | } | 404 | } |
954 | 638 | 405 | ||
955 | 639 | GridTransformAnim::GridTransformAnim (CompWindow *w, | 406 | GridTransformAnim::GridTransformAnim (CompWindow *w, |
956 | 640 | 407 | ||
957 | === modified file 'plugins/animation/src/private.h' | |||
958 | --- plugins/animation/src/private.h 2012-05-27 04:32:55 +0000 | |||
959 | +++ plugins/animation/src/private.h 2012-08-22 06:16:22 +0000 | |||
960 | @@ -407,9 +407,9 @@ | |||
961 | 407 | void glAddGeometry (const GLTexture::MatrixList &, | 407 | void glAddGeometry (const GLTexture::MatrixList &, |
962 | 408 | const CompRegion &, const CompRegion &, | 408 | const CompRegion &, const CompRegion &, |
963 | 409 | unsigned int = MAXSHORT, unsigned int = MAXSHORT); | 409 | unsigned int = MAXSHORT, unsigned int = MAXSHORT); |
967 | 410 | void glDrawTexture (GLTexture *texture, GLFragment::Attrib &, | 410 | void glDrawTexture (GLTexture *texture, const GLMatrix &, |
968 | 411 | unsigned int); | 411 | const GLWindowPaintAttrib &, unsigned int); |
969 | 412 | void glDrawGeometry (); | 412 | //void glDrawGeometry (); |
970 | 413 | }; | 413 | }; |
971 | 414 | 414 | ||
972 | 415 | class RollUpAnim : | 415 | class RollUpAnim : |
973 | 416 | 416 | ||
974 | === modified file 'plugins/annotate/src/annotate.cpp' | |||
975 | --- plugins/annotate/src/annotate.cpp 2012-07-30 09:20:41 +0000 | |||
976 | +++ plugins/annotate/src/annotate.cpp 2012-08-22 06:16:22 +0000 | |||
977 | @@ -629,11 +629,14 @@ | |||
978 | 629 | 629 | ||
979 | 630 | if (status) | 630 | if (status) |
980 | 631 | { | 631 | { |
981 | 632 | GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer (); | ||
982 | 633 | GLfloat vertexData[18]; | ||
983 | 634 | GLfloat textureData[12]; | ||
984 | 632 | CompRect rect; | 635 | CompRect rect; |
985 | 633 | GLMatrix sTransform = transform; | 636 | GLMatrix sTransform = transform; |
986 | 634 | int numRect; | 637 | int numRect; |
987 | 635 | int pos = 0; | 638 | int pos = 0; |
989 | 636 | float vectorX, vectorY, offset; | 639 | float offset; |
990 | 637 | int angle; | 640 | int angle; |
991 | 638 | 641 | ||
992 | 639 | offset = optionGetStrokeWidth () / 2; | 642 | offset = optionGetStrokeWidth () / 2; |
993 | @@ -641,10 +644,6 @@ | |||
994 | 641 | /* This replaced prepareXCoords (s, output, -DEFAULT_Z_CAMERA) */ | 644 | /* This replaced prepareXCoords (s, output, -DEFAULT_Z_CAMERA) */ |
995 | 642 | sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA); | 645 | sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA); |
996 | 643 | 646 | ||
997 | 644 | glPushMatrix (); | ||
998 | 645 | glLoadMatrixf (sTransform.getMatrix ()); | ||
999 | 646 | |||
1000 | 647 | glDisableClientState (GL_TEXTURE_COORD_ARRAY); | ||
1001 | 648 | glEnable (GL_BLEND); | 647 | glEnable (GL_BLEND); |
1002 | 649 | 648 | ||
1003 | 650 | if (content && !region.isEmpty ()) | 649 | if (content && !region.isEmpty ()) |
1004 | @@ -656,34 +655,66 @@ | |||
1005 | 656 | 655 | ||
1006 | 657 | tex->enable (GLTexture::Fast); | 656 | tex->enable (GLTexture::Fast); |
1007 | 658 | 657 | ||
1009 | 659 | glBegin (GL_QUADS); | 658 | streamingBuffer->begin (GL_TRIANGLES); |
1010 | 660 | 659 | ||
1011 | 661 | while (numRect--) | 660 | while (numRect--) |
1012 | 662 | { | 661 | { |
1033 | 663 | glTexCoord2f ( | 662 | GLfloat tx1 = COMP_TEX_COORD_X (tex->matrix (), |
1034 | 664 | COMP_TEX_COORD_X (tex->matrix (), rect.at (pos).x1 ()), | 663 | rect.at (pos).x1 ()); |
1035 | 665 | COMP_TEX_COORD_Y (tex->matrix (), rect.at (pos).y2 ())); | 664 | GLfloat tx2 = COMP_TEX_COORD_X (tex->matrix (), |
1036 | 666 | glVertex2i (rect.at (pos).x1 (), rect.at (pos).y2 ()); | 665 | rect.at (pos).x2 ()); |
1037 | 667 | 666 | GLfloat ty1 = COMP_TEX_COORD_Y (tex->matrix (), | |
1038 | 668 | glTexCoord2f ( | 667 | rect.at (pos).y1 ()); |
1039 | 669 | COMP_TEX_COORD_X (tex->matrix (), rect.at (pos).x2 ()), | 668 | GLfloat ty2 = COMP_TEX_COORD_Y (tex->matrix (), |
1040 | 670 | COMP_TEX_COORD_Y (tex->matrix (), rect.at (pos).y2 ())); | 669 | rect.at (pos).y2 ()); |
1041 | 671 | glVertex2i (rect.at (pos).x2 (), rect.at (pos).y2 ()); | 670 | |
1042 | 672 | 671 | vertexData[0] = rect.at (pos).x1 (); | |
1043 | 673 | glTexCoord2f ( | 672 | vertexData[1] = rect.at (pos).y1 (); |
1044 | 674 | COMP_TEX_COORD_X (tex->matrix (), rect.at (pos).x2 ()), | 673 | vertexData[2] = 0.0f; |
1045 | 675 | COMP_TEX_COORD_Y (tex->matrix (), rect.at (pos).y1 ())); | 674 | vertexData[3] = rect.at (pos).x1 (); |
1046 | 676 | glVertex2i (rect.at (pos).x2 (), rect.at (pos).y1 ()); | 675 | vertexData[4] = rect.at (pos).y2 (); |
1047 | 677 | 676 | vertexData[5] = 0.0f; | |
1048 | 678 | glTexCoord2f ( | 677 | vertexData[6] = rect.at (pos).x2 (); |
1049 | 679 | COMP_TEX_COORD_X (tex->matrix (), rect.at (pos).x1 ()), | 678 | vertexData[7] = rect.at (pos).y1 (); |
1050 | 680 | COMP_TEX_COORD_Y (tex->matrix (), rect.at (pos).y1 ())); | 679 | vertexData[8] = 0.0f; |
1051 | 681 | glVertex2i (rect.at (pos).x1 (), rect.at (pos).y1 ()); | 680 | vertexData[9] = rect.at (pos).x1 (); |
1052 | 682 | 681 | vertexData[10] = rect.at (pos).y2 (); | |
1053 | 682 | vertexData[11] = 0.0f; | ||
1054 | 683 | |||
1055 | 684 | vertexData[12] = rect.at (pos).x2 (); | ||
1056 | 685 | vertexData[13] = rect.at (pos).y2 (); | ||
1057 | 686 | vertexData[14] = 0.0f; | ||
1058 | 687 | |||
1059 | 688 | vertexData[15] = rect.at (pos).x2 (); | ||
1060 | 689 | vertexData[16] = rect.at (pos).y1 (); | ||
1061 | 690 | vertexData[17] = 0.0f; | ||
1062 | 691 | |||
1063 | 692 | textureData[0] = tx1; | ||
1064 | 693 | textureData[1] = ty1; | ||
1065 | 694 | |||
1066 | 695 | textureData[2] = tx1; | ||
1067 | 696 | textureData[3] = ty2; | ||
1068 | 697 | |||
1069 | 698 | textureData[4] = tx2; | ||
1070 | 699 | textureData[5] = ty1; | ||
1071 | 700 | |||
1072 | 701 | textureData[6] = tx1; | ||
1073 | 702 | textureData[7] = ty2; | ||
1074 | 703 | |||
1075 | 704 | textureData[8] = tx2; | ||
1076 | 705 | textureData[9] = ty2; | ||
1077 | 706 | |||
1078 | 707 | textureData[10] = tx2; | ||
1079 | 708 | textureData[11] = ty1; | ||
1080 | 709 | |||
1081 | 710 | streamingBuffer->addVertices (6, vertexData); | ||
1082 | 711 | streamingBuffer->addTexCoords (0, 6, textureData); | ||
1083 | 683 | pos++; | 712 | pos++; |
1084 | 684 | } | 713 | } |
1085 | 685 | 714 | ||
1087 | 686 | glEnd (); | 715 | streamingBuffer->end (); |
1088 | 716 | streamingBuffer->render (sTransform); | ||
1089 | 717 | |||
1090 | 687 | tex->disable (); | 718 | tex->disable (); |
1091 | 688 | } | 719 | } |
1092 | 689 | } | 720 | } |
1093 | @@ -691,85 +722,132 @@ | |||
1094 | 691 | switch (drawMode) | 722 | switch (drawMode) |
1095 | 692 | { | 723 | { |
1096 | 693 | case LineMode: | 724 | case LineMode: |
1097 | 694 | glColor4usv (optionGetStrokeColor ()); | ||
1098 | 695 | glLineWidth (optionGetStrokeWidth ()); | 725 | glLineWidth (optionGetStrokeWidth ()); |
1103 | 696 | glBegin (GL_LINES); | 726 | |
1104 | 697 | glVertex2i (initialPointerX, initialPointerY); | 727 | streamingBuffer->begin (GL_LINES); |
1105 | 698 | glVertex2i (lineVector.x (), lineVector.y ()); | 728 | |
1106 | 699 | glEnd (); | 729 | streamingBuffer->addColors (1, optionGetStrokeColor ()); |
1107 | 730 | |||
1108 | 731 | vertexData[0] = initialPointerX; | ||
1109 | 732 | vertexData[1] = initialPointerY; | ||
1110 | 733 | vertexData[2] = 0.0f; | ||
1111 | 734 | vertexData[3] = lineVector.x (); | ||
1112 | 735 | vertexData[4] = lineVector.y (); | ||
1113 | 736 | vertexData[5] = 0.0f; | ||
1114 | 737 | streamingBuffer->addVertices (2, vertexData); | ||
1115 | 738 | |||
1116 | 739 | streamingBuffer->end (); | ||
1117 | 740 | streamingBuffer->render (sTransform); | ||
1118 | 700 | break; | 741 | break; |
1119 | 701 | 742 | ||
1120 | 702 | case RectangleMode: | 743 | case RectangleMode: |
1121 | 744 | vertexData[0] = rectangle.x1 (); | ||
1122 | 745 | vertexData[1] = rectangle.y1 (); | ||
1123 | 746 | vertexData[2] = 0.0f; | ||
1124 | 747 | vertexData[3] = rectangle.x1 (); | ||
1125 | 748 | vertexData[4] = rectangle.y2 (); | ||
1126 | 749 | vertexData[5] = 0.0f; | ||
1127 | 750 | vertexData[6] = rectangle.x2 (); | ||
1128 | 751 | vertexData[7] = rectangle.y1 (); | ||
1129 | 752 | vertexData[8] = 0.0f; | ||
1130 | 753 | vertexData[9] = rectangle.x2 (); | ||
1131 | 754 | vertexData[10] = rectangle.y2 (); | ||
1132 | 755 | vertexData[11] = 0.0f; | ||
1133 | 756 | |||
1134 | 703 | /* fill rectangle */ | 757 | /* fill rectangle */ |
1138 | 704 | glColor4usv (optionGetFillColor ()); | 758 | streamingBuffer->begin (GL_TRIANGLE_STRIP); |
1139 | 705 | glRecti (rectangle.x1 (), rectangle.y2 (), | 759 | |
1140 | 706 | rectangle.x2 (), rectangle.y1 ()); | 760 | streamingBuffer->addColors (1, optionGetFillColor ()); |
1141 | 761 | streamingBuffer->addVertices (4, vertexData); | ||
1142 | 762 | |||
1143 | 763 | streamingBuffer->end (); | ||
1144 | 764 | streamingBuffer->render (sTransform); | ||
1145 | 707 | 765 | ||
1146 | 708 | /* draw rectangle outline */ | 766 | /* draw rectangle outline */ |
1150 | 709 | glColor4usv (optionGetStrokeColor ()); | 767 | /* streamingBuffer->begin (); |
1151 | 710 | glRecti (rectangle.x1 () - offset, rectangle.y2 (), | 768 | |
1152 | 711 | rectangle.x1 () + offset, rectangle.y1 ()); | 769 | streamingBuffer->addColors (1, optionGetStrokeColor ()); |
1153 | 770 | |||
1154 | 771 | vertexData[0] = rectangle.x1 () - offset; | ||
1155 | 772 | vertexData[3] = rectangle.x1 () - offset; | ||
1156 | 773 | streamingBuffer->addVertices (4, vertexData); | ||
1157 | 774 | |||
1158 | 712 | glRecti (rectangle.x2 () - offset, rectangle.y2 (), | 775 | glRecti (rectangle.x2 () - offset, rectangle.y2 (), |
1159 | 713 | rectangle.x2 () + offset, rectangle.y1 ()); | 776 | rectangle.x2 () + offset, rectangle.y1 ()); |
1160 | 714 | glRecti (rectangle.x1 () - offset, rectangle.y1 () + offset, | 777 | glRecti (rectangle.x1 () - offset, rectangle.y1 () + offset, |
1161 | 715 | rectangle.x2 () + offset, rectangle.y1 () - offset); | 778 | rectangle.x2 () + offset, rectangle.y1 () - offset); |
1162 | 716 | glRecti (rectangle.x1 () - offset, rectangle.y2 () + offset, | 779 | glRecti (rectangle.x1 () - offset, rectangle.y2 () + offset, |
1164 | 717 | rectangle.x2 () + offset, rectangle.y2 () - offset); | 780 | rectangle.x2 () + offset, rectangle.y2 () - offset);*/ |
1165 | 718 | break; | 781 | break; |
1166 | 719 | 782 | ||
1167 | 720 | case EllipseMode: | 783 | case EllipseMode: |
1168 | 721 | /* fill ellipse */ | 784 | /* fill ellipse */ |
1173 | 722 | glColor4usv (optionGetFillColor ()); | 785 | streamingBuffer->begin (GL_TRIANGLE_FAN); |
1174 | 723 | 786 | ||
1175 | 724 | glBegin (GL_TRIANGLE_FAN); | 787 | streamingBuffer->addColors (1, optionGetFillColor ()); |
1176 | 725 | glVertex2d (ellipse.center.x (), ellipse.center.y ()); | 788 | |
1177 | 789 | vertexData[0] = ellipse.center.x (); | ||
1178 | 790 | vertexData[1] = ellipse.center.y (); | ||
1179 | 791 | vertexData[2] = 0.0f; | ||
1180 | 792 | streamingBuffer->addVertices (1, vertexData); | ||
1181 | 793 | |||
1182 | 726 | for (angle = 0; angle <= 360; angle += 1) | 794 | for (angle = 0; angle <= 360; angle += 1) |
1183 | 727 | { | 795 | { |
1185 | 728 | vectorX = ellipse.center.x () + | 796 | vertexData[0] = ellipse.center.x () + |
1186 | 729 | (ellipse.radiusX * sinf (angle * DEG2RAD)); | 797 | (ellipse.radiusX * sinf (angle * DEG2RAD)); |
1188 | 730 | vectorY = ellipse.center.y () + | 798 | vertexData[1] = ellipse.center.y () + |
1189 | 731 | (ellipse.radiusY * cosf (angle * DEG2RAD)); | 799 | (ellipse.radiusY * cosf (angle * DEG2RAD)); |
1191 | 732 | glVertex2d (vectorX, vectorY); | 800 | streamingBuffer->addVertices (1, vertexData); |
1192 | 733 | } | 801 | } |
1196 | 734 | glVertex2d (ellipse.center.x (), ellipse.center.y () + | 802 | |
1197 | 735 | ellipse.radiusY); | 803 | vertexData[0] = ellipse.center.x (); |
1198 | 736 | glEnd(); | 804 | vertexData[1] = ellipse.center.y () + ellipse.radiusY; |
1199 | 805 | streamingBuffer->addVertices (1, vertexData); | ||
1200 | 806 | |||
1201 | 807 | streamingBuffer->end (); | ||
1202 | 808 | streamingBuffer->render (sTransform); | ||
1203 | 737 | 809 | ||
1204 | 738 | /* draw ellipse outline */ | 810 | /* draw ellipse outline */ |
1205 | 739 | glColor4usv (optionGetStrokeColor ()); | ||
1206 | 740 | glLineWidth (optionGetStrokeWidth ()); | 811 | glLineWidth (optionGetStrokeWidth ()); |
1207 | 741 | 812 | ||
1211 | 742 | glBegin (GL_TRIANGLE_STRIP); | 813 | streamingBuffer->begin (GL_TRIANGLE_STRIP); |
1212 | 743 | glVertex2d (ellipse.center.x (), ellipse.center.y () + | 814 | |
1213 | 744 | ellipse.radiusY - offset); | 815 | streamingBuffer->addColors (1, optionGetStrokeColor ()); |
1214 | 816 | |||
1215 | 817 | |||
1216 | 818 | vertexData[0] = ellipse.center.x (); | ||
1217 | 819 | vertexData[1] = ellipse.center.y () + ellipse.radiusY - offset; | ||
1218 | 820 | vertexData[2] = 0.0f; | ||
1219 | 821 | streamingBuffer->addVertices (1, vertexData); | ||
1220 | 822 | |||
1221 | 745 | for (angle = 360; angle >= 0; angle -= 1) | 823 | for (angle = 360; angle >= 0; angle -= 1) |
1222 | 746 | { | 824 | { |
1233 | 747 | vectorX = ellipse.center.x () + ((ellipse.radiusX - | 825 | vertexData[0] = ellipse.center.x () + ((ellipse.radiusX - |
1234 | 748 | offset) * sinf (angle * DEG2RAD)); | 826 | offset) * sinf (angle * DEG2RAD)); |
1235 | 749 | vectorY = ellipse.center.y () + ((ellipse.radiusY - | 827 | vertexData[1] = ellipse.center.y () + ((ellipse.radiusY - |
1236 | 750 | offset) * cosf (angle * DEG2RAD)); | 828 | offset) * cosf (angle * DEG2RAD)); |
1237 | 751 | glVertex2d (vectorX, vectorY); | 829 | vertexData[2] = 0.0f; |
1238 | 752 | vectorX = ellipse.center.x () + ((ellipse.radiusX + | 830 | vertexData[3] = ellipse.center.x () + ((ellipse.radiusX + |
1239 | 753 | offset) * sinf (angle * DEG2RAD)); | 831 | offset) * sinf (angle * DEG2RAD)); |
1240 | 754 | vectorY = ellipse.center.y () + ((ellipse.radiusY + | 832 | vertexData[4] = ellipse.center.y () + ((ellipse.radiusY + |
1241 | 755 | offset) * cosf (angle * DEG2RAD)); | 833 | offset) * cosf (angle * DEG2RAD)); |
1242 | 756 | glVertex2d (vectorX, vectorY); | 834 | vertexData[5] = 0.0f; |
1243 | 835 | streamingBuffer->addVertices (2, vertexData); | ||
1244 | 757 | } | 836 | } |
1248 | 758 | glVertex2d (ellipse.center.x (), ellipse.center.y () + | 837 | |
1249 | 759 | ellipse.radiusY + offset); | 838 | vertexData[0] = ellipse.center.x (); |
1250 | 760 | glEnd(); | 839 | vertexData[1] = ellipse.center.y () + ellipse.radiusY + offset; |
1251 | 840 | streamingBuffer->addVertices (1, vertexData); | ||
1252 | 841 | |||
1253 | 842 | streamingBuffer->end (); | ||
1254 | 843 | streamingBuffer->render (sTransform); | ||
1255 | 761 | break; | 844 | break; |
1256 | 762 | 845 | ||
1257 | 763 | default: | 846 | default: |
1258 | 764 | break; | 847 | break; |
1259 | 765 | } | 848 | } |
1260 | 766 | 849 | ||
1261 | 767 | /* clean up */ | ||
1262 | 768 | glColor4usv (defaultColor); | ||
1263 | 769 | glDisable (GL_BLEND); | 850 | glDisable (GL_BLEND); |
1264 | 770 | glEnableClientState (GL_TEXTURE_COORD_ARRAY); | ||
1265 | 771 | |||
1266 | 772 | glPopMatrix (); | ||
1267 | 773 | } | 851 | } |
1268 | 774 | 852 | ||
1269 | 775 | return status; | 853 | return status; |
1270 | 776 | 854 | ||
1271 | === modified file 'plugins/blur/CMakeLists.txt' | |||
1272 | --- plugins/blur/CMakeLists.txt 2011-01-24 06:28:52 +0000 | |||
1273 | +++ plugins/blur/CMakeLists.txt 2012-08-22 06:16:22 +0000 | |||
1274 | @@ -2,15 +2,15 @@ | |||
1275 | 2 | 2 | ||
1276 | 3 | include (CompizPlugin) | 3 | include (CompizPlugin) |
1277 | 4 | 4 | ||
1290 | 5 | find_package (OpenGL) | 5 | #find_package (OpenGL) |
1291 | 6 | 6 | ||
1292 | 7 | if (OPENGL_GLU_FOUND) | 7 | #if (OPENGL_GLU_FOUND) |
1293 | 8 | compiz_plugin(blur PLUGINDEPS composite opengl LIBRARIES decoration ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR}) | 8 | # compiz_plugin(blur PLUGINDEPS composite opengl LIBRARIES decoration ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR}) |
1294 | 9 | 9 | ||
1295 | 10 | if (COMPIZ_BUILD_WITH_RPATH AND NOT COMPIZ_DISABLE_PLUGIN_BLUR) | 10 | # if (COMPIZ_BUILD_WITH_RPATH AND NOT COMPIZ_DISABLE_PLUGIN_BLUR) |
1296 | 11 | set_target_properties ( | 11 | # set_target_properties ( |
1297 | 12 | blur PROPERTIES | 12 | # blur PROPERTIES |
1298 | 13 | INSTALL_RPATH "${COMPIZ_LIBDIR}" | 13 | # INSTALL_RPATH "${COMPIZ_LIBDIR}" |
1299 | 14 | ) | 14 | # ) |
1300 | 15 | endif (COMPIZ_BUILD_WITH_RPATH AND NOT COMPIZ_DISABLE_PLUGIN_BLUR) | 15 | # endif (COMPIZ_BUILD_WITH_RPATH AND NOT COMPIZ_DISABLE_PLUGIN_BLUR) |
1301 | 16 | endif () | 16 | #endif () |
1302 | 17 | 17 | ||
1303 | === modified file 'plugins/clone/src/clone.cpp' | |||
1304 | --- plugins/clone/src/clone.cpp 2012-07-30 09:20:41 +0000 | |||
1305 | +++ plugins/clone/src/clone.cpp 2012-08-22 06:16:22 +0000 | |||
1306 | @@ -295,9 +295,6 @@ | |||
1307 | 295 | 0.0f); | 295 | 0.0f); |
1308 | 296 | sTransform.scale (zoomX, zoomY, 1.0f); | 296 | sTransform.scale (zoomX, zoomY, 1.0f); |
1309 | 297 | 297 | ||
1310 | 298 | glPushMatrix (); | ||
1311 | 299 | glLoadMatrixf (sTransform.getMatrix ()); | ||
1312 | 300 | |||
1313 | 301 | filter = gScreen->textureFilter (); | 298 | filter = gScreen->textureFilter (); |
1314 | 302 | 299 | ||
1315 | 303 | if (offset == 0.0f) | 300 | if (offset == 0.0f) |
1316 | @@ -325,8 +322,6 @@ | |||
1317 | 325 | } | 322 | } |
1318 | 326 | 323 | ||
1319 | 327 | gScreen->setTextureFilter (filter); | 324 | gScreen->setTextureFilter (filter); |
1320 | 328 | |||
1321 | 329 | glPopMatrix (); | ||
1322 | 330 | } | 325 | } |
1323 | 331 | 326 | ||
1324 | 332 | return status; | 327 | return status; |
1325 | 333 | 328 | ||
1326 | === modified file 'plugins/compiztoolbox/src/compiztoolbox.cpp' | |||
1327 | --- plugins/compiztoolbox/src/compiztoolbox.cpp 2012-07-30 11:20:17 +0000 | |||
1328 | +++ plugins/compiztoolbox/src/compiztoolbox.cpp 2012-08-22 06:16:22 +0000 | |||
1329 | @@ -465,9 +465,7 @@ | |||
1330 | 465 | sAttrib.yTranslate = wy - g.y () + | 465 | sAttrib.yTranslate = wy - g.y () + |
1331 | 466 | window->border ().top * sAttrib.yScale; | 466 | window->border ().top * sAttrib.yScale; |
1332 | 467 | 467 | ||
1336 | 468 | GLFragment::Attrib fragment (sAttrib); | 468 | if (window->alpha () || sAttrib.opacity != OPAQUE) |
1334 | 469 | |||
1335 | 470 | if (window->alpha () || fragment.getOpacity () != OPAQUE) | ||
1337 | 471 | mask |= PAINT_WINDOW_TRANSLUCENT_MASK; | 469 | mask |= PAINT_WINDOW_TRANSLUCENT_MASK; |
1338 | 472 | 470 | ||
1339 | 473 | wTransform.translate (g.x (), g.y (), 0.0f); | 471 | wTransform.translate (g.x (), g.y (), 0.0f); |
1340 | @@ -476,9 +474,6 @@ | |||
1341 | 476 | sAttrib.yTranslate / sAttrib.yScale - g.y (), | 474 | sAttrib.yTranslate / sAttrib.yScale - g.y (), |
1342 | 477 | 0.0f); | 475 | 0.0f); |
1343 | 478 | 476 | ||
1344 | 479 | glPushMatrix (); | ||
1345 | 480 | glLoadMatrixf (wTransform.getMatrix ()); | ||
1346 | 481 | |||
1347 | 482 | filter = gScreen->textureFilter (); | 477 | filter = gScreen->textureFilter (); |
1348 | 483 | 478 | ||
1349 | 484 | if (baseScreen->getMipmap ()) | 479 | if (baseScreen->getMipmap ()) |
1350 | @@ -488,13 +483,11 @@ | |||
1351 | 488 | very ugly but necessary until the vertex stage has been made | 483 | very ugly but necessary until the vertex stage has been made |
1352 | 489 | fully pluggable. */ | 484 | fully pluggable. */ |
1353 | 490 | gWindow->glAddGeometrySetCurrentIndex (MAXSHORT); | 485 | gWindow->glAddGeometrySetCurrentIndex (MAXSHORT); |
1355 | 491 | gWindow->glDraw (wTransform, fragment, infiniteRegion, mask); | 486 | gWindow->glDraw (wTransform, sAttrib, infiniteRegion, mask); |
1356 | 492 | gWindow->glAddGeometrySetCurrentIndex (addWindowGeometryIndex); | 487 | gWindow->glAddGeometrySetCurrentIndex (addWindowGeometryIndex); |
1357 | 493 | 488 | ||
1358 | 494 | gScreen->setTextureFilter (filter); | 489 | gScreen->setTextureFilter (filter); |
1359 | 495 | 490 | ||
1360 | 496 | glPopMatrix (); | ||
1361 | 497 | |||
1362 | 498 | if (iconMode != HideIcon) | 491 | if (iconMode != HideIcon) |
1363 | 499 | { | 492 | { |
1364 | 500 | icon = gWindow->getIcon (MAX_ICON_SIZE, MAX_ICON_SIZE); | 493 | icon = gWindow->getIcon (MAX_ICON_SIZE, MAX_ICON_SIZE); |
1365 | @@ -535,15 +528,14 @@ | |||
1366 | 535 | sAttrib.xTranslate = wx - g.x (); | 528 | sAttrib.xTranslate = wx - g.x (); |
1367 | 536 | sAttrib.yTranslate = wy - g.y (); | 529 | sAttrib.yTranslate = wy - g.y (); |
1368 | 537 | 530 | ||
1370 | 538 | gWindow->geometry ().reset (); | 531 | gWindow->vertexBuffer ()->begin (); |
1371 | 539 | 532 | ||
1372 | 540 | gWindow->glAddGeometrySetCurrentIndex (MAXSHORT); | 533 | gWindow->glAddGeometrySetCurrentIndex (MAXSHORT); |
1373 | 541 | gWindow->glAddGeometry (matrix, iconReg, infiniteRegion); | 534 | gWindow->glAddGeometry (matrix, iconReg, infiniteRegion); |
1374 | 542 | gWindow->glAddGeometrySetCurrentIndex (addWindowGeometryIndex); | 535 | gWindow->glAddGeometrySetCurrentIndex (addWindowGeometryIndex); |
1375 | 543 | 536 | ||
1377 | 544 | if (gWindow->geometry ().vCount) | 537 | if (gWindow->vertexBuffer ()->end ()) |
1378 | 545 | { | 538 | { |
1379 | 546 | GLFragment::Attrib fragment (sAttrib); | ||
1380 | 547 | GLMatrix wTransform (transform); | 539 | GLMatrix wTransform (transform); |
1381 | 548 | 540 | ||
1382 | 549 | wTransform.translate (g.x (), g.y (), 0.0f); | 541 | wTransform.translate (g.x (), g.y (), 0.0f); |
1383 | @@ -552,12 +544,7 @@ | |||
1384 | 552 | sAttrib.yTranslate / sAttrib.yScale - g.y (), | 544 | sAttrib.yTranslate / sAttrib.yScale - g.y (), |
1385 | 553 | 0.0f); | 545 | 0.0f); |
1386 | 554 | 546 | ||
1393 | 555 | glPushMatrix (); | 547 | gWindow->glDrawTexture (icon, wTransform, sAttrib, mask); |
1388 | 556 | glLoadMatrixf (wTransform.getMatrix ()); | ||
1389 | 557 | |||
1390 | 558 | gWindow->glDrawTexture (icon, fragment, mask); | ||
1391 | 559 | |||
1392 | 560 | glPopMatrix (); | ||
1394 | 561 | } | 548 | } |
1395 | 562 | } | 549 | } |
1396 | 563 | } | 550 | } |
1397 | 564 | 551 | ||
1398 | === modified file 'plugins/copytex/src/copytex.cpp' | |||
1399 | --- plugins/copytex/src/copytex.cpp 2012-06-24 10:12:15 +0000 | |||
1400 | +++ plugins/copytex/src/copytex.cpp 2012-08-22 06:16:22 +0000 | |||
1401 | @@ -112,6 +112,14 @@ | |||
1402 | 112 | GLenum target; | 112 | GLenum target; |
1403 | 113 | GLTexture::Matrix matrix = _identity_matrix; | 113 | GLTexture::Matrix matrix = _identity_matrix; |
1404 | 114 | 114 | ||
1405 | 115 | #ifdef USE_GLES | ||
1406 | 116 | target = GL_TEXTURE_2D; | ||
1407 | 117 | matrix.xx = 1.0f / dim.width (); | ||
1408 | 118 | matrix.yy = 1.0f / dim.height (); | ||
1409 | 119 | matrix.x0 = -dim.x () * matrix.xx; | ||
1410 | 120 | matrix.y0 = -dim.y () * matrix.yy; | ||
1411 | 121 | #else | ||
1412 | 122 | |||
1413 | 115 | if (GL::textureNonPowerOfTwo || | 123 | if (GL::textureNonPowerOfTwo || |
1414 | 116 | (POWER_OF_TWO (dim.width ()) && POWER_OF_TWO (dim.height ()))) | 124 | (POWER_OF_TWO (dim.width ()) && POWER_OF_TWO (dim.height ()))) |
1415 | 117 | { | 125 | { |
1416 | @@ -129,6 +137,7 @@ | |||
1417 | 129 | matrix.x0 = -dim.x (); | 137 | matrix.x0 = -dim.x (); |
1418 | 130 | matrix.y0 = -dim.y (); | 138 | matrix.y0 = -dim.y (); |
1419 | 131 | } | 139 | } |
1420 | 140 | #endif | ||
1421 | 132 | 141 | ||
1422 | 133 | setData (target, matrix, false); | 142 | setData (target, matrix, false); |
1423 | 134 | setGeometry (dim.x1 (), dim.y1 (), dim.x2 () - dim.x1 (), dim.y2 () - dim.y1 ()); | 143 | setGeometry (dim.x1 (), dim.y1 (), dim.x2 () - dim.x1 (), dim.y2 () - dim.y1 ()); |
1424 | 135 | 144 | ||
1425 | === modified file 'plugins/cube/include/cube/cube.h' | |||
1426 | --- plugins/cube/include/cube/cube.h 2012-01-18 16:26:45 +0000 | |||
1427 | +++ plugins/cube/include/cube/cube.h 2012-08-22 06:16:22 +0000 | |||
1428 | @@ -62,15 +62,18 @@ | |||
1429 | 62 | virtual void cubePaintTop (const GLScreenPaintAttrib &sAttrib, | 62 | virtual void cubePaintTop (const GLScreenPaintAttrib &sAttrib, |
1430 | 63 | const GLMatrix &transform, | 63 | const GLMatrix &transform, |
1431 | 64 | CompOutput *output, | 64 | CompOutput *output, |
1433 | 65 | int size); | 65 | int size, |
1434 | 66 | const GLVector &normal); | ||
1435 | 66 | virtual void cubePaintBottom (const GLScreenPaintAttrib &sAttrib, | 67 | virtual void cubePaintBottom (const GLScreenPaintAttrib &sAttrib, |
1436 | 67 | const GLMatrix &transform, | 68 | const GLMatrix &transform, |
1437 | 68 | CompOutput *output, | 69 | CompOutput *output, |
1439 | 69 | int size); | 70 | int size, |
1440 | 71 | const GLVector &normal); | ||
1441 | 70 | virtual void cubePaintInside (const GLScreenPaintAttrib &sAttrib, | 72 | virtual void cubePaintInside (const GLScreenPaintAttrib &sAttrib, |
1442 | 71 | const GLMatrix &transform, | 73 | const GLMatrix &transform, |
1443 | 72 | CompOutput *output, | 74 | CompOutput *output, |
1445 | 73 | int size); | 75 | int size, |
1446 | 76 | const GLVector &normal); | ||
1447 | 74 | virtual bool cubeCheckOrientation (const GLScreenPaintAttrib &sAttrib, | 77 | virtual bool cubeCheckOrientation (const GLScreenPaintAttrib &sAttrib, |
1448 | 75 | const GLMatrix &transform, | 78 | const GLMatrix &transform, |
1449 | 76 | CompOutput *output, | 79 | CompOutput *output, |
1450 | @@ -120,13 +123,13 @@ | |||
1451 | 120 | float, float); | 123 | float, float); |
1452 | 121 | WRAPABLE_HND (2, CubeScreenInterface, void, cubePaintTop, | 124 | WRAPABLE_HND (2, CubeScreenInterface, void, cubePaintTop, |
1453 | 122 | const GLScreenPaintAttrib &, const GLMatrix &, | 125 | const GLScreenPaintAttrib &, const GLMatrix &, |
1455 | 123 | CompOutput *, int); | 126 | CompOutput *, int, const GLVector &); |
1456 | 124 | WRAPABLE_HND (3, CubeScreenInterface, void, cubePaintBottom, | 127 | WRAPABLE_HND (3, CubeScreenInterface, void, cubePaintBottom, |
1457 | 125 | const GLScreenPaintAttrib &, const GLMatrix &, | 128 | const GLScreenPaintAttrib &, const GLMatrix &, |
1459 | 126 | CompOutput *, int); | 129 | CompOutput *, int, const GLVector &); |
1460 | 127 | WRAPABLE_HND (4, CubeScreenInterface, void, cubePaintInside, | 130 | WRAPABLE_HND (4, CubeScreenInterface, void, cubePaintInside, |
1461 | 128 | const GLScreenPaintAttrib &, const GLMatrix &, | 131 | const GLScreenPaintAttrib &, const GLMatrix &, |
1463 | 129 | CompOutput *, int); | 132 | CompOutput *, int, const GLVector &); |
1464 | 130 | WRAPABLE_HND (5, CubeScreenInterface, bool, cubeCheckOrientation, | 133 | WRAPABLE_HND (5, CubeScreenInterface, bool, cubeCheckOrientation, |
1465 | 131 | const GLScreenPaintAttrib &, const GLMatrix &, | 134 | const GLScreenPaintAttrib &, const GLMatrix &, |
1466 | 132 | CompOutput *, std::vector<GLVector> &); | 135 | CompOutput *, std::vector<GLVector> &); |
1467 | 133 | 136 | ||
1468 | === modified file 'plugins/cube/src/cube.cpp' | |||
1469 | --- plugins/cube/src/cube.cpp 2012-01-16 09:50:28 +0000 | |||
1470 | +++ plugins/cube/src/cube.cpp 2012-08-22 06:16:22 +0000 | |||
1471 | @@ -55,22 +55,25 @@ | |||
1472 | 55 | CubeScreenInterface::cubePaintTop (const GLScreenPaintAttrib &sAttrib, | 55 | CubeScreenInterface::cubePaintTop (const GLScreenPaintAttrib &sAttrib, |
1473 | 56 | const GLMatrix &transform, | 56 | const GLMatrix &transform, |
1474 | 57 | CompOutput *output, | 57 | CompOutput *output, |
1477 | 58 | int size) | 58 | int size, |
1478 | 59 | WRAPABLE_DEF (cubePaintTop, sAttrib, transform, output, size) | 59 | const GLVector &normal) |
1479 | 60 | WRAPABLE_DEF (cubePaintTop, sAttrib, transform, output, size, normal) | ||
1480 | 60 | 61 | ||
1481 | 61 | void | 62 | void |
1482 | 62 | CubeScreenInterface::cubePaintBottom (const GLScreenPaintAttrib &sAttrib, | 63 | CubeScreenInterface::cubePaintBottom (const GLScreenPaintAttrib &sAttrib, |
1483 | 63 | const GLMatrix &transform, | 64 | const GLMatrix &transform, |
1484 | 64 | CompOutput *output, | 65 | CompOutput *output, |
1487 | 65 | int size) | 66 | int size, |
1488 | 66 | WRAPABLE_DEF (cubePaintBottom, sAttrib, transform, output, size) | 67 | const GLVector &normal) |
1489 | 68 | WRAPABLE_DEF (cubePaintBottom, sAttrib, transform, output, size, normal) | ||
1490 | 67 | 69 | ||
1491 | 68 | void | 70 | void |
1492 | 69 | CubeScreenInterface::cubePaintInside (const GLScreenPaintAttrib &sAttrib, | 71 | CubeScreenInterface::cubePaintInside (const GLScreenPaintAttrib &sAttrib, |
1493 | 70 | const GLMatrix &transform, | 72 | const GLMatrix &transform, |
1494 | 71 | CompOutput *output, | 73 | CompOutput *output, |
1497 | 72 | int size) | 74 | int size, |
1498 | 73 | WRAPABLE_DEF (cubePaintInside, sAttrib, transform, output, size) | 75 | const GLVector &normal) |
1499 | 76 | WRAPABLE_DEF (cubePaintInside, sAttrib, transform, output, size, normal) | ||
1500 | 74 | 77 | ||
1501 | 75 | bool | 78 | bool |
1502 | 76 | CubeScreenInterface::cubeCheckOrientation (const GLScreenPaintAttrib &sAttrib, | 79 | CubeScreenInterface::cubeCheckOrientation (const GLScreenPaintAttrib &sAttrib, |
1503 | @@ -433,6 +436,7 @@ | |||
1504 | 433 | } | 436 | } |
1505 | 434 | } | 437 | } |
1506 | 435 | 438 | ||
1507 | 439 | #ifndef USE_GLES | ||
1508 | 436 | static bool | 440 | static bool |
1509 | 437 | fillCircleTable (GLfloat **ppSint, | 441 | fillCircleTable (GLfloat **ppSint, |
1510 | 438 | GLfloat **ppCost, | 442 | GLfloat **ppCost, |
1511 | @@ -467,10 +471,12 @@ | |||
1512 | 467 | 471 | ||
1513 | 468 | return true; | 472 | return true; |
1514 | 469 | } | 473 | } |
1515 | 474 | #endif | ||
1516 | 470 | 475 | ||
1517 | 471 | void | 476 | void |
1518 | 472 | PrivateCubeScreen::updateSkydomeList (GLfloat fRadius) | 477 | PrivateCubeScreen::updateSkydomeList (GLfloat fRadius) |
1519 | 473 | { | 478 | { |
1520 | 479 | #ifndef USE_GLES | ||
1521 | 474 | GLint iSlices = 128; | 480 | GLint iSlices = 128; |
1522 | 475 | GLint iStacks = 64; | 481 | GLint iStacks = 64; |
1523 | 476 | GLfloat afTexCoordX[4]; | 482 | GLfloat afTexCoordX[4]; |
1524 | @@ -532,6 +538,7 @@ | |||
1525 | 532 | afTexCoordX[3] = 1.0f; | 538 | afTexCoordX[3] = 1.0f; |
1526 | 533 | afTexCoordY[3] = 1.0f; | 539 | afTexCoordY[3] = 1.0f; |
1527 | 534 | 540 | ||
1528 | 541 | |||
1529 | 535 | if (!mSkyListId) | 542 | if (!mSkyListId) |
1530 | 536 | mSkyListId = glGenLists (1); | 543 | mSkyListId = glGenLists (1); |
1531 | 537 | 544 | ||
1532 | @@ -616,6 +623,8 @@ | |||
1533 | 616 | free (cost1); | 623 | free (cost1); |
1534 | 617 | free (sint2); | 624 | free (sint2); |
1535 | 618 | free (cost2); | 625 | free (cost2); |
1536 | 626 | |||
1537 | 627 | #endif | ||
1538 | 619 | } | 628 | } |
1539 | 620 | 629 | ||
1540 | 621 | bool | 630 | bool |
1541 | @@ -818,7 +827,7 @@ | |||
1542 | 818 | { | 827 | { |
1543 | 819 | WRAPABLE_HND_FUNCTN_RETURN (bool, cubeCheckOrientation, sAttrib, transform, output, points) | 828 | WRAPABLE_HND_FUNCTN_RETURN (bool, cubeCheckOrientation, sAttrib, transform, output, points) |
1544 | 820 | GLMatrix sTransform = transform; | 829 | GLMatrix sTransform = transform; |
1546 | 821 | GLMatrix mvp, pm (priv->gScreen->projectionMatrix ()); | 830 | GLMatrix mvp, pm (priv->gScreen->projectionMatrix ()->getMatrix ()); |
1547 | 822 | GLVector pntA, pntB, pntC; | 831 | GLVector pntA, pntB, pntC; |
1548 | 823 | GLVector vecA, vecB, ortho; | 832 | GLVector vecA, vecB, ortho; |
1549 | 824 | bool rv = false; | 833 | bool rv = false; |
1550 | @@ -1063,7 +1072,7 @@ | |||
1551 | 1063 | if (priv->mSky.size () > 0) | 1072 | if (priv->mSky.size () > 0) |
1552 | 1064 | { | 1073 | { |
1553 | 1065 | priv->gScreen->setLighting (false); | 1074 | priv->gScreen->setLighting (false); |
1555 | 1066 | 1075 | #ifndef USE_GLES | |
1556 | 1067 | glPushMatrix (); | 1076 | glPushMatrix (); |
1557 | 1068 | 1077 | ||
1558 | 1069 | if (priv->optionGetSkydomeAnimated () && | 1078 | if (priv->optionGetSkydomeAnimated () && |
1559 | @@ -1079,6 +1088,7 @@ | |||
1560 | 1079 | 1088 | ||
1561 | 1080 | glCallList (priv->mSkyListId); | 1089 | glCallList (priv->mSkyListId); |
1562 | 1081 | glPopMatrix (); | 1090 | glPopMatrix (); |
1563 | 1091 | #endif | ||
1564 | 1082 | } | 1092 | } |
1565 | 1083 | else | 1093 | else |
1566 | 1084 | { | 1094 | { |
1567 | @@ -1090,9 +1100,10 @@ | |||
1568 | 1090 | CubeScreen::cubePaintTop (const GLScreenPaintAttrib &sAttrib, | 1100 | CubeScreen::cubePaintTop (const GLScreenPaintAttrib &sAttrib, |
1569 | 1091 | const GLMatrix &transform, | 1101 | const GLMatrix &transform, |
1570 | 1092 | CompOutput *output, | 1102 | CompOutput *output, |
1572 | 1093 | int size) | 1103 | int size, |
1573 | 1104 | const GLVector &normal) | ||
1574 | 1094 | { | 1105 | { |
1576 | 1095 | WRAPABLE_HND_FUNCTN (cubePaintTop, sAttrib, transform, output, size) | 1106 | WRAPABLE_HND_FUNCTN (cubePaintTop, sAttrib, transform, output, size, normal) |
1577 | 1096 | 1107 | ||
1578 | 1097 | GLScreenPaintAttrib sa = sAttrib; | 1108 | GLScreenPaintAttrib sa = sAttrib; |
1579 | 1098 | GLMatrix sTransform = transform; | 1109 | GLMatrix sTransform = transform; |
1580 | @@ -1105,51 +1116,49 @@ | |||
1581 | 1105 | color = priv->optionGetTopColor (); | 1116 | color = priv->optionGetTopColor (); |
1582 | 1106 | opacity = priv->mDesktopOpacity * color[3] / 0xffff; | 1117 | opacity = priv->mDesktopOpacity * color[3] / 0xffff; |
1583 | 1107 | 1118 | ||
1588 | 1108 | glColor4us (color[0] * opacity / 0xffff, | 1119 | GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer (); |
1589 | 1109 | color[1] * opacity / 0xffff, | 1120 | std::vector <GLushort> colorData; |
1586 | 1110 | color[2] * opacity / 0xffff, | ||
1587 | 1111 | opacity); | ||
1590 | 1112 | 1121 | ||
1592 | 1113 | glPushMatrix (); | 1122 | colorData.push_back (color[0] * opacity / 0xffff); |
1593 | 1123 | colorData.push_back (color[1] * opacity / 0xffff); | ||
1594 | 1124 | colorData.push_back (color[2] * opacity / 0xffff); | ||
1595 | 1125 | colorData.push_back (opacity); | ||
1596 | 1114 | 1126 | ||
1597 | 1115 | sa.yRotate += (360.0f / size) * (priv->mXRotations + 1); | 1127 | sa.yRotate += (360.0f / size) * (priv->mXRotations + 1); |
1598 | 1116 | 1128 | ||
1599 | 1117 | priv->gScreen->glApplyTransform (sa, output, &sTransform); | 1129 | priv->gScreen->glApplyTransform (sa, output, &sTransform); |
1600 | 1118 | 1130 | ||
1604 | 1119 | glLoadMatrixf (sTransform.getMatrix ()); | 1131 | sTransform.translate (priv->mOutputXOffset, -priv->mOutputYOffset, 0.0f); |
1605 | 1120 | glTranslatef (priv->mOutputXOffset, -priv->mOutputYOffset, 0.0f); | 1132 | sTransform.scale (priv->mOutputXScale, priv->mOutputYScale, 1.0f); |
1603 | 1121 | glScalef (priv->mOutputXScale, priv->mOutputYScale, 1.0f); | ||
1606 | 1122 | 1133 | ||
1607 | 1123 | if ((priv->mDesktopOpacity != OPAQUE) || (color[3] != OPAQUE)) | 1134 | if ((priv->mDesktopOpacity != OPAQUE) || (color[3] != OPAQUE)) |
1608 | 1124 | { | 1135 | { |
1609 | 1136 | #ifndef USE_GLES | ||
1610 | 1125 | priv->gScreen->setTexEnvMode (GL_MODULATE); | 1137 | priv->gScreen->setTexEnvMode (GL_MODULATE); |
1612 | 1126 | glEnable (GL_BLEND); | 1138 | #endif |
1613 | 1127 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 1139 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
1614 | 1128 | } | 1140 | } |
1615 | 1129 | 1141 | ||
1617 | 1130 | glVertexPointer (3, GL_FLOAT, 0, priv->mVertices); | 1142 | bool withTexture = priv->mInvert == 1 && size == 4 && priv->mTexture.size (); |
1618 | 1131 | 1143 | ||
1621 | 1132 | if (priv->mInvert == 1 && size == 4 && priv->mTexture.size ()) | 1144 | if (withTexture) |
1620 | 1133 | { | ||
1622 | 1134 | priv->mTexture[0]->enable (GLTexture::Good); | 1145 | priv->mTexture[0]->enable (GLTexture::Good); |
1625 | 1135 | glTexCoordPointer (2, GL_FLOAT, 0, priv->mTc); | 1146 | |
1626 | 1136 | glDrawArrays (GL_TRIANGLE_FAN, 0, priv->mNVertices >> 1); | 1147 | streamingBuffer->begin (GL_TRIANGLE_FAN); |
1627 | 1148 | streamingBuffer->addColors (1, &(colorData[0])); | ||
1628 | 1149 | streamingBuffer->addVertices (priv->mNVertices >> 1, priv->mVertices); | ||
1629 | 1150 | streamingBuffer->addNormals (1, const_cast <GLfloat *> (&normal[0])); | ||
1630 | 1151 | |||
1631 | 1152 | if (withTexture) | ||
1632 | 1153 | streamingBuffer->addTexCoords (0, 2, priv->mTc); | ||
1633 | 1154 | |||
1634 | 1155 | streamingBuffer->end (); | ||
1635 | 1156 | streamingBuffer->render (sTransform); | ||
1636 | 1157 | |||
1637 | 1158 | if (withTexture) | ||
1638 | 1137 | priv->mTexture[0]->disable (); | 1159 | priv->mTexture[0]->disable (); |
1639 | 1138 | glDisableClientState (GL_TEXTURE_COORD_ARRAY); | ||
1640 | 1139 | } | ||
1641 | 1140 | else | ||
1642 | 1141 | { | ||
1643 | 1142 | glDisableClientState (GL_TEXTURE_COORD_ARRAY); | ||
1644 | 1143 | glDrawArrays (GL_TRIANGLE_FAN, 0, priv->mNVertices >> 1); | ||
1645 | 1144 | } | ||
1646 | 1145 | |||
1647 | 1146 | glPopMatrix (); | ||
1648 | 1147 | |||
1649 | 1148 | glColor4usv (defaultColor); | ||
1650 | 1149 | glEnableClientState (GL_TEXTURE_COORD_ARRAY); | ||
1651 | 1150 | 1160 | ||
1652 | 1151 | priv->gScreen->setTexEnvMode (GL_REPLACE); | 1161 | priv->gScreen->setTexEnvMode (GL_REPLACE); |
1653 | 1152 | glDisable (GL_BLEND); | ||
1654 | 1153 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | 1162 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
1655 | 1154 | } | 1163 | } |
1656 | 1155 | 1164 | ||
1657 | @@ -1157,9 +1166,10 @@ | |||
1658 | 1157 | CubeScreen::cubePaintBottom (const GLScreenPaintAttrib &sAttrib, | 1166 | CubeScreen::cubePaintBottom (const GLScreenPaintAttrib &sAttrib, |
1659 | 1158 | const GLMatrix &transform, | 1167 | const GLMatrix &transform, |
1660 | 1159 | CompOutput *output, | 1168 | CompOutput *output, |
1662 | 1160 | int size) | 1169 | int size, |
1663 | 1170 | const GLVector &normal) | ||
1664 | 1161 | { | 1171 | { |
1666 | 1162 | WRAPABLE_HND_FUNCTN (cubePaintBottom, sAttrib, transform, output, size) | 1172 | WRAPABLE_HND_FUNCTN (cubePaintBottom, sAttrib, transform, output, size, normal) |
1667 | 1163 | 1173 | ||
1668 | 1164 | GLScreenPaintAttrib sa = sAttrib; | 1174 | GLScreenPaintAttrib sa = sAttrib; |
1669 | 1165 | GLMatrix sTransform = transform; | 1175 | GLMatrix sTransform = transform; |
1670 | @@ -1172,41 +1182,40 @@ | |||
1671 | 1172 | color = priv->optionGetBottomColor (); | 1182 | color = priv->optionGetBottomColor (); |
1672 | 1173 | opacity = priv->mDesktopOpacity * color[3] / 0xffff; | 1183 | opacity = priv->mDesktopOpacity * color[3] / 0xffff; |
1673 | 1174 | 1184 | ||
1678 | 1175 | glColor4us (color[0] * opacity / 0xffff, | 1185 | GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer (); |
1679 | 1176 | color[1] * opacity / 0xffff, | 1186 | std::vector <GLushort> colorData; |
1676 | 1177 | color[2] * opacity / 0xffff, | ||
1677 | 1178 | opacity); | ||
1680 | 1179 | 1187 | ||
1682 | 1180 | glPushMatrix (); | 1188 | colorData.push_back (color[0] * opacity / 0xffff); |
1683 | 1189 | colorData.push_back (color[1] * opacity / 0xffff); | ||
1684 | 1190 | colorData.push_back (color[2] * opacity / 0xffff); | ||
1685 | 1191 | colorData.push_back (opacity); | ||
1686 | 1181 | 1192 | ||
1687 | 1182 | sa.yRotate += (360.0f / size) * (priv->mXRotations + 1); | 1193 | sa.yRotate += (360.0f / size) * (priv->mXRotations + 1); |
1688 | 1183 | 1194 | ||
1689 | 1184 | priv->gScreen->glApplyTransform (sa, output, &sTransform); | 1195 | priv->gScreen->glApplyTransform (sa, output, &sTransform); |
1690 | 1185 | 1196 | ||
1694 | 1186 | glLoadMatrixf (sTransform.getMatrix ()); | 1197 | sTransform.translate (priv->mOutputXOffset, -priv->mOutputYOffset, 0.0f); |
1695 | 1187 | glTranslatef (priv->mOutputXOffset, -priv->mOutputYOffset, 0.0f); | 1198 | sTransform.scale (priv->mOutputXScale, priv->mOutputYScale, 1.0f); |
1693 | 1188 | glScalef (priv->mOutputXScale, priv->mOutputYScale, 1.0f); | ||
1696 | 1189 | 1199 | ||
1697 | 1190 | if ((priv->mDesktopOpacity != OPAQUE) || (color[3] != OPAQUE)) | 1200 | if ((priv->mDesktopOpacity != OPAQUE) || (color[3] != OPAQUE)) |
1698 | 1191 | { | 1201 | { |
1699 | 1202 | #ifndef USE_GLES | ||
1700 | 1192 | priv->gScreen->setTexEnvMode (GL_MODULATE); | 1203 | priv->gScreen->setTexEnvMode (GL_MODULATE); |
1702 | 1193 | glEnable (GL_BLEND); | 1204 | #endif |
1703 | 1194 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 1205 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
1704 | 1195 | } | 1206 | } |
1705 | 1196 | 1207 | ||
1716 | 1197 | glVertexPointer (3, GL_FLOAT, 0, priv->mVertices); | 1208 | streamingBuffer->begin (GL_TRIANGLE_FAN); |
1717 | 1198 | 1209 | streamingBuffer->addColors (1, &(colorData[0])); | |
1718 | 1199 | 1210 | streamingBuffer->addVertices (priv->mNVertices, priv->mVertices); | |
1719 | 1200 | glDisableClientState (GL_TEXTURE_COORD_ARRAY); | 1211 | streamingBuffer->addNormals (1, const_cast <GLfloat *> (&normal[0])); |
1720 | 1201 | glDrawArrays (GL_TRIANGLE_FAN, priv->mNVertices >> 1, priv->mNVertices >> 1); | 1212 | streamingBuffer->setVertexOffset (priv->mNVertices >> 1); |
1721 | 1202 | 1213 | streamingBuffer->setMaxVertices (priv->mNVertices >> 1); | |
1722 | 1203 | glPopMatrix (); | 1214 | |
1723 | 1204 | 1215 | streamingBuffer->end (); | |
1724 | 1205 | glColor4usv (defaultColor); | 1216 | streamingBuffer->render (sTransform); |
1715 | 1206 | glEnableClientState (GL_TEXTURE_COORD_ARRAY); | ||
1725 | 1207 | 1217 | ||
1726 | 1208 | priv->gScreen->setTexEnvMode (GL_REPLACE); | 1218 | priv->gScreen->setTexEnvMode (GL_REPLACE); |
1727 | 1209 | glDisable (GL_BLEND); | ||
1728 | 1210 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | 1219 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
1729 | 1211 | } | 1220 | } |
1730 | 1212 | 1221 | ||
1731 | @@ -1214,9 +1223,10 @@ | |||
1732 | 1214 | CubeScreen::cubePaintInside (const GLScreenPaintAttrib &sAttrib, | 1223 | CubeScreen::cubePaintInside (const GLScreenPaintAttrib &sAttrib, |
1733 | 1215 | const GLMatrix &transform, | 1224 | const GLMatrix &transform, |
1734 | 1216 | CompOutput *output, | 1225 | CompOutput *output, |
1736 | 1217 | int size) | 1226 | int size, |
1737 | 1227 | const GLVector &normal) | ||
1738 | 1218 | { | 1228 | { |
1740 | 1219 | WRAPABLE_HND_FUNCTN (cubePaintInside, sAttrib, transform, output, size) | 1229 | WRAPABLE_HND_FUNCTN (cubePaintInside, sAttrib, transform, output, size, normal) |
1741 | 1220 | } | 1230 | } |
1742 | 1221 | 1231 | ||
1743 | 1222 | void | 1232 | void |
1744 | @@ -1226,6 +1236,8 @@ | |||
1745 | 1226 | { | 1236 | { |
1746 | 1227 | if (mRotationState != CubeScreen::RotationNone) | 1237 | if (mRotationState != CubeScreen::RotationNone) |
1747 | 1228 | { | 1238 | { |
1748 | 1239 | /* FIXME: No output clipping in OpenGL|ES yet */ | ||
1749 | 1240 | #ifndef USE_GLES | ||
1750 | 1229 | glPushMatrix (); | 1241 | glPushMatrix (); |
1751 | 1230 | glLoadMatrixf (transform.getMatrix ()); | 1242 | glLoadMatrixf (transform.getMatrix ()); |
1752 | 1231 | glTranslatef (mOutputXOffset, -mOutputYOffset, 0.0f); | 1243 | glTranslatef (mOutputXOffset, -mOutputYOffset, 0.0f); |
1753 | @@ -1260,6 +1272,7 @@ | |||
1754 | 1260 | glEnable (GL_CLIP_PLANE3); | 1272 | glEnable (GL_CLIP_PLANE3); |
1755 | 1261 | 1273 | ||
1756 | 1262 | glPopMatrix (); | 1274 | glPopMatrix (); |
1757 | 1275 | #endif | ||
1758 | 1263 | } | 1276 | } |
1759 | 1264 | else | 1277 | else |
1760 | 1265 | gScreen->glEnableOutputClipping (transform, region, output); | 1278 | gScreen->glEnableOutputClipping (transform, region, output); |
1761 | @@ -1447,38 +1460,28 @@ | |||
1762 | 1447 | 1460 | ||
1763 | 1448 | if (topDir && bottomDir) | 1461 | if (topDir && bottomDir) |
1764 | 1449 | { | 1462 | { |
1765 | 1450 | glNormal3f (0.0f, -1.0f, 0.0f); | ||
1766 | 1451 | if (allCaps) | 1463 | if (allCaps) |
1767 | 1452 | { | 1464 | { |
1772 | 1453 | cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize); | 1465 | cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize, GLVector (0.0f, -1.0f, 0.0f, 1.0f)); |
1773 | 1454 | glNormal3f (0.0f, 0.0f, -1.0f); | 1466 | cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize, GLVector (0.0f, 0.0f, -1.0f, 1.0f)); |
1770 | 1455 | cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize); | ||
1771 | 1456 | glNormal3f (0.0f, -1.0f, 0.0f); | ||
1774 | 1457 | } | 1467 | } |
1776 | 1458 | cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize); | 1468 | cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize, GLVector (0.0f, -1.0f, 0.0f, 1.0f)); |
1777 | 1459 | } | 1469 | } |
1778 | 1460 | else if (!topDir && !bottomDir) | 1470 | else if (!topDir && !bottomDir) |
1779 | 1461 | { | 1471 | { |
1780 | 1462 | glNormal3f (0.0f, 1.0f, 0.0f); | ||
1781 | 1463 | if (allCaps) | 1472 | if (allCaps) |
1782 | 1464 | { | 1473 | { |
1787 | 1465 | cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize); | 1474 | cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize, GLVector (0.0f, 1.0f, 0.0f, 1.0f)); |
1788 | 1466 | glNormal3f (0.0f, 0.0f, -1.0f); | 1475 | cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize, GLVector (0.0f, 0.0f, -1.0f, 1.0f)); |
1785 | 1467 | cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize); | ||
1786 | 1468 | glNormal3f (0.0f, 1.0f, 0.0f); | ||
1789 | 1469 | } | 1476 | } |
1791 | 1470 | cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize); | 1477 | cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize, GLVector (0.0f, -1.0f, 0.0f, 1.0f)); |
1792 | 1471 | } | 1478 | } |
1793 | 1472 | else if (allCaps) | 1479 | else if (allCaps) |
1794 | 1473 | { | 1480 | { |
1801 | 1474 | glNormal3f (0.0f, 1.0f, 0.0f); | 1481 | cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize, GLVector (0.0f, 1.0f, 0.0f, 1.0f)); |
1802 | 1475 | cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize); | 1482 | cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize, GLVector (0.0f, -1.0f, 0.0f, 1.0f)); |
1803 | 1476 | glNormal3f (0.0f, -1.0f, 0.0f); | 1483 | cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize, GLVector (0.0f, 0.0f, -1.0f, 1.0f)); |
1798 | 1477 | cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize); | ||
1799 | 1478 | glNormal3f (0.0f, 0.0f, -1.0f); | ||
1800 | 1479 | cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize); | ||
1804 | 1480 | } | 1484 | } |
1805 | 1481 | glNormal3f (0.0f, 0.0f, -1.0f); | ||
1806 | 1482 | } | 1485 | } |
1807 | 1483 | 1486 | ||
1808 | 1484 | if (wasCulled) | 1487 | if (wasCulled) |
1809 | @@ -1705,8 +1708,10 @@ | |||
1810 | 1705 | if (mVertices) | 1708 | if (mVertices) |
1811 | 1706 | free (mVertices); | 1709 | free (mVertices); |
1812 | 1707 | 1710 | ||
1813 | 1711 | #ifndef USE_GLES | ||
1814 | 1708 | if (mSkyListId) | 1712 | if (mSkyListId) |
1815 | 1709 | glDeleteLists (mSkyListId, 1); | 1713 | glDeleteLists (mSkyListId, 1); |
1816 | 1714 | #endif | ||
1817 | 1710 | } | 1715 | } |
1818 | 1711 | 1716 | ||
1819 | 1712 | 1717 | ||
1820 | 1713 | 1718 | ||
1821 | === modified file 'plugins/decor/src/decor.cpp' | |||
1822 | --- plugins/decor/src/decor.cpp 2012-08-03 10:12:25 +0000 | |||
1823 | +++ plugins/decor/src/decor.cpp 2012-08-22 06:16:22 +0000 | |||
1824 | @@ -153,14 +153,12 @@ | |||
1825 | 153 | 153 | ||
1826 | 154 | bool | 154 | bool |
1827 | 155 | DecorWindow::glDraw (const GLMatrix &transform, | 155 | DecorWindow::glDraw (const GLMatrix &transform, |
1829 | 156 | GLFragment::Attrib &attrib, | 156 | const GLWindowPaintAttrib &attrib, |
1830 | 157 | const CompRegion ®ion, | 157 | const CompRegion ®ion, |
1831 | 158 | unsigned int mask) | 158 | unsigned int mask) |
1832 | 159 | { | 159 | { |
1833 | 160 | bool status; | 160 | bool status; |
1834 | 161 | 161 | ||
1835 | 162 | status = gWindow->glDraw (transform, attrib, region, mask); | ||
1836 | 163 | |||
1837 | 164 | /* Don't render dock decorations (shadows) on just any old window */ | 162 | /* Don't render dock decorations (shadows) on just any old window */ |
1838 | 165 | if (!(window->type () & CompWindowTypeDockMask)) | 163 | if (!(window->type () & CompWindowTypeDockMask)) |
1839 | 166 | { | 164 | { |
1840 | @@ -188,25 +186,26 @@ | |||
1841 | 188 | */ | 186 | */ |
1842 | 189 | pmask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK; | 187 | pmask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK; |
1843 | 190 | 188 | ||
1845 | 191 | if (d->gWindow->glPaint (d->gWindow->paintAttrib (), | 189 | const GLWindowPaintAttrib &pAttrib (d->gWindow->paintAttrib ()); |
1846 | 190 | |||
1847 | 191 | if (d->gWindow->glPaint (pAttrib, | ||
1848 | 192 | transform, | 192 | transform, |
1849 | 193 | region, | 193 | region, |
1850 | 194 | pmask)) | 194 | pmask)) |
1855 | 195 | { | 195 | d->glDecorate (transform, pAttrib, region, mask); |
1852 | 196 | GLFragment::Attrib fa (d->gWindow->paintAttrib ()); | ||
1853 | 197 | d->glDecorate (transform, fa, region, mask); | ||
1854 | 198 | } | ||
1856 | 199 | } | 196 | } |
1857 | 200 | } | 197 | } |
1858 | 201 | } | 198 | } |
1859 | 202 | } | 199 | } |
1860 | 203 | 200 | ||
1861 | 201 | status = gWindow->glDraw (transform, attrib, region, mask); | ||
1862 | 202 | |||
1863 | 204 | return status; | 203 | return status; |
1864 | 205 | } | 204 | } |
1865 | 206 | 205 | ||
1866 | 207 | void | 206 | void |
1867 | 208 | DecorWindow::glDecorate (const GLMatrix &transform, | 207 | DecorWindow::glDecorate (const GLMatrix &transform, |
1869 | 209 | GLFragment::Attrib &attrib, | 208 | const GLWindowPaintAttrib &attrib, |
1870 | 210 | const CompRegion ®ion, | 209 | const CompRegion ®ion, |
1871 | 211 | unsigned int mask) | 210 | unsigned int mask) |
1872 | 212 | { | 211 | { |
1873 | @@ -217,6 +216,7 @@ | |||
1874 | 217 | GLTexture::MatrixList ml (1); | 216 | GLTexture::MatrixList ml (1); |
1875 | 218 | mask |= PAINT_WINDOW_BLEND_MASK; | 217 | mask |= PAINT_WINDOW_BLEND_MASK; |
1876 | 219 | 218 | ||
1877 | 219 | gWindow->vertexBuffer ()->begin (); | ||
1878 | 220 | const CompRegion *preg = NULL; | 220 | const CompRegion *preg = NULL; |
1879 | 221 | 221 | ||
1880 | 222 | if ((mask & (PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK | | 222 | if ((mask & (PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK | |
1881 | @@ -228,11 +228,8 @@ | |||
1882 | 228 | { | 228 | { |
1883 | 229 | tmpRegion = mOutputRegion; | 229 | tmpRegion = mOutputRegion; |
1884 | 230 | tmpRegion &= region; | 230 | tmpRegion &= region; |
1890 | 231 | 231 | tmpRegion &= shadowRegion; | |
1891 | 232 | if (tmpRegion.isEmpty ()) | 232 | preg = &tmpRegion; |
1887 | 233 | preg = ®ion; | ||
1888 | 234 | else | ||
1889 | 235 | preg = &shadowRegion; | ||
1892 | 236 | } | 233 | } |
1893 | 237 | else | 234 | else |
1894 | 238 | preg = ®ion; | 235 | preg = ®ion; |
1895 | @@ -243,8 +240,6 @@ | |||
1896 | 243 | 240 | ||
1897 | 244 | const CompRegion ® (*preg); | 241 | const CompRegion ® (*preg); |
1898 | 245 | 242 | ||
1899 | 246 | gWindow->geometry ().reset (); | ||
1900 | 247 | |||
1901 | 248 | if (updateMatrix) | 243 | if (updateMatrix) |
1902 | 249 | updateDecorationScale (); | 244 | updateDecorationScale (); |
1903 | 250 | 245 | ||
1904 | @@ -263,9 +258,13 @@ | |||
1905 | 263 | } | 258 | } |
1906 | 264 | } | 259 | } |
1907 | 265 | 260 | ||
1910 | 266 | if (gWindow->geometry ().vCount) | 261 | if (gWindow->vertexBuffer ()->end ()) |
1911 | 267 | gWindow->glDrawTexture (wd->decor->texture->textures[0], | 262 | { |
1912 | 263 | glEnable (GL_BLEND); | ||
1913 | 264 | gWindow->glDrawTexture (wd->decor->texture->textures[0], transform, | ||
1914 | 268 | attrib, mask); | 265 | attrib, mask); |
1915 | 266 | glDisable (GL_BLEND); | ||
1916 | 267 | } | ||
1917 | 269 | } | 268 | } |
1918 | 270 | else if (wd && wd->decor->type == WINDOW_DECORATION_TYPE_WINDOW) | 269 | else if (wd && wd->decor->type == WINDOW_DECORATION_TYPE_WINDOW) |
1919 | 271 | { | 270 | { |
1920 | @@ -279,14 +278,16 @@ | |||
1921 | 279 | if (updateMatrix) | 278 | if (updateMatrix) |
1922 | 280 | updateDecorationScale (); | 279 | updateDecorationScale (); |
1923 | 281 | 280 | ||
1924 | 281 | glEnable (GL_BLEND); | ||
1925 | 282 | |||
1926 | 282 | if (gWindow->textures ().size () == 1) | 283 | if (gWindow->textures ().size () == 1) |
1927 | 283 | { | 284 | { |
1928 | 284 | ml[0] = gWindow->matrices ()[0]; | 285 | ml[0] = gWindow->matrices ()[0]; |
1930 | 285 | gWindow->geometry ().reset (); | 286 | gWindow->vertexBuffer ()->begin (); |
1931 | 286 | gWindow->glAddGeometry (ml, window->frameRegion (), region); | 287 | gWindow->glAddGeometry (ml, window->frameRegion (), region); |
1935 | 287 | 288 | if (gWindow->vertexBuffer ()->end ()) | |
1936 | 288 | if (gWindow->geometry ().vCount) | 289 | gWindow->glDrawTexture (gWindow->textures ()[0], transform, |
1937 | 289 | gWindow->glDrawTexture (gWindow->textures ()[0], attrib, mask); | 290 | attrib, mask); |
1938 | 290 | } | 291 | } |
1939 | 291 | else | 292 | else |
1940 | 292 | { | 293 | { |
1941 | @@ -295,14 +296,15 @@ | |||
1942 | 295 | for (unsigned int i = 0; i < gWindow->textures ().size (); i++) | 296 | for (unsigned int i = 0; i < gWindow->textures ().size (); i++) |
1943 | 296 | { | 297 | { |
1944 | 297 | ml[0] = gWindow->matrices ()[i]; | 298 | ml[0] = gWindow->matrices ()[i]; |
1946 | 298 | gWindow->geometry ().reset (); | 299 | gWindow->vertexBuffer ()->begin (); |
1947 | 299 | gWindow->glAddGeometry (ml, regions[i], region); | 300 | gWindow->glAddGeometry (ml, regions[i], region); |
1952 | 300 | 301 | if (gWindow->vertexBuffer ()->end ()) | |
1953 | 301 | if (gWindow->geometry ().vCount) | 302 | gWindow->glDrawTexture (gWindow->textures ()[i], transform, |
1954 | 302 | gWindow->glDrawTexture (gWindow->textures ()[i], attrib, | 303 | attrib, mask); |
1951 | 303 | mask); | ||
1955 | 304 | } | 304 | } |
1956 | 305 | } | 305 | } |
1957 | 306 | |||
1958 | 307 | glDisable (GL_BLEND); | ||
1959 | 306 | } | 308 | } |
1960 | 307 | } | 309 | } |
1961 | 308 | 310 | ||
1962 | 309 | 311 | ||
1963 | === modified file 'plugins/decor/src/decor.h' | |||
1964 | --- plugins/decor/src/decor.h 2012-05-10 15:40:25 +0000 | |||
1965 | +++ plugins/decor/src/decor.h 2012-08-22 06:16:22 +0000 | |||
1966 | @@ -276,9 +276,9 @@ | |||
1967 | 276 | 276 | ||
1968 | 277 | bool damageRect (bool, const CompRect &); | 277 | bool damageRect (bool, const CompRect &); |
1969 | 278 | 278 | ||
1971 | 279 | bool glDraw (const GLMatrix &, GLFragment::Attrib &, | 279 | bool glDraw (const GLMatrix &, const GLWindowPaintAttrib &, |
1972 | 280 | const CompRegion &, unsigned int); | 280 | const CompRegion &, unsigned int); |
1974 | 281 | void glDecorate (const GLMatrix &, GLFragment::Attrib &, | 281 | void glDecorate (const GLMatrix &, const GLWindowPaintAttrib &, |
1975 | 282 | const CompRegion &, unsigned int); | 282 | const CompRegion &, unsigned int); |
1976 | 283 | 283 | ||
1977 | 284 | void windowNotify (CompWindowNotify n); | 284 | void windowNotify (CompWindowNotify n); |
1978 | 285 | 285 | ||
1979 | === modified file 'plugins/expo/CMakeLists.txt' | |||
1980 | --- plugins/expo/CMakeLists.txt 2012-08-09 20:14:36 +0000 | |||
1981 | +++ plugins/expo/CMakeLists.txt 2012-08-22 06:16:22 +0000 | |||
1982 | @@ -1,11 +1,7 @@ | |||
1983 | 1 | find_package (Compiz REQUIRED) | 1 | find_package (Compiz REQUIRED) |
1984 | 2 | include (FindOpenGL) | ||
1985 | 3 | include (CompizPlugin) | 2 | include (CompizPlugin) |
1986 | 4 | 3 | ||
1994 | 5 | if (OPENGL_GLU_FOUND) | 4 | add_subdirectory (src/click_threshold) |
1995 | 6 | add_subdirectory (src/click_threshold) | 5 | include_directories (src/click_threshold/include) |
1996 | 7 | include_directories (src/click_threshold/include) | 6 | |
1997 | 8 | 7 | compiz_plugin (expo PLUGINDEPS composite opengl LIBRARIES compiz_expo_click_threshold) | |
1991 | 9 | compiz_plugin (expo PLUGINDEPS composite opengl LIBRARIES ${OPENGL_glu_LIBRARY} compiz_expo_click_threshold INCDIRS ${OPENGL_INCLUDE_DIR}) | ||
1992 | 10 | endif (OPENGL_GLU_FOUND) | ||
1993 | 11 | |||
1998 | 12 | 8 | ||
1999 | === modified file 'plugins/expo/src/expo.cpp' | |||
2000 | --- plugins/expo/src/expo.cpp 2012-08-16 17:00:05 +0000 | |||
2001 | +++ plugins/expo/src/expo.cpp 2012-08-22 06:16:22 +0000 | |||
2002 | @@ -4,12 +4,14 @@ | |||
2003 | 4 | * | 4 | * |
2004 | 5 | * expo.c | 5 | * expo.c |
2005 | 6 | * | 6 | * |
2006 | 7 | * Copyright (c) 2011 Linaro Limited | ||
2007 | 7 | * Copyright (c) 2008 Dennis Kasprzyk <racarr@opencompositing.org> | 8 | * Copyright (c) 2008 Dennis Kasprzyk <racarr@opencompositing.org> |
2008 | 8 | * Copyright (c) 2006 Robert Carr <racarr@beryl-project.org> | 9 | * Copyright (c) 2006 Robert Carr <racarr@beryl-project.org> |
2009 | 9 | * | 10 | * |
2010 | 10 | * Authors: | 11 | * Authors: |
2011 | 11 | * Robert Carr <racarr@beryl-project.org> | 12 | * Robert Carr <racarr@beryl-project.org> |
2012 | 12 | * Dennis Kasprzyk <onestone@opencompositing.org> | 13 | * Dennis Kasprzyk <onestone@opencompositing.org> |
2013 | 14 | * Travis Watkins <travis.watkins@linaro.org> | ||
2014 | 13 | * | 15 | * |
2015 | 14 | * This program is free software; you can redistribute it and/or | 16 | * This program is free software; you can redistribute it and/or |
2016 | 15 | * modify it under the terms of the GNU General Public License | 17 | * modify it under the terms of the GNU General Public License |
2017 | @@ -26,7 +28,9 @@ | |||
2018 | 26 | #include "expo.h" | 28 | #include "expo.h" |
2019 | 27 | #include "click-threshold.h" | 29 | #include "click-threshold.h" |
2020 | 28 | #include <math.h> | 30 | #include <math.h> |
2021 | 31 | #ifndef USE_GLES | ||
2022 | 29 | #include <GL/glu.h> | 32 | #include <GL/glu.h> |
2023 | 33 | #endif | ||
2024 | 30 | #include <X11/cursorfont.h> | 34 | #include <X11/cursorfont.h> |
2025 | 31 | 35 | ||
2026 | 32 | COMPIZ_PLUGIN_20090315 (expo, ExpoPluginVTable); | 36 | COMPIZ_PLUGIN_20090315 (expo, ExpoPluginVTable); |
2027 | @@ -641,6 +645,55 @@ | |||
2028 | 641 | } | 645 | } |
2029 | 642 | } | 646 | } |
2030 | 643 | 647 | ||
2031 | 648 | static bool | ||
2032 | 649 | unproject (float winx, float winy, float winz, | ||
2033 | 650 | const GLMatrix &modelview, | ||
2034 | 651 | const GLMatrix &projection, | ||
2035 | 652 | const GLint viewport[4], | ||
2036 | 653 | float *objx, float *objy, float *objz) | ||
2037 | 654 | { | ||
2038 | 655 | GLMatrix finalMatrix = projection * modelview; | ||
2039 | 656 | float in[4], out[4]; | ||
2040 | 657 | |||
2041 | 658 | if (!finalMatrix.invert ()) | ||
2042 | 659 | return false; | ||
2043 | 660 | |||
2044 | 661 | in[0] = winx; | ||
2045 | 662 | in[1] = winy; | ||
2046 | 663 | in[2] = winz; | ||
2047 | 664 | in[3] = 1.0; | ||
2048 | 665 | |||
2049 | 666 | /* Map x and y from window coordinates */ | ||
2050 | 667 | in[0] = (in[0] - viewport[0]) / viewport[2]; | ||
2051 | 668 | in[1] = (in[1] - viewport[1]) / viewport[3]; | ||
2052 | 669 | |||
2053 | 670 | /* Map to range -1 to 1 */ | ||
2054 | 671 | in[0] = in[0] * 2 - 1; | ||
2055 | 672 | in[1] = in[1] * 2 - 1; | ||
2056 | 673 | in[2] = in[2] * 2 - 1; | ||
2057 | 674 | |||
2058 | 675 | for (int i = 0; i < 4; i++) | ||
2059 | 676 | { | ||
2060 | 677 | out[i] = in[0] * finalMatrix[i] + | ||
2061 | 678 | in[1] * finalMatrix[4 + i] + | ||
2062 | 679 | in[2] * finalMatrix[8 + i] + | ||
2063 | 680 | in[3] * finalMatrix[12 + i]; | ||
2064 | 681 | } | ||
2065 | 682 | |||
2066 | 683 | if (out[3] == 0.0) | ||
2067 | 684 | return false; | ||
2068 | 685 | |||
2069 | 686 | out[0] /= out[3]; | ||
2070 | 687 | out[1] /= out[3]; | ||
2071 | 688 | out[2] /= out[3]; | ||
2072 | 689 | |||
2073 | 690 | *objx = out[0]; | ||
2074 | 691 | *objy = out[1]; | ||
2075 | 692 | *objz = out[2]; | ||
2076 | 693 | |||
2077 | 694 | return true; | ||
2078 | 695 | } | ||
2079 | 696 | |||
2080 | 644 | void | 697 | void |
2081 | 645 | ExpoScreen::invertTransformedVertex (const GLScreenPaintAttrib& attrib, | 698 | ExpoScreen::invertTransformedVertex (const GLScreenPaintAttrib& attrib, |
2082 | 646 | const GLMatrix& transform, | 699 | const GLMatrix& transform, |
2083 | @@ -648,8 +701,7 @@ | |||
2084 | 648 | int vertex[2]) | 701 | int vertex[2]) |
2085 | 649 | { | 702 | { |
2086 | 650 | GLMatrix sTransform (transform); | 703 | GLMatrix sTransform (transform); |
2089 | 651 | GLdouble p1[3], p2[3], v[3], alpha; | 704 | float p1[3], p2[3], v[3], alpha; |
2088 | 652 | GLdouble mvm[16], pm[16]; | ||
2090 | 653 | GLint viewport[4]; | 705 | GLint viewport[4]; |
2091 | 654 | int i; | 706 | int i; |
2092 | 655 | 707 | ||
2093 | @@ -657,16 +709,13 @@ | |||
2094 | 657 | sTransform.toScreenSpace (output, -attrib.zTranslate); | 709 | sTransform.toScreenSpace (output, -attrib.zTranslate); |
2095 | 658 | 710 | ||
2096 | 659 | glGetIntegerv (GL_VIEWPORT, viewport); | 711 | glGetIntegerv (GL_VIEWPORT, viewport); |
2097 | 660 | for (i = 0; i < 16; i++) | ||
2098 | 661 | { | ||
2099 | 662 | mvm[i] = sTransform[i]; | ||
2100 | 663 | pm[i] = gScreen->projectionMatrix ()[i]; | ||
2101 | 664 | } | ||
2102 | 665 | 712 | ||
2107 | 666 | gluUnProject (vertex[0], screen->height () - vertex[1], 0, mvm, pm, | 713 | unproject (vertex[0], screen->height () - vertex[1], 0, |
2108 | 667 | viewport, &p1[0], &p1[1], &p1[2]); | 714 | sTransform, *gScreen->projectionMatrix (), viewport, |
2109 | 668 | gluUnProject (vertex[0], screen->height () - vertex[1], -1.0, mvm, pm, | 715 | &p1[0], &p1[1], &p1[2]); |
2110 | 669 | viewport, &p2[0], &p2[1], &p2[2]); | 716 | unproject (vertex[0], screen->height () - vertex[1], -1.0, |
2111 | 717 | sTransform, *gScreen->projectionMatrix (), viewport, | ||
2112 | 718 | &p2[0], &p2[1], &p2[2]); | ||
2113 | 670 | 719 | ||
2114 | 671 | for (i = 0; i < 3; i++) | 720 | for (i = 0; i < 3; i++) |
2115 | 672 | v[i] = p1[i] - p2[i]; | 721 | v[i] = p1[i] - p2[i]; |
2116 | @@ -720,6 +769,8 @@ | |||
2117 | 720 | unsigned int mask, | 769 | unsigned int mask, |
2118 | 721 | bool reflection) | 770 | bool reflection) |
2119 | 722 | { | 771 | { |
2120 | 772 | GLfloat vertexData[12]; | ||
2121 | 773 | GLushort colorData[16]; | ||
2122 | 723 | GLMatrix sTransformW, sTransform (transform); | 774 | GLMatrix sTransformW, sTransform (transform); |
2123 | 724 | int i, j, vp; | 775 | int i, j, vp; |
2124 | 725 | GLenum oldFilter = gScreen->textureFilter (); | 776 | GLenum oldFilter = gScreen->textureFilter (); |
2125 | @@ -740,6 +791,8 @@ | |||
2126 | 740 | int glPaintTransformedOutputIndex = | 791 | int glPaintTransformedOutputIndex = |
2127 | 741 | gScreen->glPaintTransformedOutputGetCurrentIndex (); | 792 | gScreen->glPaintTransformedOutputGetCurrentIndex (); |
2128 | 742 | 793 | ||
2129 | 794 | GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer (); | ||
2130 | 795 | |||
2131 | 743 | // Make sure that the base glPaintTransformedOutput function is called | 796 | // Make sure that the base glPaintTransformedOutput function is called |
2132 | 744 | gScreen->glPaintTransformedOutputSetCurrentIndex (MAXSHORT); | 797 | gScreen->glPaintTransformedOutputSetCurrentIndex (MAXSHORT); |
2133 | 745 | 798 | ||
2134 | @@ -832,7 +885,7 @@ | |||
2135 | 832 | /* zoom out */ | 885 | /* zoom out */ |
2136 | 833 | oScale = DEFAULT_Z_CAMERA / (cam[GLVector::z] + DEFAULT_Z_CAMERA); | 886 | oScale = DEFAULT_Z_CAMERA / (cam[GLVector::z] + DEFAULT_Z_CAMERA); |
2137 | 834 | sTransform.scale (oScale, oScale, oScale); | 887 | sTransform.scale (oScale, oScale, oScale); |
2139 | 835 | glNormal3f (0.0, 0.0, -oScale); | 888 | // glNormal3f (0.0, 0.0, -oScale); |
2140 | 836 | sTransform.translate (-cam[GLVector::x], -cam[GLVector::y], | 889 | sTransform.translate (-cam[GLVector::x], -cam[GLVector::y], |
2141 | 837 | -cam[GLVector::z] - DEFAULT_Z_CAMERA); | 890 | -cam[GLVector::z] - DEFAULT_Z_CAMERA); |
2142 | 838 | 891 | ||
2143 | @@ -967,73 +1020,169 @@ | |||
2144 | 967 | sTransform.translate (0.0, -(sy + gapY), 0.0f); | 1020 | sTransform.translate (0.0, -(sy + gapY), 0.0f); |
2145 | 968 | } | 1021 | } |
2146 | 969 | 1022 | ||
2148 | 970 | glNormal3f (0.0, 0.0, -1.0); | 1023 | // glNormal3f (0.0, 0.0, -1.0); |
2149 | 971 | 1024 | ||
2150 | 972 | if (reflection) | 1025 | if (reflection) |
2151 | 973 | { | 1026 | { |
2152 | 974 | glEnable (GL_BLEND); | 1027 | glEnable (GL_BLEND); |
2153 | 975 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 1028 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
2154 | 976 | 1029 | ||
2155 | 977 | glPushMatrix (); | ||
2156 | 978 | |||
2157 | 979 | if (optionGetDeform () != DeformCurve) | 1030 | if (optionGetDeform () != DeformCurve) |
2158 | 980 | { | 1031 | { |
2171 | 981 | glLoadMatrixf (sTransformW.getMatrix ()); | 1032 | streamingBuffer->begin (GL_TRIANGLE_STRIP); |
2172 | 982 | 1033 | ||
2173 | 983 | glBegin (GL_QUADS); | 1034 | colorData[0] = 0; |
2174 | 984 | glColor4f (0.0, 0.0, 0.0, 1.0); | 1035 | colorData[1] = 0; |
2175 | 985 | glVertex2f (0.0, 0.0); | 1036 | colorData[2] = 0; |
2176 | 986 | glColor4f (0.0, 0.0, 0.0, 0.5); | 1037 | colorData[3] = 65535; |
2177 | 987 | glVertex2f (0.0, -vpSize.y () * (sy + gapY)); | 1038 | colorData[4] = 0; |
2178 | 988 | glVertex2f (vpSize.x () * sx * (1.0 + gapX), | 1039 | colorData[5] = 0; |
2179 | 989 | -vpSize.y () * sy * (1.0 + gapY)); | 1040 | colorData[6] = 0; |
2180 | 990 | glColor4f (0.0, 0.0, 0.0, 1.0); | 1041 | colorData[7] = 32768; |
2181 | 991 | glVertex2f (vpSize.x () * sx * (1.0 + gapX), 0.0); | 1042 | colorData[8] = 0; |
2182 | 992 | glEnd (); | 1043 | colorData[9] = 0; |
2183 | 1044 | colorData[10] = 0; | ||
2184 | 1045 | colorData[11] = 65535; | ||
2185 | 1046 | colorData[12] = 0; | ||
2186 | 1047 | colorData[13] = 0; | ||
2187 | 1048 | colorData[14] = 0; | ||
2188 | 1049 | colorData[15] = 32768; | ||
2189 | 1050 | |||
2190 | 1051 | vertexData[0] = 0; | ||
2191 | 1052 | vertexData[1] = 0; | ||
2192 | 1053 | vertexData[2] = 0; | ||
2193 | 1054 | vertexData[3] = 0; | ||
2194 | 1055 | vertexData[4] = -vpSize.y () * (sy + gapY); | ||
2195 | 1056 | vertexData[5] = 0; | ||
2196 | 1057 | vertexData[6] = vpSize.x () * sx * (1.0 + gapX); | ||
2197 | 1058 | vertexData[7] = 0; | ||
2198 | 1059 | vertexData[8] = 0; | ||
2199 | 1060 | vertexData[9] = vpSize.x () * sx * (1.0 + gapX); | ||
2200 | 1061 | vertexData[10] = -vpSize.y () * sy * (1.0 + gapY); | ||
2201 | 1062 | vertexData[11] = 0; | ||
2202 | 1063 | |||
2203 | 1064 | streamingBuffer->addColors (4, colorData); | ||
2204 | 1065 | streamingBuffer->addVertices (4, vertexData); | ||
2205 | 1066 | |||
2206 | 1067 | streamingBuffer->end (); | ||
2207 | 1068 | streamingBuffer->render (sTransformW); | ||
2208 | 993 | } | 1069 | } |
2209 | 994 | else | 1070 | else |
2210 | 995 | { | 1071 | { |
2211 | 1072 | GLMatrix cTransform; | ||
2212 | 1073 | cTransform.translate (0.0, 0.0, -DEFAULT_Z_CAMERA); | ||
2213 | 1074 | |||
2214 | 996 | glCullFace (GL_BACK); | 1075 | glCullFace (GL_BACK); |
2232 | 997 | glLoadIdentity (); | 1076 | |
2233 | 998 | glTranslatef (0.0, 0.0, -DEFAULT_Z_CAMERA); | 1077 | streamingBuffer->begin (GL_TRIANGLE_STRIP); |
2234 | 999 | 1078 | ||
2235 | 1000 | glBegin (GL_QUADS); | 1079 | colorData[0] = 0; |
2236 | 1001 | glColor4f (0.0, 0.0, 0.0, 1.0 * expoCam); | 1080 | colorData[1] = 0; |
2237 | 1002 | glVertex2f (-0.5, -0.5); | 1081 | colorData[2] = 0; |
2238 | 1003 | glVertex2f (0.5, -0.5); | 1082 | colorData[3] = (1.0 * expoCam) * 65535; |
2239 | 1004 | glColor4f (0.0, 0.0, 0.0, 0.5 * expoCam); | 1083 | colorData[4] = 0; |
2240 | 1005 | glVertex2f (0.5, 0.0); | 1084 | colorData[5] = 0; |
2241 | 1006 | glVertex2f (-0.5, 0.0); | 1085 | colorData[6] = 0; |
2242 | 1007 | glColor4f (0.0, 0.0, 0.0, 0.5 * expoCam); | 1086 | colorData[7] = (1.0 * expoCam) * 65535; |
2243 | 1008 | glVertex2f (-0.5, 0.0); | 1087 | colorData[8] = 0; |
2244 | 1009 | glVertex2f (0.5, 0.0); | 1088 | colorData[9] = 0; |
2245 | 1010 | glColor4f (0.0, 0.0, 0.0, 0.0); | 1089 | colorData[10] = 0; |
2246 | 1011 | glVertex2f (0.5, 0.5); | 1090 | colorData[11] = (0.5 * expoCam) * 65535; |
2247 | 1012 | glVertex2f (-0.5, 0.5); | 1091 | colorData[12] = 0; |
2248 | 1013 | glEnd (); | 1092 | colorData[13] = 0; |
2249 | 1093 | colorData[14] = 0; | ||
2250 | 1094 | colorData[15] = (0.5 * expoCam) * 65535; | ||
2251 | 1095 | |||
2252 | 1096 | vertexData[0] = -0.5; | ||
2253 | 1097 | vertexData[1] = -0.5; | ||
2254 | 1098 | vertexData[2] = 0; | ||
2255 | 1099 | vertexData[3] = 0.5; | ||
2256 | 1100 | vertexData[4] = -0.5; | ||
2257 | 1101 | vertexData[5] = 0; | ||
2258 | 1102 | vertexData[6] = -0.5; | ||
2259 | 1103 | vertexData[7] = 0; | ||
2260 | 1104 | vertexData[8] = 0; | ||
2261 | 1105 | vertexData[9] = 0.5; | ||
2262 | 1106 | vertexData[10] = 0; | ||
2263 | 1107 | vertexData[11] = 0; | ||
2264 | 1108 | |||
2265 | 1109 | streamingBuffer->addColors (4, colorData); | ||
2266 | 1110 | streamingBuffer->addVertices (4, vertexData); | ||
2267 | 1111 | |||
2268 | 1112 | streamingBuffer->end (); | ||
2269 | 1113 | streamingBuffer->render (cTransform); | ||
2270 | 1114 | |||
2271 | 1115 | streamingBuffer->begin (GL_TRIANGLE_STRIP); | ||
2272 | 1116 | |||
2273 | 1117 | colorData[0] = 0; | ||
2274 | 1118 | colorData[1] = 0; | ||
2275 | 1119 | colorData[2] = 0; | ||
2276 | 1120 | colorData[3] = (0.5 * expoCam) * 65535; | ||
2277 | 1121 | colorData[4] = 0; | ||
2278 | 1122 | colorData[5] = 0; | ||
2279 | 1123 | colorData[6] = 0; | ||
2280 | 1124 | colorData[7] = (0.5 * expoCam) * 65535; | ||
2281 | 1125 | colorData[8] = 0; | ||
2282 | 1126 | colorData[9] = 0; | ||
2283 | 1127 | colorData[10] = 0; | ||
2284 | 1128 | colorData[11] = 0; | ||
2285 | 1129 | colorData[12] = 0; | ||
2286 | 1130 | colorData[13] = 0; | ||
2287 | 1131 | colorData[14] = 0; | ||
2288 | 1132 | colorData[15] = 0; | ||
2289 | 1133 | |||
2290 | 1134 | vertexData[0] = -0.5; | ||
2291 | 1135 | vertexData[1] = 0; | ||
2292 | 1136 | vertexData[2] = 0; | ||
2293 | 1137 | vertexData[3] = 0.5; | ||
2294 | 1138 | vertexData[4] = 0; | ||
2295 | 1139 | vertexData[5] = 0; | ||
2296 | 1140 | vertexData[6] = -0.5; | ||
2297 | 1141 | vertexData[7] = 0.5; | ||
2298 | 1142 | vertexData[8] = 0; | ||
2299 | 1143 | vertexData[9] = 0.5; | ||
2300 | 1144 | vertexData[10] = 0.5; | ||
2301 | 1145 | vertexData[11] = 0; | ||
2302 | 1146 | |||
2303 | 1147 | streamingBuffer->addColors (4, colorData); | ||
2304 | 1148 | streamingBuffer->addVertices (4, vertexData); | ||
2305 | 1149 | |||
2306 | 1150 | streamingBuffer->end (); | ||
2307 | 1151 | streamingBuffer->render (cTransform); | ||
2308 | 1014 | } | 1152 | } |
2309 | 1015 | glCullFace (GL_BACK); | 1153 | glCullFace (GL_BACK); |
2310 | 1016 | 1154 | ||
2311 | 1017 | glLoadIdentity (); | ||
2312 | 1018 | glTranslatef (0.0, 0.0, -DEFAULT_Z_CAMERA); | ||
2313 | 1019 | |||
2314 | 1020 | if (optionGetGroundSize () > 0.0) | 1155 | if (optionGetGroundSize () > 0.0) |
2315 | 1021 | { | 1156 | { |
2324 | 1022 | glBegin (GL_QUADS); | 1157 | GLMatrix gTransform; |
2325 | 1023 | glColor4usv (optionGetGroundColor1 ()); | 1158 | gTransform.translate (0.0, 0.0, -DEFAULT_Z_CAMERA); |
2326 | 1024 | glVertex2f (-0.5, -0.5); | 1159 | |
2327 | 1025 | glVertex2f (0.5, -0.5); | 1160 | streamingBuffer->begin (GL_TRIANGLE_STRIP); |
2328 | 1026 | glColor4usv (optionGetGroundColor2 ()); | 1161 | |
2329 | 1027 | glVertex2f (0.5, -0.5 + optionGetGroundSize ()); | 1162 | vertexData[0] = -0.5; |
2330 | 1028 | glVertex2f (-0.5, -0.5 + optionGetGroundSize ()); | 1163 | vertexData[1] = -0.5; |
2331 | 1029 | glEnd (); | 1164 | vertexData[2] = 0; |
2332 | 1165 | vertexData[3] = 0.5; | ||
2333 | 1166 | vertexData[4] = -0.5; | ||
2334 | 1167 | vertexData[5] = 0; | ||
2335 | 1168 | vertexData[6] = -0.5; | ||
2336 | 1169 | vertexData[7] = -0.5 + optionGetGroundSize (); | ||
2337 | 1170 | vertexData[8] = 0; | ||
2338 | 1171 | vertexData[9] = 0.5; | ||
2339 | 1172 | vertexData[10] = -0.5 + optionGetGroundSize (); | ||
2340 | 1173 | vertexData[11] = 0; | ||
2341 | 1174 | |||
2342 | 1175 | streamingBuffer->addColors (1, optionGetGroundColor1 ()); | ||
2343 | 1176 | streamingBuffer->addColors (1, optionGetGroundColor1 ()); | ||
2344 | 1177 | streamingBuffer->addColors (1, optionGetGroundColor2 ()); | ||
2345 | 1178 | streamingBuffer->addColors (1, optionGetGroundColor2 ()); | ||
2346 | 1179 | streamingBuffer->addVertices (4, vertexData); | ||
2347 | 1180 | |||
2348 | 1181 | streamingBuffer->end (); | ||
2349 | 1182 | streamingBuffer->render (gTransform); | ||
2350 | 1030 | } | 1183 | } |
2351 | 1031 | |||
2352 | 1032 | glColor4usv (defaultColor); | ||
2353 | 1033 | |||
2354 | 1034 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | 1184 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
2355 | 1035 | glDisable (GL_BLEND); | 1185 | glDisable (GL_BLEND); |
2356 | 1036 | glPopMatrix (); | ||
2357 | 1037 | } | 1186 | } |
2358 | 1038 | 1187 | ||
2359 | 1039 | expoActive = false; | 1188 | expoActive = false; |
2360 | @@ -1094,14 +1243,14 @@ | |||
2361 | 1094 | 1243 | ||
2362 | 1095 | bool | 1244 | bool |
2363 | 1096 | ExpoWindow::glDraw (const GLMatrix& transform, | 1245 | ExpoWindow::glDraw (const GLMatrix& transform, |
2365 | 1097 | GLFragment::Attrib& fragment, | 1246 | const GLWindowPaintAttrib &attrib, |
2366 | 1098 | const CompRegion& region, | 1247 | const CompRegion& region, |
2367 | 1099 | unsigned int mask) | 1248 | unsigned int mask) |
2368 | 1100 | { | 1249 | { |
2369 | 1101 | if (eScreen->expoCam == 0.0f) | 1250 | if (eScreen->expoCam == 0.0f) |
2371 | 1102 | return gWindow->glDraw (transform, fragment, region, mask); | 1251 | return gWindow->glDraw (transform, attrib, region, mask); |
2372 | 1103 | 1252 | ||
2374 | 1104 | GLFragment::Attrib fA (fragment); | 1253 | GLWindowPaintAttrib eAttrib (attrib); |
2375 | 1105 | int expoAnimation; | 1254 | int expoAnimation; |
2376 | 1106 | 1255 | ||
2377 | 1107 | expoAnimation = eScreen->optionGetExpoAnimation (); | 1256 | expoAnimation = eScreen->optionGetExpoAnimation (); |
2378 | @@ -1109,7 +1258,7 @@ | |||
2379 | 1109 | if (eScreen->expoActive) | 1258 | if (eScreen->expoActive) |
2380 | 1110 | { | 1259 | { |
2381 | 1111 | if (expoAnimation != ExpoScreen::ExpoAnimationZoom) | 1260 | if (expoAnimation != ExpoScreen::ExpoAnimationZoom) |
2383 | 1112 | fA.setOpacity (fragment.getOpacity () * eScreen->expoCam); | 1261 | eAttrib.opacity = attrib.opacity * eScreen->expoCam; |
2384 | 1113 | 1262 | ||
2385 | 1114 | if (window->wmType () & CompWindowTypeDockMask && | 1263 | if (window->wmType () & CompWindowTypeDockMask && |
2386 | 1115 | eScreen->optionGetHideDocks ()) | 1264 | eScreen->optionGetHideDocks ()) |
2387 | @@ -1117,28 +1266,28 @@ | |||
2388 | 1117 | if (expoAnimation == ExpoScreen::ExpoAnimationZoom && | 1266 | if (expoAnimation == ExpoScreen::ExpoAnimationZoom && |
2389 | 1118 | eScreen->paintingVp == eScreen->selectedVp) | 1267 | eScreen->paintingVp == eScreen->selectedVp) |
2390 | 1119 | { | 1268 | { |
2393 | 1120 | fA.setOpacity (fragment.getOpacity () * | 1269 | eAttrib.opacity = attrib.opacity * |
2394 | 1121 | (1 - sigmoidProgress (eScreen->expoCam))); | 1270 | (1 - sigmoidProgress (eScreen->expoCam)); |
2395 | 1122 | } | 1271 | } |
2396 | 1123 | else | 1272 | else |
2397 | 1124 | { | 1273 | { |
2399 | 1125 | fA.setOpacity (0); | 1274 | eAttrib.opacity = 0; |
2400 | 1126 | } | 1275 | } |
2401 | 1127 | } | 1276 | } |
2402 | 1128 | 1277 | ||
2405 | 1129 | fA.setBrightness (fragment.getBrightness () * eScreen->vpBrightness); | 1278 | eAttrib.brightness = attrib.brightness * eScreen->vpBrightness; |
2406 | 1130 | fA.setSaturation (fragment.getSaturation () * eScreen->vpSaturation); | 1279 | eAttrib.saturation = attrib.saturation * eScreen->vpSaturation; |
2407 | 1131 | } | 1280 | } |
2408 | 1132 | else | 1281 | else |
2409 | 1133 | { | 1282 | { |
2410 | 1134 | if (expoAnimation == ExpoScreen::ExpoAnimationZoom) | 1283 | if (expoAnimation == ExpoScreen::ExpoAnimationZoom) |
2412 | 1135 | fA.setBrightness (0); | 1284 | eAttrib.brightness = 0; |
2413 | 1136 | else | 1285 | else |
2416 | 1137 | fA.setBrightness (fragment.getBrightness () * | 1286 | eAttrib.brightness = attrib.brightness * |
2417 | 1138 | (1 - sigmoidProgress (eScreen->expoCam))); | 1287 | (1 - sigmoidProgress (eScreen->expoCam)); |
2418 | 1139 | } | 1288 | } |
2419 | 1140 | 1289 | ||
2421 | 1141 | return gWindow->glDraw (transform, fA, region, mask); | 1290 | return gWindow->glDraw (transform, eAttrib, region, mask); |
2422 | 1142 | } | 1291 | } |
2423 | 1143 | 1292 | ||
2424 | 1144 | #define EXPO_GRID_SIZE 100 | 1293 | #define EXPO_GRID_SIZE 100 |
2425 | @@ -1154,7 +1303,7 @@ | |||
2426 | 1154 | screen->desktopWindowCount () && | 1303 | screen->desktopWindowCount () && |
2427 | 1155 | eScreen->optionGetDeform () == ExpoScreen::DeformCurve) | 1304 | eScreen->optionGetDeform () == ExpoScreen::DeformCurve) |
2428 | 1156 | { | 1305 | { |
2430 | 1157 | int i, oldVCount = gWindow->geometry ().vCount; | 1306 | int i, oldVCount = gWindow->vertexBuffer ()->countVertices (); |
2431 | 1158 | GLfloat *v; | 1307 | GLfloat *v; |
2432 | 1159 | CompPoint offset; | 1308 | CompPoint offset; |
2433 | 1160 | float lastX, lastZ = 0.0; | 1309 | float lastX, lastZ = 0.0; |
2434 | @@ -1165,9 +1314,10 @@ | |||
2435 | 1165 | MIN(maxGridWidth , EXPO_GRID_SIZE), | 1314 | MIN(maxGridWidth , EXPO_GRID_SIZE), |
2436 | 1166 | maxGridHeight); | 1315 | maxGridHeight); |
2437 | 1167 | 1316 | ||
2441 | 1168 | v = gWindow->geometry ().vertices; | 1317 | int stride = gWindow->vertexBuffer ()->getVertexStride (); |
2442 | 1169 | v += gWindow->geometry ().vertexStride - 3; | 1318 | v = gWindow->vertexBuffer ()->getVertices (); |
2443 | 1170 | v += gWindow->geometry ().vertexStride * oldVCount; | 1319 | v += stride - 3; |
2444 | 1320 | v += stride * oldVCount; | ||
2445 | 1171 | 1321 | ||
2446 | 1172 | if (!window->onAllViewports ()) | 1322 | if (!window->onAllViewports ()) |
2447 | 1173 | { | 1323 | { |
2448 | @@ -1177,7 +1327,7 @@ | |||
2449 | 1177 | 1327 | ||
2450 | 1178 | lastX = -1000000000.0; | 1328 | lastX = -1000000000.0; |
2451 | 1179 | 1329 | ||
2453 | 1180 | for (i = oldVCount; i < gWindow->geometry ().vCount; i++) | 1330 | for (i = oldVCount; i < gWindow->vertexBuffer ()->countVertices (); i++) |
2454 | 1181 | { | 1331 | { |
2455 | 1182 | if (v[0] == lastX) | 1332 | if (v[0] == lastX) |
2456 | 1183 | { | 1333 | { |
2457 | @@ -1198,7 +1348,7 @@ | |||
2458 | 1198 | lastX = v[0]; | 1348 | lastX = v[0]; |
2459 | 1199 | lastZ = v[2]; | 1349 | lastZ = v[2]; |
2460 | 1200 | 1350 | ||
2462 | 1201 | v += gWindow->geometry ().vertexStride; | 1351 | v += stride; |
2463 | 1202 | } | 1352 | } |
2464 | 1203 | } | 1353 | } |
2465 | 1204 | else | 1354 | else |
2466 | @@ -1209,7 +1359,8 @@ | |||
2467 | 1209 | 1359 | ||
2468 | 1210 | void | 1360 | void |
2469 | 1211 | ExpoWindow::glDrawTexture (GLTexture *texture, | 1361 | ExpoWindow::glDrawTexture (GLTexture *texture, |
2471 | 1212 | GLFragment::Attrib& attrib, | 1362 | const GLMatrix &transform, |
2472 | 1363 | const GLWindowPaintAttrib &attrib, | ||
2473 | 1213 | unsigned int mask) | 1364 | unsigned int mask) |
2474 | 1214 | { | 1365 | { |
2475 | 1215 | if (eScreen->expoCam > 0.0 && | 1366 | if (eScreen->expoCam > 0.0 && |
2476 | @@ -1217,15 +1368,9 @@ | |||
2477 | 1217 | eScreen->gScreen->lighting () && | 1368 | eScreen->gScreen->lighting () && |
2478 | 1218 | screen->desktopWindowCount ()) | 1369 | screen->desktopWindowCount ()) |
2479 | 1219 | { | 1370 | { |
2480 | 1220 | unsigned int i, idx, vCount; | ||
2481 | 1221 | CompPoint offset; | 1371 | CompPoint offset; |
2482 | 1222 | float x; | ||
2483 | 1223 | GLfloat *v; | 1372 | GLfloat *v; |
2489 | 1224 | 1373 | GLVertexBuffer *vb = gWindow->vertexBuffer (); | |
2485 | 1225 | vCount = gWindow->geometry ().vCount; | ||
2486 | 1226 | |||
2487 | 1227 | if (eScreen->winNormals.size () < vCount * 3) | ||
2488 | 1228 | eScreen->winNormals.resize (vCount * 3); | ||
2490 | 1229 | 1374 | ||
2491 | 1230 | if (!window->onAllViewports ()) | 1375 | if (!window->onAllViewports ()) |
2492 | 1231 | { | 1376 | { |
2493 | @@ -1233,44 +1378,44 @@ | |||
2494 | 1233 | offset = window->getMovementForOffset (offset); | 1378 | offset = window->getMovementForOffset (offset); |
2495 | 1234 | } | 1379 | } |
2496 | 1235 | 1380 | ||
2499 | 1236 | v = gWindow->geometry ().vertices + | 1381 | int stride = vb->getVertexStride (); |
2500 | 1237 | (gWindow->geometry ().vertexStride - 3); | 1382 | v = vb->getVertices () + stride - 3; |
2501 | 1238 | 1383 | ||
2503 | 1239 | for (i = 0; i < vCount; i++) | 1384 | for (int i = 0; i < vb->countVertices (); i++) |
2504 | 1240 | { | 1385 | { |
2507 | 1241 | x = (float) (v[0] + offset.x () - screen->width () / 2) * | 1386 | float x = (v[0] + offset.x () - screen->width () / 2) * |
2508 | 1242 | eScreen->curveAngle / screen->width (); | 1387 | eScreen->curveAngle / screen->width (); |
2509 | 1243 | 1388 | ||
2510 | 1244 | while (x < 0) | 1389 | while (x < 0) |
2511 | 1245 | x += 360.0; | 1390 | x += 360.0; |
2512 | 1246 | 1391 | ||
2522 | 1247 | idx = floor (x); | 1392 | int idx = floor (x); |
2523 | 1248 | 1393 | ||
2524 | 1249 | eScreen->winNormals[i * 3] = -eScreen->vpNormals[idx * 3]; | 1394 | GLfloat normal[3]; |
2525 | 1250 | eScreen->winNormals[(i * 3) + 1] = | 1395 | normal[0] = -eScreen->vpNormals[idx * 3]; |
2526 | 1251 | eScreen->vpNormals[(idx * 3) + 1]; | 1396 | normal[1] = eScreen->vpNormals[(idx * 3) + 1]; |
2527 | 1252 | eScreen->winNormals[(i * 3) + 2] = | 1397 | normal[2] = eScreen->vpNormals[(idx * 3) + 2]; |
2528 | 1253 | eScreen->vpNormals[(idx * 3) + 2]; | 1398 | vb->addNormals (1, normal); |
2529 | 1254 | 1399 | ||
2530 | 1255 | v += gWindow->geometry ().vertexStride; | 1400 | v += stride; |
2531 | 1256 | } | 1401 | } |
2532 | 1257 | 1402 | ||
2533 | 1403 | /* I am not entirely certain if these ifdefs are necessary | ||
2534 | 1404 | * since we should be doing normalization in the shader, | ||
2535 | 1405 | * however I have them here for now */ | ||
2536 | 1406 | #ifndef USE_GLES | ||
2537 | 1258 | glEnable (GL_NORMALIZE); | 1407 | glEnable (GL_NORMALIZE); |
2544 | 1259 | glNormalPointer (GL_FLOAT,0, &eScreen->winNormals.at (0)); | 1408 | #endif |
2545 | 1260 | 1409 | gWindow->glDrawTexture (texture, transform, attrib, mask); | |
2546 | 1261 | glEnableClientState (GL_NORMAL_ARRAY); | 1410 | #ifndef USE_GLES |
2541 | 1262 | |||
2542 | 1263 | gWindow->glDrawTexture (texture, attrib, mask); | ||
2543 | 1264 | |||
2547 | 1265 | glDisable (GL_NORMALIZE); | 1411 | glDisable (GL_NORMALIZE); |
2550 | 1266 | glDisableClientState (GL_NORMAL_ARRAY); | 1412 | #endif |
2549 | 1267 | glNormal3f (0.0, 0.0, -1.0); | ||
2551 | 1268 | } | 1413 | } |
2552 | 1269 | else | 1414 | else |
2553 | 1270 | { | 1415 | { |
2557 | 1271 | glEnable (GL_NORMALIZE); | 1416 | // glEnable (GL_NORMALIZE); |
2558 | 1272 | gWindow->glDrawTexture (texture, attrib, mask); | 1417 | gWindow->glDrawTexture (texture, transform, attrib, mask); |
2559 | 1273 | glDisable (GL_NORMALIZE); | 1418 | // glDisable (GL_NORMALIZE); |
2560 | 1274 | } | 1419 | } |
2561 | 1275 | } | 1420 | } |
2562 | 1276 | 1421 | ||
2563 | 1277 | 1422 | ||
2564 | === modified file 'plugins/expo/src/expo.h' | |||
2565 | --- plugins/expo/src/expo.h 2012-08-09 14:42:56 +0000 | |||
2566 | +++ plugins/expo/src/expo.h 2012-08-22 06:16:22 +0000 | |||
2567 | @@ -110,7 +110,6 @@ | |||
2568 | 110 | float curveRadius; | 110 | float curveRadius; |
2569 | 111 | 111 | ||
2570 | 112 | std::vector<GLfloat> vpNormals; | 112 | std::vector<GLfloat> vpNormals; |
2571 | 113 | std::vector<GLfloat> winNormals; | ||
2572 | 114 | 113 | ||
2573 | 115 | CompScreen::GrabHandle grabIndex; | 114 | CompScreen::GrabHandle grabIndex; |
2574 | 116 | 115 | ||
2575 | @@ -142,15 +141,15 @@ | |||
2576 | 142 | 141 | ||
2577 | 143 | bool damageRect (bool, const CompRect&); | 142 | bool damageRect (bool, const CompRect&); |
2578 | 144 | 143 | ||
2580 | 145 | bool glDraw (const GLMatrix&, GLFragment::Attrib&, | 144 | bool glDraw (const GLMatrix&, const GLWindowPaintAttrib&, |
2581 | 146 | const CompRegion&, unsigned int); | 145 | const CompRegion&, unsigned int); |
2582 | 147 | bool glPaint (const GLWindowPaintAttrib&, const GLMatrix&, | 146 | bool glPaint (const GLWindowPaintAttrib&, const GLMatrix&, |
2583 | 148 | const CompRegion&, unsigned int); | 147 | const CompRegion&, unsigned int); |
2584 | 149 | void glAddGeometry (const GLTexture::MatrixList&, | 148 | void glAddGeometry (const GLTexture::MatrixList&, |
2585 | 150 | const CompRegion&, const CompRegion&, | 149 | const CompRegion&, const CompRegion&, |
2586 | 151 | unsigned int, unsigned int); | 150 | unsigned int, unsigned int); |
2589 | 152 | void glDrawTexture (GLTexture *, GLFragment::Attrib& attrib, | 151 | void glDrawTexture (GLTexture*, const GLMatrix&, |
2590 | 153 | unsigned int); | 152 | const GLWindowPaintAttrib&, unsigned int); |
2591 | 154 | 153 | ||
2592 | 155 | CompWindow *window; | 154 | CompWindow *window; |
2593 | 156 | CompositeWindow *cWindow; | 155 | CompositeWindow *cWindow; |
2594 | 157 | 156 | ||
2595 | === modified file 'plugins/ezoom/src/ezoom.cpp' | |||
2596 | --- plugins/ezoom/src/ezoom.cpp 2012-07-29 19:54:31 +0000 | |||
2597 | +++ plugins/ezoom/src/ezoom.cpp 2012-08-22 06:16:22 +0000 | |||
2598 | @@ -381,10 +381,13 @@ | |||
2599 | 381 | CompOutput *output, | 381 | CompOutput *output, |
2600 | 382 | CompRect box) | 382 | CompRect box) |
2601 | 383 | { | 383 | { |
2603 | 384 | GLMatrix zTransform = transform; | 384 | GLMatrix zTransform (transform); |
2604 | 385 | int x1,x2,y1,y2; | 385 | int x1,x2,y1,y2; |
2605 | 386 | int inx1, inx2, iny1, iny2; | 386 | int inx1, inx2, iny1, iny2; |
2606 | 387 | int out = output->id (); | 387 | int out = output->id (); |
2607 | 388 | GLushort colorData[4]; | ||
2608 | 389 | GLfloat vertexData[12]; | ||
2609 | 390 | GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer (); | ||
2610 | 388 | 391 | ||
2611 | 389 | zTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA); | 392 | zTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA); |
2612 | 390 | convertToZoomed (out, box.x1 (), box.y1 (), &inx1, &iny1); | 393 | convertToZoomed (out, box.x1 (), box.y1 (), &inx1, &iny1); |
2613 | @@ -394,23 +397,61 @@ | |||
2614 | 394 | y1 = MIN (iny1, iny2); | 397 | y1 = MIN (iny1, iny2); |
2615 | 395 | x2 = MAX (inx1, inx2); | 398 | x2 = MAX (inx1, inx2); |
2616 | 396 | y2 = MAX (iny1, iny2); | 399 | y2 = MAX (iny1, iny2); |
2634 | 397 | glPushMatrix (); | 400 | |
2635 | 398 | glLoadMatrixf (zTransform.getMatrix ()); | 401 | streamingBuffer->begin (GL_TRIANGLE_STRIP); |
2636 | 399 | glDisableClientState (GL_TEXTURE_COORD_ARRAY); | 402 | |
2637 | 400 | glEnable (GL_BLEND); | 403 | colorData[0] = 0x2fff; |
2638 | 401 | glColor4us (0x2fff, 0x2fff, 0x4fff, 0x4fff); | 404 | colorData[1] = 0x2fff; |
2639 | 402 | glRecti (x1,y2,x2,y1); | 405 | colorData[2] = 0x2fff; |
2640 | 403 | glColor4us (0x2fff, 0x2fff, 0x4fff, 0x9fff); | 406 | colorData[3] = 0x4fff; |
2641 | 404 | glBegin (GL_LINE_LOOP); | 407 | |
2642 | 405 | glVertex2i (x1, y1); | 408 | streamingBuffer->addColors (1, colorData); |
2643 | 406 | glVertex2i (x2, y1); | 409 | |
2644 | 407 | glVertex2i (x2, y2); | 410 | vertexData[0] = x1; |
2645 | 408 | glVertex2i (x1, y2); | 411 | vertexData[1] = y1; |
2646 | 409 | glEnd (); | 412 | vertexData[2] = 0.0f; |
2647 | 410 | glColor4usv (defaultColor); | 413 | vertexData[3] = x1; |
2648 | 411 | glDisable (GL_BLEND); | 414 | vertexData[4] = y2; |
2649 | 412 | glEnableClientState (GL_TEXTURE_COORD_ARRAY); | 415 | vertexData[5] = 0.0f; |
2650 | 413 | glPopMatrix (); | 416 | vertexData[6] = x2; |
2651 | 417 | vertexData[7] = y1; | ||
2652 | 418 | vertexData[8] = 0.0f; | ||
2653 | 419 | vertexData[9] = x2; | ||
2654 | 420 | vertexData[10] = y2; | ||
2655 | 421 | vertexData[11] = 0.0f; | ||
2656 | 422 | |||
2657 | 423 | streamingBuffer->addVertices (4, vertexData); | ||
2658 | 424 | |||
2659 | 425 | streamingBuffer->end (); | ||
2660 | 426 | streamingBuffer->render (zTransform); | ||
2661 | 427 | |||
2662 | 428 | |||
2663 | 429 | streamingBuffer->begin (GL_LINE_LOOP); | ||
2664 | 430 | |||
2665 | 431 | colorData[0] = 0x2fff; | ||
2666 | 432 | colorData[1] = 0x2fff; | ||
2667 | 433 | colorData[2] = 0x4fff; | ||
2668 | 434 | colorData[3] = 0x9fff; | ||
2669 | 435 | |||
2670 | 436 | streamingBuffer->addColors (1, colorData); | ||
2671 | 437 | |||
2672 | 438 | vertexData[0] = x1; | ||
2673 | 439 | vertexData[1] = y1; | ||
2674 | 440 | vertexData[2] = 0.0f; | ||
2675 | 441 | vertexData[3] = x2; | ||
2676 | 442 | vertexData[4] = y1; | ||
2677 | 443 | vertexData[5] = 0.0f; | ||
2678 | 444 | vertexData[6] = x2; | ||
2679 | 445 | vertexData[7] = y2; | ||
2680 | 446 | vertexData[8] = 0.0f; | ||
2681 | 447 | vertexData[9] = x1; | ||
2682 | 448 | vertexData[10] = y2; | ||
2683 | 449 | vertexData[11] = 0.0f; | ||
2684 | 450 | |||
2685 | 451 | streamingBuffer->addVertices (4, vertexData); | ||
2686 | 452 | |||
2687 | 453 | streamingBuffer->end (); | ||
2688 | 454 | streamingBuffer->render (zTransform); | ||
2689 | 414 | } | 455 | } |
2690 | 415 | /* Apply the zoom if we are grabbed. | 456 | /* Apply the zoom if we are grabbed. |
2691 | 416 | * Make sure to use the correct filter. | 457 | * Make sure to use the correct filter. |
2692 | @@ -1060,6 +1101,9 @@ | |||
2693 | 1060 | GLMatrix sTransform = transform; | 1101 | GLMatrix sTransform = transform; |
2694 | 1061 | float scaleFactor; | 1102 | float scaleFactor; |
2695 | 1062 | int ax, ay, x, y; | 1103 | int ax, ay, x, y; |
2696 | 1104 | GLfloat textureData[8]; | ||
2697 | 1105 | GLfloat vertexData[12]; | ||
2698 | 1106 | GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer (); | ||
2699 | 1063 | 1107 | ||
2700 | 1064 | /* | 1108 | /* |
2701 | 1065 | * XXX: expo knows how to handle mouse when zoomed, so we back off | 1109 | * XXX: expo knows how to handle mouse when zoomed, so we back off |
2702 | @@ -1073,37 +1117,55 @@ | |||
2703 | 1073 | 1117 | ||
2704 | 1074 | sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA); | 1118 | sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA); |
2705 | 1075 | convertToZoomed (out, mouse.x (), mouse.y (), &ax, &ay); | 1119 | convertToZoomed (out, mouse.x (), mouse.y (), &ax, &ay); |
2709 | 1076 | glPushMatrix (); | 1120 | sTransform.translate ((float) ax, (float) ay, 0.0f); |
2710 | 1077 | glLoadMatrixf (sTransform.getMatrix ()); | 1121 | |
2708 | 1078 | glTranslatef ((float) ax, (float) ay, 0.0f); | ||
2711 | 1079 | if (optionGetScaleMouseDynamic ()) | 1122 | if (optionGetScaleMouseDynamic ()) |
2712 | 1080 | scaleFactor = 1.0f / zooms.at (out).currentZoom; | 1123 | scaleFactor = 1.0f / zooms.at (out).currentZoom; |
2713 | 1081 | else | 1124 | else |
2714 | 1082 | scaleFactor = 1.0f / optionGetScaleMouseStatic (); | 1125 | scaleFactor = 1.0f / optionGetScaleMouseStatic (); |
2718 | 1083 | glScalef (scaleFactor, | 1126 | |
2719 | 1084 | scaleFactor, | 1127 | sTransform.scale (scaleFactor, scaleFactor, 1.0f); |
2717 | 1085 | 1.0f); | ||
2720 | 1086 | x = -cursor.hotX; | 1128 | x = -cursor.hotX; |
2721 | 1087 | y = -cursor.hotY; | 1129 | y = -cursor.hotY; |
2722 | 1088 | 1130 | ||
2723 | 1089 | glEnable (GL_BLEND); | 1131 | glEnable (GL_BLEND); |
2737 | 1090 | glBindTexture (GL_TEXTURE_RECTANGLE_ARB, cursor.texture); | 1132 | glEnable (GL_TEXTURE_2D); |
2738 | 1091 | glEnable (GL_TEXTURE_RECTANGLE_ARB); | 1133 | glBindTexture (GL_TEXTURE_2D, cursor.texture); |
2739 | 1092 | 1134 | ||
2740 | 1093 | glBegin (GL_QUADS); | 1135 | streamingBuffer->begin (GL_TRIANGLE_STRIP); |
2741 | 1094 | glTexCoord2d (0, 0); | 1136 | |
2742 | 1095 | glVertex2f (x, y); | 1137 | vertexData[0] = x; |
2743 | 1096 | glTexCoord2d (0, cursor.height); | 1138 | vertexData[1] = y; |
2744 | 1097 | glVertex2f (x, y + cursor.height); | 1139 | vertexData[2] = 0.0f; |
2745 | 1098 | glTexCoord2d (cursor.width, cursor.height); | 1140 | vertexData[3] = x; |
2746 | 1099 | glVertex2f (x + cursor.width, y + cursor.height); | 1141 | vertexData[4] = y + cursor.height; |
2747 | 1100 | glTexCoord2d (cursor.width, 0); | 1142 | vertexData[5] = 0.0f; |
2748 | 1101 | glVertex2f (x + cursor.width, y); | 1143 | vertexData[6] = x + cursor.width; |
2749 | 1102 | glEnd (); | 1144 | vertexData[7] = y; |
2750 | 1145 | vertexData[8] = 0.0f; | ||
2751 | 1146 | vertexData[9] = x + cursor.width; | ||
2752 | 1147 | vertexData[10] = y + cursor.height; | ||
2753 | 1148 | vertexData[11] = 0.0f; | ||
2754 | 1149 | |||
2755 | 1150 | streamingBuffer->addVertices (4, vertexData); | ||
2756 | 1151 | |||
2757 | 1152 | textureData[0] = 0; | ||
2758 | 1153 | textureData[1] = 0; | ||
2759 | 1154 | textureData[2] = 0; | ||
2760 | 1155 | textureData[3] = 1; | ||
2761 | 1156 | textureData[4] = 1; | ||
2762 | 1157 | textureData[5] = 0; | ||
2763 | 1158 | textureData[6] = 1; | ||
2764 | 1159 | textureData[7] = 1; | ||
2765 | 1160 | |||
2766 | 1161 | streamingBuffer->addTexCoords (0, 4, textureData); | ||
2767 | 1162 | |||
2768 | 1163 | streamingBuffer->end (); | ||
2769 | 1164 | streamingBuffer->render (sTransform); | ||
2770 | 1165 | |||
2771 | 1166 | glBindTexture (GL_TEXTURE_2D, 0); | ||
2772 | 1167 | glDisable (GL_TEXTURE_2D); | ||
2773 | 1103 | glDisable (GL_BLEND); | 1168 | glDisable (GL_BLEND); |
2774 | 1104 | glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0); | ||
2775 | 1105 | glDisable (GL_TEXTURE_RECTANGLE_ARB); | ||
2776 | 1106 | glPopMatrix (); | ||
2777 | 1107 | } | 1169 | } |
2778 | 1108 | } | 1170 | } |
2779 | 1109 | 1171 | ||
2780 | @@ -1120,16 +1182,20 @@ | |||
2781 | 1120 | { | 1182 | { |
2782 | 1121 | cursor->isSet = true; | 1183 | cursor->isSet = true; |
2783 | 1122 | cursor->screen = screen; | 1184 | cursor->screen = screen; |
2785 | 1123 | glEnable (GL_TEXTURE_RECTANGLE_ARB); | 1185 | |
2786 | 1186 | glEnable (GL_TEXTURE_2D); | ||
2787 | 1124 | glGenTextures (1, &cursor->texture); | 1187 | glGenTextures (1, &cursor->texture); |
2789 | 1125 | glBindTexture (GL_TEXTURE_RECTANGLE_ARB, cursor->texture); | 1188 | glBindTexture (GL_TEXTURE_2D, cursor->texture); |
2790 | 1126 | 1189 | ||
2797 | 1127 | glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, | 1190 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
2798 | 1128 | GL_TEXTURE_WRAP_S, GL_CLAMP); | 1191 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
2799 | 1129 | glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, | 1192 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, |
2800 | 1130 | GL_TEXTURE_WRAP_T, GL_CLAMP); | 1193 | gScreen->textureFilter ()); |
2801 | 1131 | } else { | 1194 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, |
2802 | 1132 | glEnable (GL_TEXTURE_RECTANGLE_ARB); | 1195 | gScreen->textureFilter ()); |
2803 | 1196 | } | ||
2804 | 1197 | else { | ||
2805 | 1198 | glEnable (GL_TEXTURE_2D); | ||
2806 | 1133 | } | 1199 | } |
2807 | 1134 | 1200 | ||
2808 | 1135 | XFixesCursorImage *ci = XFixesGetCursorImage (dpy); | 1201 | XFixesCursorImage *ci = XFixesGetCursorImage (dpy); |
2809 | @@ -1185,11 +1251,11 @@ | |||
2810 | 1185 | compLogMessage ("ezoom", CompLogLevelWarn, "unable to get system cursor image!"); | 1251 | compLogMessage ("ezoom", CompLogLevelWarn, "unable to get system cursor image!"); |
2811 | 1186 | } | 1252 | } |
2812 | 1187 | 1253 | ||
2815 | 1188 | glBindTexture (GL_TEXTURE_RECTANGLE_ARB, cursor->texture); | 1254 | glBindTexture (GL_TEXTURE_2D, cursor->texture); |
2816 | 1189 | glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, cursor->width, | 1255 | glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, cursor->width, |
2817 | 1190 | cursor->height, 0, GL_BGRA, GL_UNSIGNED_BYTE, pixels); | 1256 | cursor->height, 0, GL_BGRA, GL_UNSIGNED_BYTE, pixels); |
2820 | 1191 | glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0); | 1257 | glBindTexture (GL_TEXTURE_2D, 0); |
2821 | 1192 | glDisable (GL_TEXTURE_RECTANGLE_ARB); | 1258 | glDisable (GL_TEXTURE_2D); |
2822 | 1193 | 1259 | ||
2823 | 1194 | free (pixels); | 1260 | free (pixels); |
2824 | 1195 | } | 1261 | } |
2825 | 1196 | 1262 | ||
2826 | === modified file 'plugins/grid/src/grid.cpp' | |||
2827 | --- plugins/grid/src/grid.cpp 2012-08-03 10:12:25 +0000 | |||
2828 | +++ plugins/grid/src/grid.cpp 2012-08-22 06:16:22 +0000 | |||
2829 | @@ -432,35 +432,52 @@ | |||
2830 | 432 | CompRect rect; | 432 | CompRect rect; |
2831 | 433 | GLMatrix sTransform (transform); | 433 | GLMatrix sTransform (transform); |
2832 | 434 | std::vector<Animation>::iterator iter; | 434 | std::vector<Animation>::iterator iter; |
2833 | 435 | GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer (); | ||
2834 | 436 | GLfloat vertexData[12]; | ||
2835 | 437 | GLushort colorData[4]; | ||
2836 | 438 | GLushort *color; | ||
2837 | 439 | GLboolean isBlendingEnabled; | ||
2838 | 435 | 440 | ||
2839 | 436 | getPaintRectangle (rect); | 441 | getPaintRectangle (rect); |
2840 | 437 | 442 | ||
2841 | 438 | for (unsigned int i = 0; i < animations.size (); i++) | 443 | for (unsigned int i = 0; i < animations.size (); i++) |
2842 | 439 | setCurrentRect (animations.at (i)); | 444 | setCurrentRect (animations.at (i)); |
2843 | 440 | 445 | ||
2844 | 441 | glPushMatrix (); | ||
2845 | 442 | |||
2846 | 443 | sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA); | 446 | sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA); |
2847 | 444 | 447 | ||
2851 | 445 | glLoadMatrixf (sTransform.getMatrix ()); | 448 | glGetBooleanv (GL_BLEND, &isBlendingEnabled); |
2849 | 446 | |||
2850 | 447 | glDisableClientState (GL_TEXTURE_COORD_ARRAY); | ||
2852 | 448 | glEnable (GL_BLEND); | 449 | glEnable (GL_BLEND); |
2853 | 449 | 450 | ||
2854 | 450 | for (iter = animations.begin (); iter != animations.end () && animating; ++iter) | 451 | for (iter = animations.begin (); iter != animations.end () && animating; ++iter) |
2855 | 451 | { | 452 | { |
2856 | 452 | Animation& anim = *iter; | 453 | Animation& anim = *iter; |
2857 | 453 | float alpha = ((float) optionGetFillColorAlpha () / 65535.0f) * anim.opacity; | 454 | float alpha = ((float) optionGetFillColorAlpha () / 65535.0f) * anim.opacity; |
2868 | 454 | 455 | color = optionGetFillColor (); | |
2869 | 455 | /* fill rectangle */ | 456 | |
2870 | 456 | glColor4f (((float) optionGetFillColorRed () / 65535.0f) * alpha, | 457 | colorData[0] = alpha * color[0]; |
2871 | 457 | ((float) optionGetFillColorGreen () / 65535.0f) * alpha, | 458 | colorData[1] = alpha * color[1]; |
2872 | 458 | ((float) optionGetFillColorBlue () / 65535.0f) * alpha, | 459 | colorData[2] = alpha * color[2]; |
2873 | 459 | alpha); | 460 | colorData[3] = alpha * 65535.0f; |
2874 | 460 | 461 | ||
2875 | 461 | /* fill rectangle */ | 462 | vertexData[0] = anim.currentRect.x1 (); |
2876 | 462 | glRecti (anim.currentRect.x1 (), anim.currentRect.y2 (), | 463 | vertexData[1] = anim.currentRect.y1 (); |
2877 | 463 | anim.currentRect.x2 (), anim.currentRect.y1 ()); | 464 | vertexData[2] = 0.0f; |
2878 | 465 | vertexData[3] = anim.currentRect.x1 (); | ||
2879 | 466 | vertexData[4] = anim.currentRect.y2 (); | ||
2880 | 467 | vertexData[5] = 0.0f; | ||
2881 | 468 | vertexData[6] = anim.currentRect.x2 (); | ||
2882 | 469 | vertexData[7] = anim.currentRect.y1 (); | ||
2883 | 470 | vertexData[8] = 0.0f; | ||
2884 | 471 | vertexData[9] = anim.currentRect.x2 (); | ||
2885 | 472 | vertexData[10] = anim.currentRect.y2 (); | ||
2886 | 473 | vertexData[11] = 0.0f; | ||
2887 | 474 | |||
2888 | 475 | streamingBuffer->begin (GL_TRIANGLE_STRIP); | ||
2889 | 476 | streamingBuffer->addColors (1, colorData); | ||
2890 | 477 | streamingBuffer->addVertices (4, vertexData); | ||
2891 | 478 | |||
2892 | 479 | streamingBuffer->end (); | ||
2893 | 480 | streamingBuffer->render (sTransform); | ||
2894 | 464 | 481 | ||
2895 | 465 | /* Set outline rect smaller to avoid damage issues */ | 482 | /* Set outline rect smaller to avoid damage issues */ |
2896 | 466 | anim.currentRect.setGeometry (anim.currentRect.x () + 1, | 483 | anim.currentRect.setGeometry (anim.currentRect.x () + 1, |
2897 | @@ -468,63 +485,101 @@ | |||
2898 | 468 | anim.currentRect.width () - 2, | 485 | anim.currentRect.width () - 2, |
2899 | 469 | anim.currentRect.height () - 2); | 486 | anim.currentRect.height () - 2); |
2900 | 470 | 487 | ||
2901 | 471 | alpha = (float) (optionGetOutlineColorAlpha () / 65535.0f) * anim.opacity; | ||
2902 | 472 | |||
2903 | 473 | /* draw outline */ | 488 | /* draw outline */ |
2908 | 474 | glColor4f (((float) optionGetOutlineColorRed () / 65535.0f) * alpha, | 489 | alpha = ((float) optionGetOutlineColorAlpha () / 65535.0f) * anim.opacity; |
2909 | 475 | ((float) optionGetOutlineColorGreen () / 65535.0f) * alpha, | 490 | color = optionGetOutlineColor (); |
2910 | 476 | ((float) optionGetOutlineColorBlue () / 65535.0f) * alpha, | 491 | |
2911 | 477 | alpha); | 492 | colorData[0] = alpha * color[0]; |
2912 | 493 | colorData[1] = alpha * color[1]; | ||
2913 | 494 | colorData[2] = alpha * color[2]; | ||
2914 | 495 | colorData[3] = alpha * 65535.0f; | ||
2915 | 496 | |||
2916 | 497 | vertexData[0] = anim.currentRect.x1 (); | ||
2917 | 498 | vertexData[1] = anim.currentRect.y1 (); | ||
2918 | 499 | vertexData[3] = anim.currentRect.x1 (); | ||
2919 | 500 | vertexData[4] = anim.currentRect.y2 (); | ||
2920 | 501 | vertexData[6] = anim.currentRect.x2 (); | ||
2921 | 502 | vertexData[7] = anim.currentRect.y2 (); | ||
2922 | 503 | vertexData[9] = anim.currentRect.x2 (); | ||
2923 | 504 | vertexData[10] = anim.currentRect.y1 (); | ||
2924 | 478 | 505 | ||
2925 | 479 | glLineWidth (2.0); | 506 | glLineWidth (2.0); |
2926 | 480 | 507 | ||
2933 | 481 | glBegin (GL_LINE_LOOP); | 508 | streamingBuffer->begin (GL_LINE_LOOP); |
2934 | 482 | glVertex2i (anim.currentRect.x1 (), anim.currentRect.y1 ()); | 509 | streamingBuffer->addColors (1, colorData); |
2935 | 483 | glVertex2i (anim.currentRect.x2 (), anim.currentRect.y1 ()); | 510 | streamingBuffer->addVertices (4, vertexData); |
2936 | 484 | glVertex2i (anim.currentRect.x2 (), anim.currentRect.y2 ()); | 511 | |
2937 | 485 | glVertex2i (anim.currentRect.x1 (), anim.currentRect.y2 ()); | 512 | streamingBuffer->end (); |
2938 | 486 | glEnd (); | 513 | streamingBuffer->render (sTransform); |
2939 | 487 | } | 514 | } |
2940 | 488 | 515 | ||
2941 | 489 | if (!animating) | 516 | if (!animating) |
2942 | 490 | { | 517 | { |
2944 | 491 | /* fill rectangle */ | 518 | /* draw filled rectangle */ |
2945 | 492 | float alpha = (float) optionGetFillColorAlpha () / 65535.0f; | 519 | float alpha = (float) optionGetFillColorAlpha () / 65535.0f; |
2953 | 493 | 520 | color = optionGetFillColor (); | |
2954 | 494 | /* fill rectangle */ | 521 | |
2955 | 495 | glColor4f (((float) optionGetFillColorRed () / 65535.0f) * alpha, | 522 | colorData[0] = alpha * color[0]; |
2956 | 496 | ((float) optionGetFillColorGreen () / 65535.0f) * alpha, | 523 | colorData[1] = alpha * color[1]; |
2957 | 497 | ((float) optionGetFillColorBlue () / 65535.0f) * alpha, | 524 | colorData[2] = alpha * color[2]; |
2958 | 498 | alpha); | 525 | colorData[3] = alpha * 65535.0f; |
2959 | 499 | glRecti (rect.x1 (), rect.y2 (), rect.x2 (), rect.y1 ()); | 526 | |
2960 | 527 | vertexData[0] = rect.x1 (); | ||
2961 | 528 | vertexData[1] = rect.y1 (); | ||
2962 | 529 | vertexData[2] = 0.0f; | ||
2963 | 530 | vertexData[3] = rect.x1 (); | ||
2964 | 531 | vertexData[4] = rect.y2 (); | ||
2965 | 532 | vertexData[5] = 0.0f; | ||
2966 | 533 | vertexData[6] = rect.x2 (); | ||
2967 | 534 | vertexData[7] = rect.y1 (); | ||
2968 | 535 | vertexData[8] = 0.0f; | ||
2969 | 536 | vertexData[9] = rect.x2 (); | ||
2970 | 537 | vertexData[10] = rect.y2 (); | ||
2971 | 538 | vertexData[11] = 0.0f; | ||
2972 | 539 | |||
2973 | 540 | streamingBuffer->begin (GL_TRIANGLE_STRIP); | ||
2974 | 541 | streamingBuffer->addColors (1, colorData); | ||
2975 | 542 | streamingBuffer->addVertices (4, vertexData); | ||
2976 | 543 | |||
2977 | 544 | streamingBuffer->end (); | ||
2978 | 545 | streamingBuffer->render (sTransform); | ||
2979 | 500 | 546 | ||
2980 | 501 | /* Set outline rect smaller to avoid damage issues */ | 547 | /* Set outline rect smaller to avoid damage issues */ |
2983 | 502 | rect.setGeometry (rect.x () + 1, rect.y () + 1, | 548 | rect.setGeometry (rect.x () + 1, |
2984 | 503 | rect.width () - 2, rect.height () - 2); | 549 | rect.y () + 1, |
2985 | 550 | rect.width () - 2, | ||
2986 | 551 | rect.height () - 2); | ||
2987 | 504 | 552 | ||
2988 | 505 | /* draw outline */ | 553 | /* draw outline */ |
2989 | 506 | alpha = (float) optionGetOutlineColorAlpha () / 65535.0f; | 554 | alpha = (float) optionGetOutlineColorAlpha () / 65535.0f; |
2996 | 507 | 555 | color = optionGetOutlineColor (); | |
2997 | 508 | /* draw outline */ | 556 | |
2998 | 509 | glColor4f (((float) optionGetOutlineColorRed () / 65535.0f) * alpha, | 557 | colorData[0] = alpha * color[0]; |
2999 | 510 | ((float) optionGetOutlineColorGreen () / 65535.0f) * alpha, | 558 | colorData[1] = alpha * color[1]; |
3000 | 511 | ((float) optionGetOutlineColorBlue () / 65535.0f) * alpha, | 559 | colorData[2] = alpha * color[2]; |
3001 | 512 | alpha); | 560 | colorData[3] = alpha * 65535.0f; |
3002 | 561 | |||
3003 | 562 | vertexData[0] = rect.x1 (); | ||
3004 | 563 | vertexData[1] = rect.y1 (); | ||
3005 | 564 | vertexData[3] = rect.x1 (); | ||
3006 | 565 | vertexData[4] = rect.y2 (); | ||
3007 | 566 | vertexData[6] = rect.x2 (); | ||
3008 | 567 | vertexData[7] = rect.y2 (); | ||
3009 | 568 | vertexData[9] = rect.x2 (); | ||
3010 | 569 | vertexData[10] = rect.y1 (); | ||
3011 | 513 | 570 | ||
3012 | 514 | glLineWidth (2.0); | 571 | glLineWidth (2.0); |
3019 | 515 | glBegin (GL_LINE_LOOP); | 572 | |
3020 | 516 | glVertex2i (rect.x1 (), rect.y1 ()); | 573 | streamingBuffer->begin (GL_LINE_LOOP); |
3021 | 517 | glVertex2i (rect.x2 (), rect.y1 ()); | 574 | streamingBuffer->addColors (1, colorData); |
3022 | 518 | glVertex2i (rect.x2 (), rect.y2 ()); | 575 | streamingBuffer->addVertices (4, vertexData); |
3023 | 519 | glVertex2i (rect.x1 (), rect.y2 ()); | 576 | |
3024 | 520 | glEnd (); | 577 | streamingBuffer->end (); |
3025 | 578 | streamingBuffer->render (sTransform); | ||
3026 | 521 | } | 579 | } |
3027 | 522 | 580 | ||
3030 | 523 | /* clean up */ | 581 | if (!isBlendingEnabled) |
3029 | 524 | glColor4usv (defaultColor); | ||
3031 | 525 | glDisable (GL_BLEND); | 582 | glDisable (GL_BLEND); |
3032 | 526 | glEnableClientState (GL_TEXTURE_COORD_ARRAY); | ||
3033 | 527 | glPopMatrix (); | ||
3034 | 528 | } | 583 | } |
3035 | 529 | 584 | ||
3036 | 530 | bool | 585 | bool |
3037 | 531 | 586 | ||
3038 | === modified file 'plugins/imgsvg/src/imgsvg.cpp' | |||
3039 | --- plugins/imgsvg/src/imgsvg.cpp 2012-01-18 16:26:45 +0000 | |||
3040 | +++ plugins/imgsvg/src/imgsvg.cpp 2012-08-22 06:16:22 +0000 | |||
3041 | @@ -221,11 +221,11 @@ | |||
3042 | 221 | 221 | ||
3043 | 222 | bool | 222 | bool |
3044 | 223 | SvgWindow::glDraw (const GLMatrix &transform, | 223 | SvgWindow::glDraw (const GLMatrix &transform, |
3046 | 224 | GLFragment::Attrib &fragment, | 224 | const GLWindowPaintAttrib &attrib, |
3047 | 225 | const CompRegion ®ion, | 225 | const CompRegion ®ion, |
3048 | 226 | unsigned int mask) | 226 | unsigned int mask) |
3049 | 227 | { | 227 | { |
3051 | 228 | bool status = gWindow->glDraw (transform, fragment, region, mask); | 228 | bool status = gWindow->glDraw (transform, attrib, region, mask); |
3052 | 229 | 229 | ||
3053 | 230 | if (!status) | 230 | if (!status) |
3054 | 231 | return status; | 231 | return status; |
3055 | @@ -251,13 +251,15 @@ | |||
3056 | 251 | { | 251 | { |
3057 | 252 | matrix[0] = context->texture[0].matrices[i]; | 252 | matrix[0] = context->texture[0].matrices[i]; |
3058 | 253 | 253 | ||
3060 | 254 | gWindow->geometry ().reset (); | 254 | gWindow->vertexBuffer ()->begin (); |
3061 | 255 | gWindow->glAddGeometry (matrix, context->box, reg); | 255 | gWindow->glAddGeometry (matrix, context->box, reg); |
3062 | 256 | gWindow->vertexBuffer ()->end (); | ||
3063 | 256 | 257 | ||
3064 | 257 | if (mask & PAINT_WINDOW_TRANSLUCENT_MASK) | 258 | if (mask & PAINT_WINDOW_TRANSLUCENT_MASK) |
3065 | 258 | mask |= PAINT_WINDOW_BLEND_MASK; | 259 | mask |= PAINT_WINDOW_BLEND_MASK; |
3066 | 259 | 260 | ||
3068 | 260 | gWindow->glDrawTexture (context->texture[0].textures[i], fragment, mask); | 261 | gWindow->glDrawTexture (context->texture[0].textures[i], transform, |
3069 | 262 | attrib, mask); | ||
3070 | 261 | 263 | ||
3071 | 262 | if (rect.width () > 0 && rect.height () > 0) | 264 | if (rect.width () > 0 && rect.height () > 0) |
3072 | 263 | { | 265 | { |
3073 | @@ -321,11 +323,12 @@ | |||
3074 | 321 | saveFilter = gScreen->filter (SCREEN_TRANS_FILTER); | 323 | saveFilter = gScreen->filter (SCREEN_TRANS_FILTER); |
3075 | 322 | gScreen->setFilter (SCREEN_TRANS_FILTER, GLTexture::Good); | 324 | gScreen->setFilter (SCREEN_TRANS_FILTER, GLTexture::Good); |
3076 | 323 | 325 | ||
3078 | 324 | gWindow->geometry ().reset (); | 326 | gWindow->vertexBuffer ()->begin (); |
3079 | 325 | gWindow->glAddGeometry (matrix, r, reg); | 327 | gWindow->glAddGeometry (matrix, r, reg); |
3080 | 328 | gWindow->vertexBuffer ()->end (); | ||
3081 | 326 | 329 | ||
3082 | 327 | gWindow->glDrawTexture (context->texture[1].textures[j], | 330 | gWindow->glDrawTexture (context->texture[1].textures[j], |
3084 | 328 | fragment, mask); | 331 | transform, attrib, mask); |
3085 | 329 | 332 | ||
3086 | 330 | gScreen->setFilter (SCREEN_TRANS_FILTER, saveFilter); | 333 | gScreen->setFilter (SCREEN_TRANS_FILTER, saveFilter); |
3087 | 331 | } | 334 | } |
3088 | 332 | 335 | ||
3089 | === modified file 'plugins/imgsvg/src/imgsvg.h' | |||
3090 | --- plugins/imgsvg/src/imgsvg.h 2012-08-22 05:05:13 +0000 | |||
3091 | +++ plugins/imgsvg/src/imgsvg.h 2012-08-22 06:16:22 +0000 | |||
3092 | @@ -81,7 +81,8 @@ | |||
3093 | 81 | SvgWindow (CompWindow *window); | 81 | SvgWindow (CompWindow *window); |
3094 | 82 | ~SvgWindow (); | 82 | ~SvgWindow (); |
3095 | 83 | 83 | ||
3097 | 84 | bool glDraw (const GLMatrix &transform, GLFragment::Attrib &fragment, | 84 | bool glDraw (const GLMatrix &transform, |
3098 | 85 | const GLWindowPaintAttrib &attrib, | ||
3099 | 85 | const CompRegion ®ion, unsigned int mask); | 86 | const CompRegion ®ion, unsigned int mask); |
3100 | 86 | void moveNotify (int dx, int dy, bool immediate); | 87 | void moveNotify (int dx, int dy, bool immediate); |
3101 | 87 | void resizeNotify (int dx, int dy, int dwidth, int dheight); | 88 | void resizeNotify (int dx, int dy, int dwidth, int dheight); |
3102 | 88 | 89 | ||
3103 | === modified file 'plugins/kdecompat/src/kdecompat.cpp' | |||
3104 | --- plugins/kdecompat/src/kdecompat.cpp 2012-05-27 04:32:55 +0000 | |||
3105 | +++ plugins/kdecompat/src/kdecompat.cpp 2012-08-22 06:16:22 +0000 | |||
3106 | @@ -204,7 +204,6 @@ | |||
3107 | 204 | 204 | ||
3108 | 205 | if (mSlideData && mSlideData->remaining) | 205 | if (mSlideData && mSlideData->remaining) |
3109 | 206 | { | 206 | { |
3110 | 207 | GLFragment::Attrib fragment (gWindow->paintAttrib ()); | ||
3111 | 208 | GLMatrix wTransform = transform; | 207 | GLMatrix wTransform = transform; |
3112 | 209 | SlideData *data = mSlideData; | 208 | SlideData *data = mSlideData; |
3113 | 210 | float xTranslate = 0, yTranslate = 0, remainder; | 209 | float xTranslate = 0, yTranslate = 0, remainder; |
3114 | @@ -241,26 +240,20 @@ | |||
3115 | 241 | status = gWindow->glPaint (attrib, transform, region, mask | | 240 | status = gWindow->glPaint (attrib, transform, region, mask | |
3116 | 242 | PAINT_WINDOW_NO_CORE_INSTANCE_MASK); | 241 | PAINT_WINDOW_NO_CORE_INSTANCE_MASK); |
3117 | 243 | 242 | ||
3119 | 244 | if (window->alpha () || fragment.getOpacity () != OPAQUE) | 243 | if (window->alpha () || attrib.opacity != OPAQUE) |
3120 | 245 | mask |= PAINT_WINDOW_TRANSLUCENT_MASK; | 244 | mask |= PAINT_WINDOW_TRANSLUCENT_MASK; |
3121 | 246 | 245 | ||
3122 | 247 | wTransform.translate (xTranslate, yTranslate, 0.0f); | 246 | wTransform.translate (xTranslate, yTranslate, 0.0f); |
3123 | 248 | 247 | ||
3124 | 249 | glPushMatrix (); | ||
3125 | 250 | glLoadMatrixf (wTransform.getMatrix ()); | ||
3126 | 251 | |||
3127 | 252 | glPushAttrib (GL_SCISSOR_BIT); | ||
3128 | 253 | glEnable (GL_SCISSOR_TEST); | 248 | glEnable (GL_SCISSOR_TEST); |
3129 | 254 | 249 | ||
3130 | 255 | glScissor (clipBox.x1 (), screen->height () - clipBox.y2 (), | 250 | glScissor (clipBox.x1 (), screen->height () - clipBox.y2 (), |
3131 | 256 | clipBox.width (), clipBox.height ()); | 251 | clipBox.width (), clipBox.height ()); |
3132 | 257 | 252 | ||
3134 | 258 | status = gWindow->glDraw (wTransform, fragment, region, | 253 | status = gWindow->glDraw (wTransform, attrib, region, |
3135 | 259 | mask | PAINT_WINDOW_TRANSFORMED_MASK); | 254 | mask | PAINT_WINDOW_TRANSFORMED_MASK); |
3136 | 260 | 255 | ||
3137 | 261 | glDisable (GL_SCISSOR_TEST); | 256 | glDisable (GL_SCISSOR_TEST); |
3138 | 262 | glPopAttrib (); | ||
3139 | 263 | glPopMatrix (); | ||
3140 | 264 | } | 257 | } |
3141 | 265 | 258 | ||
3142 | 266 | foreach (const Thumb& thumb, mPreviews) | 259 | foreach (const Thumb& thumb, mPreviews) |
3143 | @@ -329,20 +322,17 @@ | |||
3144 | 329 | matrices[0].x0 -= (tw->x () * icon->matrix ().xx); | 322 | matrices[0].x0 -= (tw->x () * icon->matrix ().xx); |
3145 | 330 | matrices[0].y0 -= (tw->y () * icon->matrix ().yy); | 323 | matrices[0].y0 -= (tw->y () * icon->matrix ().yy); |
3146 | 331 | 324 | ||
3148 | 332 | gtw->geometry ().reset (); | 325 | gtw->vertexBuffer ()->begin (); |
3149 | 333 | gtw->glAddGeometry (matrices, tw->geometry (), infiniteRegion); | 326 | gtw->glAddGeometry (matrices, tw->geometry (), infiniteRegion); |
3153 | 334 | 327 | gtw->vertexBuffer ()->end (); | |
3151 | 335 | if (!gtw->geometry ().vertices) | ||
3152 | 336 | icon = NULL; | ||
3154 | 337 | } | 328 | } |
3155 | 338 | } | 329 | } |
3156 | 339 | 330 | ||
3157 | 340 | if (!gtw->textures ().empty () || icon) | 331 | if (!gtw->textures ().empty () || icon) |
3158 | 341 | { | 332 | { |
3159 | 342 | GLFragment::Attrib fragment (attrib); | ||
3160 | 343 | GLMatrix wTransform (transform); | 333 | GLMatrix wTransform (transform); |
3161 | 344 | 334 | ||
3163 | 345 | if (tw->alpha () || fragment.getOpacity () != OPAQUE) | 335 | if (tw->alpha () || attrib.opacity != OPAQUE) |
3164 | 346 | paintMask |= PAINT_WINDOW_TRANSLUCENT_MASK; | 336 | paintMask |= PAINT_WINDOW_TRANSLUCENT_MASK; |
3165 | 347 | 337 | ||
3166 | 348 | wTransform.translate (tw->x (), tw->y (), 0.0f); | 338 | wTransform.translate (tw->x (), tw->y (), 0.0f); |
3167 | @@ -351,16 +341,11 @@ | |||
3168 | 351 | yTranslate / yScale - tw->y (), | 341 | yTranslate / yScale - tw->y (), |
3169 | 352 | 0.0f); | 342 | 0.0f); |
3170 | 353 | 343 | ||
3171 | 354 | glPushMatrix (); | ||
3172 | 355 | glLoadMatrixf (wTransform.getMatrix ()); | ||
3173 | 356 | |||
3174 | 357 | if (!gtw->textures ().empty ()) | 344 | if (!gtw->textures ().empty ()) |
3176 | 358 | gtw->glDraw (wTransform, fragment, | 345 | gtw->glDraw (wTransform, attrib, |
3177 | 359 | infiniteRegion, paintMask); | 346 | infiniteRegion, paintMask); |
3178 | 360 | else if (icon) | 347 | else if (icon) |
3182 | 361 | gtw->glDrawTexture (icon, fragment, paintMask); | 348 | gtw->glDrawTexture (icon, wTransform, attrib, paintMask); |
3180 | 362 | |||
3181 | 363 | glPopMatrix (); | ||
3183 | 364 | } | 349 | } |
3184 | 365 | } | 350 | } |
3185 | 366 | 351 | ||
3186 | 367 | 352 | ||
3187 | === modified file 'plugins/mag/src/mag.cpp' | |||
3188 | --- plugins/mag/src/mag.cpp 2012-05-27 04:32:55 +0000 | |||
3189 | +++ plugins/mag/src/mag.cpp 2012-08-22 06:16:22 +0000 | |||
3190 | @@ -38,7 +38,9 @@ | |||
3191 | 38 | 38 | ||
3192 | 39 | if (program) | 39 | if (program) |
3193 | 40 | { | 40 | { |
3194 | 41 | #if 0 | ||
3195 | 41 | GL::deletePrograms (1, &program); | 42 | GL::deletePrograms (1, &program); |
3196 | 43 | #endif | ||
3197 | 42 | program = 0; | 44 | program = 0; |
3198 | 43 | } | 45 | } |
3199 | 44 | } | 46 | } |
3200 | @@ -46,6 +48,7 @@ | |||
3201 | 46 | bool | 48 | bool |
3202 | 47 | MagScreen::loadFragmentProgram () | 49 | MagScreen::loadFragmentProgram () |
3203 | 48 | { | 50 | { |
3204 | 51 | #if 0 | ||
3205 | 49 | char buffer[1024]; | 52 | char buffer[1024]; |
3206 | 50 | GLsizei bufSize; | 53 | GLsizei bufSize; |
3207 | 51 | GLint errorPos; | 54 | GLint errorPos; |
3208 | @@ -85,11 +88,14 @@ | |||
3209 | 85 | GL::bindProgram (GL_FRAGMENT_PROGRAM_ARB, 0); | 88 | GL::bindProgram (GL_FRAGMENT_PROGRAM_ARB, 0); |
3210 | 86 | 89 | ||
3211 | 87 | return true; | 90 | return true; |
3212 | 91 | #endif | ||
3213 | 92 | return false; | ||
3214 | 88 | } | 93 | } |
3215 | 89 | 94 | ||
3216 | 90 | bool | 95 | bool |
3217 | 91 | MagScreen::loadImages () | 96 | MagScreen::loadImages () |
3218 | 92 | { | 97 | { |
3219 | 98 | #if 0 | ||
3220 | 93 | CompString overlay_s = optionGetOverlay (); | 99 | CompString overlay_s = optionGetOverlay (); |
3221 | 94 | CompString mask_s = optionGetMask (); | 100 | CompString mask_s = optionGetMask (); |
3222 | 95 | CompString pname ("mag"); | 101 | CompString pname ("mag"); |
3223 | @@ -130,6 +136,8 @@ | |||
3224 | 130 | } | 136 | } |
3225 | 131 | 137 | ||
3226 | 132 | return true; | 138 | return true; |
3227 | 139 | #endif | ||
3228 | 140 | return false; | ||
3229 | 133 | } | 141 | } |
3230 | 134 | 142 | ||
3231 | 135 | void | 143 | void |
3232 | @@ -317,8 +325,6 @@ | |||
3233 | 317 | 325 | ||
3234 | 318 | if (!adjust && zoom == 1.0 && (width || height)) | 326 | if (!adjust && zoom == 1.0 && (width || height)) |
3235 | 319 | { | 327 | { |
3236 | 320 | glEnable (target); | ||
3237 | 321 | |||
3238 | 322 | glBindTexture (target, texture); | 328 | glBindTexture (target, texture); |
3239 | 323 | 329 | ||
3240 | 324 | glTexImage2D (target, 0, GL_RGB, 0, 0, 0, | 330 | glTexImage2D (target, 0, GL_RGB, 0, 0, 0, |
3241 | @@ -328,8 +334,6 @@ | |||
3242 | 328 | height = 0; | 334 | height = 0; |
3243 | 329 | 335 | ||
3244 | 330 | glBindTexture (target, 0); | 336 | glBindTexture (target, 0); |
3245 | 331 | |||
3246 | 332 | glDisable (target); | ||
3247 | 333 | } | 337 | } |
3248 | 334 | 338 | ||
3249 | 335 | if (zoom == 1.0 && !adjust) | 339 | if (zoom == 1.0 && !adjust) |
3250 | @@ -357,6 +361,10 @@ | |||
3251 | 357 | bool kScreen; | 361 | bool kScreen; |
3252 | 358 | unsigned short *color; | 362 | unsigned short *color; |
3253 | 359 | float tmp; | 363 | float tmp; |
3254 | 364 | GLMatrix projection; | ||
3255 | 365 | GLMatrix modelview; | ||
3256 | 366 | GLVertexBuffer *vb = GLVertexBuffer::streamingBuffer (); | ||
3257 | 367 | const GLWindowPaintAttrib attrib = { OPAQUE, BRIGHT, COLOR, 0, 0, 0, 0 }; | ||
3258 | 360 | 368 | ||
3259 | 361 | w = optionGetBoxWidth (); | 369 | w = optionGetBoxWidth (); |
3260 | 362 | h = optionGetBoxHeight (); | 370 | h = optionGetBoxHeight (); |
3261 | @@ -393,8 +401,6 @@ | |||
3262 | 393 | ch = h; | 401 | ch = h; |
3263 | 394 | } | 402 | } |
3264 | 395 | 403 | ||
3265 | 396 | glEnable (target); | ||
3266 | 397 | |||
3267 | 398 | glBindTexture (target, texture); | 404 | glBindTexture (target, texture); |
3268 | 399 | 405 | ||
3269 | 400 | if (width != w || height != h) | 406 | if (width != w || height != h) |
3270 | @@ -419,13 +425,6 @@ | |||
3271 | 419 | ph = 1.0; | 425 | ph = 1.0; |
3272 | 420 | } | 426 | } |
3273 | 421 | 427 | ||
3274 | 422 | glMatrixMode (GL_PROJECTION); | ||
3275 | 423 | glPushMatrix (); | ||
3276 | 424 | glLoadIdentity (); | ||
3277 | 425 | glMatrixMode (GL_MODELVIEW); | ||
3278 | 426 | glPushMatrix (); | ||
3279 | 427 | glLoadIdentity (); | ||
3280 | 428 | |||
3281 | 429 | vc[0] = ((x1 * 2.0) / screen->width ()) - 1.0; | 428 | vc[0] = ((x1 * 2.0) / screen->width ()) - 1.0; |
3282 | 430 | vc[1] = ((x2 * 2.0) / screen->width ()) - 1.0; | 429 | vc[1] = ((x2 * 2.0) / screen->width ()) - 1.0; |
3283 | 431 | vc[2] = ((y1 * -2.0) / screen->height ()) + 1.0; | 430 | vc[2] = ((y1 * -2.0) / screen->height ()) + 1.0; |
3284 | @@ -436,41 +435,63 @@ | |||
3285 | 436 | tc[2] = h * ph; | 435 | tc[2] = h * ph; |
3286 | 437 | tc[3] = 0.0; | 436 | tc[3] = 0.0; |
3287 | 438 | 437 | ||
3293 | 439 | glColor4usv (defaultColor); | 438 | /* Draw zoom box contents */ |
3294 | 440 | 439 | glScissor (x1, screen->height () - y2, w, h); | |
3295 | 441 | glPushMatrix (); | 440 | |
3296 | 442 | 441 | glEnable (GL_SCISSOR_TEST); | |
3297 | 443 | glTranslatef ((float)(posX - (screen->width () / 2)) * 2 / screen->width (), | 442 | |
3298 | 443 | modelview.translate ((float)(posX - (screen->width () / 2)) * 2 / screen->width (), | ||
3299 | 444 | (float)(posY - (screen->height () / 2)) * 2 / -screen->height (), 0.0); | 444 | (float)(posY - (screen->height () / 2)) * 2 / -screen->height (), 0.0); |
3300 | 445 | 445 | ||
3302 | 446 | glScalef (zoom, zoom, 1.0); | 446 | modelview.scale (zoom, zoom, 1.0); |
3303 | 447 | 447 | ||
3305 | 448 | glTranslatef ((float)((screen->width () / 2) - posX) * 2 / screen->width (), | 448 | modelview.translate ((float)((screen->width () / 2) - posX) * 2 / screen->width (), |
3306 | 449 | (float)((screen->height () / 2) - posY) * 2 / -screen->height (), 0.0); | 449 | (float)((screen->height () / 2) - posY) * 2 / -screen->height (), 0.0); |
3307 | 450 | 450 | ||
3322 | 451 | glScissor (x1, screen->height () - y2, w, h); | 451 | GLfloat vertices[] = { |
3323 | 452 | 452 | vc[0], vc[2], 0, | |
3324 | 453 | glEnable (GL_SCISSOR_TEST); | 453 | vc[0], vc[3], 0, |
3325 | 454 | 454 | vc[1], vc[2], 0, | |
3326 | 455 | glBegin (GL_QUADS); | 455 | vc[1], vc[3], 0, |
3327 | 456 | glTexCoord2f (tc[0], tc[2]); | 456 | }; |
3328 | 457 | glVertex2f (vc[0], vc[2]); | 457 | |
3329 | 458 | glTexCoord2f (tc[0], tc[3]); | 458 | GLfloat texcoords[] = { |
3330 | 459 | glVertex2f (vc[0], vc[3]); | 459 | tc[0], tc[2], |
3331 | 460 | glTexCoord2f (tc[1], tc[3]); | 460 | tc[0], tc[3], |
3332 | 461 | glVertex2f (vc[1], vc[3]); | 461 | tc[1], tc[2], |
3333 | 462 | glTexCoord2f (tc[1], tc[2]); | 462 | tc[1], tc[3], |
3334 | 463 | glVertex2f (vc[1], vc[2]); | 463 | }; |
3335 | 464 | glEnd (); | 464 | |
3336 | 465 | vb->begin (GL_TRIANGLE_STRIP); | ||
3337 | 466 | vb->colorDefault (); | ||
3338 | 467 | vb->addVertices (4, vertices); | ||
3339 | 468 | vb->addTexCoords (0, 4, texcoords); | ||
3340 | 469 | vb->end (); | ||
3341 | 470 | |||
3342 | 471 | vb->render (projection, modelview, attrib); | ||
3343 | 465 | 472 | ||
3344 | 466 | glDisable (GL_SCISSOR_TEST); | 473 | glDisable (GL_SCISSOR_TEST); |
3348 | 467 | 474 | modelview.reset (); | |
3346 | 468 | glPopMatrix (); | ||
3347 | 469 | |||
3349 | 470 | glBindTexture (target, 0); | 475 | glBindTexture (target, 0); |
3350 | 471 | 476 | ||
3353 | 472 | glDisable (target); | 477 | /* Save blending state */ |
3354 | 473 | 478 | #if USE_GLES | |
3355 | 479 | GLboolean isBlendingEnabled = GL_TRUE; | ||
3356 | 480 | GLint blendSrcRGB = GL_ONE; | ||
3357 | 481 | GLint blendSrcAlpha = GL_ONE; | ||
3358 | 482 | GLint blendDstRGB = GL_ZERO; | ||
3359 | 483 | GLint blendDstAlpha = GL_ZERO; | ||
3360 | 484 | |||
3361 | 485 | glGetBooleanv (GL_BLEND, &isBlendingEnabled); | ||
3362 | 486 | glGetIntegerv (GL_BLEND_SRC_RGB, &blendSrcRGB); | ||
3363 | 487 | glGetIntegerv (GL_BLEND_DST_RGB, &blendDstRGB); | ||
3364 | 488 | glGetIntegerv (GL_BLEND_SRC_ALPHA, &blendSrcAlpha); | ||
3365 | 489 | glGetIntegerv (GL_BLEND_DST_ALPHA, &blendDstAlpha); | ||
3366 | 490 | #else | ||
3367 | 491 | glPushAttrib (GL_COLOR_BUFFER_BIT); | ||
3368 | 492 | #endif | ||
3369 | 493 | |||
3370 | 494 | /* Draw zoom box border */ | ||
3371 | 474 | glEnable (GL_BLEND); | 495 | glEnable (GL_BLEND); |
3372 | 475 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 496 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
3373 | 476 | 497 | ||
3374 | @@ -488,40 +509,43 @@ | |||
3375 | 488 | 509 | ||
3376 | 489 | color = optionGetBoxColor (); | 510 | color = optionGetBoxColor (); |
3377 | 490 | 511 | ||
3400 | 491 | glColor4us (color[0], color[1], color[2], color[3] * tmp); | 512 | GLfloat verticesBorder[] = { |
3401 | 492 | 513 | vc[0] - bw, vc[2] + bh, 0, | |
3402 | 493 | glBegin (GL_QUADS); | 514 | vc[0], vc[2], 0, |
3403 | 494 | glVertex2f (vc[0] - bw, vc[2] + bh); | 515 | vc[1] + bw, vc[2] + bh, 0, |
3404 | 495 | glVertex2f (vc[0] - bw, vc[2]); | 516 | vc[1], vc[2], 0, |
3405 | 496 | glVertex2f (vc[1] + bw, vc[2]); | 517 | vc[1] + bw, vc[3] - bh, 0, |
3406 | 497 | glVertex2f (vc[1] + bw, vc[2] + bh); | 518 | vc[1], vc[3], 0, |
3407 | 498 | glVertex2f (vc[0] - bw, vc[3]); | 519 | vc[0] - bw, vc[3] - bh, 0, |
3408 | 499 | glVertex2f (vc[0] - bw, vc[3] - bh); | 520 | vc[0], vc[3], 0, |
3409 | 500 | glVertex2f (vc[1] + bw, vc[3] - bh); | 521 | vc[0] - bw, vc[2] + bh, 0, |
3410 | 501 | glVertex2f (vc[1] + bw, vc[3]); | 522 | vc[0], vc[2], 0, |
3411 | 502 | glVertex2f (vc[0] - bw, vc[2]); | 523 | }; |
3412 | 503 | glVertex2f (vc[0] - bw, vc[3]); | 524 | |
3413 | 504 | glVertex2f (vc[0], vc[3]); | 525 | vb->begin (GL_TRIANGLE_STRIP); |
3414 | 505 | glVertex2f (vc[0], vc[2]); | 526 | vb->color4f (color[0] / 65535.0, color[1] / 65535.0, |
3415 | 506 | glVertex2f (vc[1], vc[2]); | 527 | color[2] / 65535.0, color[3] * tmp / 65535.0); |
3416 | 507 | glVertex2f (vc[1], vc[3]); | 528 | vb->addVertices (10, verticesBorder); |
3417 | 508 | glVertex2f (vc[1] + bw, vc[3]); | 529 | vb->end (); |
3418 | 509 | glVertex2f (vc[1] + bw, vc[2]); | 530 | |
3419 | 510 | glEnd(); | 531 | vb->render (projection, modelview, attrib); |
3420 | 511 | 532 | ||
3421 | 512 | glColor4usv (defaultColor); | 533 | vb->colorDefault (); |
3422 | 534 | |||
3423 | 535 | /* Restore blending state */ | ||
3424 | 536 | #if USE_GLES | ||
3425 | 537 | if (!isBlendingEnabled) | ||
3426 | 513 | glDisable (GL_BLEND); | 538 | glDisable (GL_BLEND); |
3433 | 514 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | 539 | glBlendFuncSeparate (blendSrcRGB, blendDstRGB, blendSrcAlpha, blendDstAlpha); |
3434 | 515 | 540 | #else | |
3435 | 516 | glPopMatrix(); | 541 | glPopAttrib (); |
3436 | 517 | glMatrixMode (GL_PROJECTION); | 542 | #endif |
3431 | 518 | glPopMatrix (); | ||
3432 | 519 | glMatrixMode (GL_MODELVIEW); | ||
3437 | 520 | } | 543 | } |
3438 | 521 | 544 | ||
3439 | 522 | void | 545 | void |
3440 | 523 | MagScreen::paintImage () | 546 | MagScreen::paintImage () |
3441 | 524 | { | 547 | { |
3442 | 548 | #if 0 | ||
3443 | 525 | float pw, ph; | 549 | float pw, ph; |
3444 | 526 | int x1, x2, y1, y2; | 550 | int x1, x2, y1, y2; |
3445 | 527 | float vc[4]; | 551 | float vc[4]; |
3446 | @@ -680,12 +704,14 @@ | |||
3447 | 680 | glMatrixMode (GL_MODELVIEW); | 704 | glMatrixMode (GL_MODELVIEW); |
3448 | 681 | 705 | ||
3449 | 682 | glPopAttrib (); | 706 | glPopAttrib (); |
3450 | 707 | #endif | ||
3451 | 683 | 708 | ||
3452 | 684 | } | 709 | } |
3453 | 685 | 710 | ||
3454 | 686 | void | 711 | void |
3455 | 687 | MagScreen::paintFisheye () | 712 | MagScreen::paintFisheye () |
3456 | 688 | { | 713 | { |
3457 | 714 | #if 0 | ||
3458 | 689 | float pw, ph; | 715 | float pw, ph; |
3459 | 690 | float radius, fZoom, base; // fZoom is the local zoom variable | 716 | float radius, fZoom, base; // fZoom is the local zoom variable |
3460 | 691 | int x1, x2, y1, y2; | 717 | int x1, x2, y1, y2; |
3461 | @@ -786,6 +812,7 @@ | |||
3462 | 786 | glBindTexture (target, 0); | 812 | glBindTexture (target, 0); |
3463 | 787 | 813 | ||
3464 | 788 | glDisable (target); | 814 | glDisable (target); |
3465 | 815 | #endif | ||
3466 | 789 | } | 816 | } |
3467 | 790 | 817 | ||
3468 | 791 | 818 | ||
3469 | @@ -939,12 +966,14 @@ | |||
3470 | 939 | 966 | ||
3471 | 940 | glGenTextures (1, &texture); | 967 | glGenTextures (1, &texture); |
3472 | 941 | 968 | ||
3473 | 969 | #ifdef USE_GLES | ||
3474 | 970 | target = GL_TEXTURE_2D; | ||
3475 | 971 | #else | ||
3476 | 942 | if (GL::textureNonPowerOfTwo) | 972 | if (GL::textureNonPowerOfTwo) |
3477 | 943 | target = GL_TEXTURE_2D; | 973 | target = GL_TEXTURE_2D; |
3478 | 944 | else | 974 | else |
3479 | 945 | target = GL_TEXTURE_RECTANGLE_ARB; | 975 | target = GL_TEXTURE_RECTANGLE_ARB; |
3482 | 946 | 976 | #endif | |
3481 | 947 | glEnable (target); | ||
3483 | 948 | 977 | ||
3484 | 949 | /* Bind the texture */ | 978 | /* Bind the texture */ |
3485 | 950 | glBindTexture (target, texture); | 979 | glBindTexture (target, texture); |
3486 | @@ -952,8 +981,8 @@ | |||
3487 | 952 | /* Load the parameters */ | 981 | /* Load the parameters */ |
3488 | 953 | glTexParameteri (target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 982 | glTexParameteri (target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
3489 | 954 | glTexParameteri (target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 983 | glTexParameteri (target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
3492 | 955 | glTexParameteri (target, GL_TEXTURE_WRAP_S, GL_CLAMP); | 984 | glTexParameteri (target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
3493 | 956 | glTexParameteri (target, GL_TEXTURE_WRAP_T, GL_CLAMP); | 985 | glTexParameteri (target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
3494 | 957 | 986 | ||
3495 | 958 | glTexImage2D (target, 0, GL_RGB, 0, 0, 0, | 987 | glTexImage2D (target, 0, GL_RGB, 0, 0, 0, |
3496 | 959 | GL_RGB, GL_UNSIGNED_BYTE, NULL); | 988 | GL_RGB, GL_UNSIGNED_BYTE, NULL); |
3497 | @@ -963,8 +992,6 @@ | |||
3498 | 963 | 992 | ||
3499 | 964 | glBindTexture (target, 0); | 993 | glBindTexture (target, 0); |
3500 | 965 | 994 | ||
3501 | 966 | glDisable (target); | ||
3502 | 967 | |||
3503 | 968 | #define optionNotify(name) \ | 995 | #define optionNotify(name) \ |
3504 | 969 | optionSet##name##Notify (boost::bind (&MagScreen::optionChanged, \ | 996 | optionSet##name##Notify (boost::bind (&MagScreen::optionChanged, \ |
3505 | 970 | this, _1, _2)) | 997 | this, _1, _2)) |
3506 | @@ -1004,10 +1031,12 @@ | |||
3507 | 1004 | mode = MagOptions::ModeSimple; | 1031 | mode = MagOptions::ModeSimple; |
3508 | 1005 | } | 1032 | } |
3509 | 1006 | 1033 | ||
3510 | 1034 | #if 0 | ||
3511 | 1007 | if (!GL::fragmentProgram) | 1035 | if (!GL::fragmentProgram) |
3512 | 1008 | compLogMessage ("mag", CompLogLevelWarn, | 1036 | compLogMessage ("mag", CompLogLevelWarn, |
3513 | 1009 | "GL_ARB_fragment_program not supported. " | 1037 | "GL_ARB_fragment_program not supported. " |
3514 | 1010 | "Fisheye mode will not work."); | 1038 | "Fisheye mode will not work."); |
3515 | 1039 | #endif | ||
3516 | 1011 | } | 1040 | } |
3517 | 1012 | 1041 | ||
3518 | 1013 | MagScreen::~MagScreen () | 1042 | MagScreen::~MagScreen () |
3519 | 1014 | 1043 | ||
3520 | === modified file 'plugins/mag/src/mag.h' | |||
3521 | --- plugins/mag/src/mag.h 2012-05-27 04:32:55 +0000 | |||
3522 | +++ plugins/mag/src/mag.h 2012-08-22 06:16:22 +0000 | |||
3523 | @@ -161,6 +161,7 @@ | |||
3524 | 161 | bool init (); | 161 | bool init (); |
3525 | 162 | }; | 162 | }; |
3526 | 163 | 163 | ||
3527 | 164 | #if 0 | ||
3528 | 164 | static const char *fisheyeFpString = | 165 | static const char *fisheyeFpString = |
3529 | 165 | "!!ARBfp1.0" | 166 | "!!ARBfp1.0" |
3530 | 166 | 167 | ||
3531 | @@ -190,3 +191,4 @@ | |||
3532 | 190 | "TEX result.color, t1, texture[0], %s;" | 191 | "TEX result.color, t1, texture[0], %s;" |
3533 | 191 | 192 | ||
3534 | 192 | "END"; | 193 | "END"; |
3535 | 194 | #endif | ||
3536 | 193 | 195 | ||
3537 | === modified file 'plugins/neg/src/neg.cpp' | |||
3538 | --- plugins/neg/src/neg.cpp 2011-05-18 01:06:37 +0000 | |||
3539 | +++ plugins/neg/src/neg.cpp 2012-08-22 06:16:22 +0000 | |||
3540 | @@ -22,7 +22,12 @@ | |||
3541 | 22 | 22 | ||
3542 | 23 | #include "neg.h" | 23 | #include "neg.h" |
3543 | 24 | 24 | ||
3545 | 25 | using namespace GLFragment; | 25 | static std::string fragment_function = " \n\ |
3546 | 26 | void neg_fragment () { \n\ | ||
3547 | 27 | vec3 color = vec3(1.0, 1.0, 1.0) - gl_FragColor.rgb; \n\ | ||
3548 | 28 | gl_FragColor = vec4(color, gl_FragColor.a); \n\ | ||
3549 | 29 | } \n\ | ||
3550 | 30 | "; | ||
3551 | 26 | 31 | ||
3552 | 27 | COMPIZ_PLUGIN_20090315 (neg, NegPluginVTable); | 32 | COMPIZ_PLUGIN_20090315 (neg, NegPluginVTable); |
3553 | 28 | 33 | ||
3554 | @@ -74,65 +79,12 @@ | |||
3555 | 74 | return true; | 79 | return true; |
3556 | 75 | } | 80 | } |
3557 | 76 | 81 | ||
3558 | 77 | int | ||
3559 | 78 | NegScreen::getFragmentFunction (GLTexture *texture, | ||
3560 | 79 | bool alpha) | ||
3561 | 80 | { | ||
3562 | 81 | int handle = 0; | ||
3563 | 82 | |||
3564 | 83 | if (alpha && negAlphaFunction) | ||
3565 | 84 | handle = negAlphaFunction; | ||
3566 | 85 | else if (!alpha && negFunction) | ||
3567 | 86 | handle = negFunction; | ||
3568 | 87 | |||
3569 | 88 | if (!handle) | ||
3570 | 89 | { | ||
3571 | 90 | FunctionData data; | ||
3572 | 91 | int target; | ||
3573 | 92 | |||
3574 | 93 | if (alpha) | ||
3575 | 94 | data.addTempHeaderOp ("neg"); | ||
3576 | 95 | |||
3577 | 96 | if (texture->target () == GL_TEXTURE_2D) | ||
3578 | 97 | target = COMP_FETCH_TARGET_2D; | ||
3579 | 98 | else | ||
3580 | 99 | target = COMP_FETCH_TARGET_RECT; | ||
3581 | 100 | |||
3582 | 101 | data.addFetchOp ("output", NULL, target); | ||
3583 | 102 | |||
3584 | 103 | if (alpha) | ||
3585 | 104 | { | ||
3586 | 105 | data.addDataOp ("RCP neg.a, output.a;"); | ||
3587 | 106 | data.addDataOp ("MAD output.rgb, -neg.a, output, 1.0;"); | ||
3588 | 107 | } | ||
3589 | 108 | else | ||
3590 | 109 | data.addDataOp ("SUB output.rgb, 1.0, output;"); | ||
3591 | 110 | |||
3592 | 111 | if (alpha) | ||
3593 | 112 | data.addDataOp ("MUL output.rgb, output.a, output;"); | ||
3594 | 113 | |||
3595 | 114 | data.addColorOp ("output", "output"); | ||
3596 | 115 | |||
3597 | 116 | if (!data.status ()) | ||
3598 | 117 | return 0; | ||
3599 | 118 | |||
3600 | 119 | handle = data.createFragmentFunction ("neg"); | ||
3601 | 120 | |||
3602 | 121 | if (alpha) | ||
3603 | 122 | negAlphaFunction = handle; | ||
3604 | 123 | else | ||
3605 | 124 | negFunction = handle; | ||
3606 | 125 | } | ||
3607 | 126 | |||
3608 | 127 | return handle; | ||
3609 | 128 | } | ||
3610 | 129 | |||
3611 | 130 | void | 82 | void |
3612 | 131 | NegWindow::glDrawTexture (GLTexture *texture, | 83 | NegWindow::glDrawTexture (GLTexture *texture, |
3614 | 132 | GLFragment::Attrib &attrib, | 84 | const GLMatrix &transform, |
3615 | 85 | const GLWindowPaintAttrib &attrib, | ||
3616 | 133 | unsigned int mask) | 86 | unsigned int mask) |
3617 | 134 | { | 87 | { |
3618 | 135 | GLTexture::Filter filter; | ||
3619 | 136 | bool doNeg = false; | 88 | bool doNeg = false; |
3620 | 137 | GLTexture *tex = NULL; | 89 | GLTexture *tex = NULL; |
3621 | 138 | 90 | ||
3622 | @@ -160,24 +112,16 @@ | |||
3623 | 160 | 112 | ||
3624 | 161 | if (doNeg && tex) | 113 | if (doNeg && tex) |
3625 | 162 | { | 114 | { |
3628 | 163 | /* Fragment program negation */ | 115 | /* shader program negation */ |
3629 | 164 | if (GL::fragmentProgram) | 116 | if (true) |
3630 | 165 | { | 117 | { |
3643 | 166 | GLFragment::Attrib fa = attrib; | 118 | gWindow->addShaders ("neg", "", fragment_function); |
3644 | 167 | int function; | 119 | gWindow->glDrawTexture (texture, transform, attrib, mask); |
3633 | 168 | bool alpha = true; | ||
3634 | 169 | |||
3635 | 170 | if (texture->name () == tex->name ()) /* Not a decoration */ | ||
3636 | 171 | alpha = window->alpha (); | ||
3637 | 172 | |||
3638 | 173 | function = ns->getFragmentFunction (texture, alpha); | ||
3639 | 174 | if (function) | ||
3640 | 175 | fa.addFunction (function); | ||
3641 | 176 | |||
3642 | 177 | gWindow->glDrawTexture (texture, fa, mask); | ||
3645 | 178 | } | 120 | } |
3646 | 179 | else /* Texture manipulation negation */ | 121 | else /* Texture manipulation negation */ |
3647 | 180 | { | 122 | { |
3648 | 123 | #ifndef USE_GLES | ||
3649 | 124 | GLTexture::Filter filter; | ||
3650 | 181 | /* this is for the most part taken from paint.c */ | 125 | /* this is for the most part taken from paint.c */ |
3651 | 182 | 126 | ||
3652 | 183 | if (mask & PAINT_WINDOW_TRANSFORMED_MASK) | 127 | if (mask & PAINT_WINDOW_TRANSFORMED_MASK) |
3653 | @@ -188,14 +132,10 @@ | |||
3654 | 188 | filter = ns->gScreen->filter (NOTHING_TRANS_FILTER); | 132 | filter = ns->gScreen->filter (NOTHING_TRANS_FILTER); |
3655 | 189 | 133 | ||
3656 | 190 | /* if we can adjust saturation, even if it's just on and off */ | 134 | /* if we can adjust saturation, even if it's just on and off */ |
3658 | 191 | if (GL::canDoSaturated && attrib.getSaturation () != COLOR) | 135 | if (GL::canDoSaturated && attrib.saturation != COLOR) |
3659 | 192 | { | 136 | { |
3660 | 193 | GLfloat constant[4]; | 137 | GLfloat constant[4]; |
3661 | 194 | 138 | ||
3662 | 195 | /* if the paint mask has this set we want to blend */ | ||
3663 | 196 | if (mask & PAINT_WINDOW_TRANSLUCENT_MASK) | ||
3664 | 197 | glEnable (GL_BLEND); | ||
3665 | 198 | |||
3666 | 199 | /* enable the texture */ | 139 | /* enable the texture */ |
3667 | 200 | texture->enable (filter); | 140 | texture->enable (filter); |
3668 | 201 | 141 | ||
3669 | @@ -233,7 +173,7 @@ | |||
3670 | 233 | glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); | 173 | glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); |
3671 | 234 | 174 | ||
3672 | 235 | /* if we can do saturation that is in between min and max */ | 175 | /* if we can do saturation that is in between min and max */ |
3674 | 236 | if (GL::canDoSlightlySaturated && attrib.getSaturation () > 0) | 176 | if (GL::canDoSlightlySaturated && attrib.saturation > 0) |
3675 | 237 | { | 177 | { |
3676 | 238 | glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE); | 178 | glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE); |
3677 | 239 | glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PREVIOUS); | 179 | glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PREVIOUS); |
3678 | @@ -270,13 +210,13 @@ | |||
3679 | 270 | glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); | 210 | glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); |
3680 | 271 | 211 | ||
3681 | 272 | /* color constant */ | 212 | /* color constant */ |
3683 | 273 | constant[3] = attrib.getSaturation () / 65535.0f; | 213 | constant[3] = attrib.saturation / 65535.0f; |
3684 | 274 | 214 | ||
3685 | 275 | glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant); | 215 | glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant); |
3686 | 276 | 216 | ||
3687 | 277 | /* if we are not opaque or not fully bright */ | 217 | /* if we are not opaque or not fully bright */ |
3690 | 278 | if (attrib.getOpacity () < OPAQUE || | 218 | if (attrib.opacity < OPAQUE || |
3691 | 279 | attrib.getBrightness () != BRIGHT) | 219 | attrib.brightness != BRIGHT) |
3692 | 280 | { | 220 | { |
3693 | 281 | /* make another texture active */ | 221 | /* make another texture active */ |
3694 | 282 | GL::activeTexture (GL_TEXTURE3_ARB); | 222 | GL::activeTexture (GL_TEXTURE3_ARB); |
3695 | @@ -285,9 +225,9 @@ | |||
3696 | 285 | texture->enable (filter); | 225 | texture->enable (filter); |
3697 | 286 | 226 | ||
3698 | 287 | /* color constant */ | 227 | /* color constant */ |
3700 | 288 | constant[3] = attrib.getOpacity () / 65535.0f; | 228 | constant[3] = attrib.opacity / 65535.0f; |
3701 | 289 | constant[0] = constant[1] = constant[2] = | 229 | constant[0] = constant[1] = constant[2] = |
3703 | 290 | constant[3] * attrib.getBrightness () / 65535.0f; | 230 | constant[3] * attrib.brightness / 65535.0f; |
3704 | 291 | 231 | ||
3705 | 292 | glTexEnvfv(GL_TEXTURE_ENV, | 232 | glTexEnvfv(GL_TEXTURE_ENV, |
3706 | 293 | GL_TEXTURE_ENV_COLOR, constant); | 233 | GL_TEXTURE_ENV_COLOR, constant); |
3707 | @@ -314,8 +254,7 @@ | |||
3708 | 314 | glTexEnvf(GL_TEXTURE_ENV, | 254 | glTexEnvf(GL_TEXTURE_ENV, |
3709 | 315 | GL_OPERAND1_ALPHA, GL_SRC_ALPHA); | 255 | GL_OPERAND1_ALPHA, GL_SRC_ALPHA); |
3710 | 316 | 256 | ||
3713 | 317 | /* draw the window geometry */ | 257 | gWindow->glDrawTexture (texture, transform, attrib, mask); |
3712 | 318 | gWindow->glDrawGeometry (); | ||
3714 | 319 | 258 | ||
3715 | 320 | /* disable the current texture */ | 259 | /* disable the current texture */ |
3716 | 321 | texture->disable (); | 260 | texture->disable (); |
3717 | @@ -331,8 +270,7 @@ | |||
3718 | 331 | { | 270 | { |
3719 | 332 | /* fully opaque and bright */ | 271 | /* fully opaque and bright */ |
3720 | 333 | 272 | ||
3723 | 334 | /* draw the window geometry */ | 273 | gWindow->glDrawTexture (texture, transform, attrib, mask); |
3722 | 335 | gWindow->glDrawGeometry (); | ||
3724 | 336 | } | 274 | } |
3725 | 337 | 275 | ||
3726 | 338 | /* disable the current texture */ | 276 | /* disable the current texture */ |
3727 | @@ -355,9 +293,9 @@ | |||
3728 | 355 | glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA); | 293 | glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA); |
3729 | 356 | 294 | ||
3730 | 357 | /* color constant */ | 295 | /* color constant */ |
3732 | 358 | constant[3] = attrib.getOpacity () / 65535.0f; | 296 | constant[3] = attrib.opacity / 65535.0f; |
3733 | 359 | constant[0] = constant[1] = constant[2] = | 297 | constant[0] = constant[1] = constant[2] = |
3735 | 360 | constant[3] * attrib.getBrightness () / 65535.0f; | 298 | constant[3] * attrib.brightness / 65535.0f; |
3736 | 361 | 299 | ||
3737 | 362 | constant[0] = | 300 | constant[0] = |
3738 | 363 | 0.5f + 0.5f * RED_SATURATION_WEIGHT * constant[0]; | 301 | 0.5f + 0.5f * RED_SATURATION_WEIGHT * constant[0]; |
3739 | @@ -368,8 +306,7 @@ | |||
3740 | 368 | 306 | ||
3741 | 369 | glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant); | 307 | glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant); |
3742 | 370 | 308 | ||
3745 | 371 | /* draw the window geometry */ | 309 | gWindow->glDrawTexture (texture, transform, attrib, mask); |
3744 | 372 | gWindow->glDrawGeometry (); | ||
3746 | 373 | } | 310 | } |
3747 | 374 | 311 | ||
3748 | 375 | /* disable the current texture */ | 312 | /* disable the current texture */ |
3749 | @@ -390,9 +327,6 @@ | |||
3750 | 390 | /* set screens texture mode back to replace */ | 327 | /* set screens texture mode back to replace */ |
3751 | 391 | ns->gScreen->setTexEnvMode (GL_REPLACE); | 328 | ns->gScreen->setTexEnvMode (GL_REPLACE); |
3752 | 392 | 329 | ||
3753 | 393 | /* if it's a translucent window, disable blending */ | ||
3754 | 394 | if (mask & PAINT_WINDOW_TRANSLUCENT_MASK) | ||
3755 | 395 | glDisable (GL_BLEND); | ||
3756 | 396 | } | 330 | } |
3757 | 397 | else | 331 | else |
3758 | 398 | { | 332 | { |
3759 | @@ -411,17 +345,14 @@ | |||
3760 | 411 | 345 | ||
3761 | 412 | /* we are not opaque or fully bright */ | 346 | /* we are not opaque or fully bright */ |
3762 | 413 | if ((mask & PAINT_WINDOW_TRANSLUCENT_MASK) || | 347 | if ((mask & PAINT_WINDOW_TRANSLUCENT_MASK) || |
3764 | 414 | attrib.getBrightness () != BRIGHT) | 348 | attrib.brightness != BRIGHT) |
3765 | 415 | { | 349 | { |
3766 | 416 | GLfloat constant[4]; | 350 | GLfloat constant[4]; |
3767 | 417 | 351 | ||
3768 | 418 | /* enable blending */ | ||
3769 | 419 | glEnable (GL_BLEND); | ||
3770 | 420 | |||
3771 | 421 | /* color constant */ | 352 | /* color constant */ |
3773 | 422 | constant[3] = attrib.getOpacity () / 65535.0f; | 353 | constant[3] = attrib.opacity / 65535.0f; |
3774 | 423 | constant[0] = constant[1] = constant[2] = | 354 | constant[0] = constant[1] = constant[2] = |
3776 | 424 | constant[3] * attrib.getBrightness () / 65535.0f; | 355 | constant[3] * attrib.brightness / 65535.0f; |
3777 | 425 | 356 | ||
3778 | 426 | glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant); | 357 | glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant); |
3779 | 427 | glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); | 358 | glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); |
3780 | @@ -441,18 +372,13 @@ | |||
3781 | 441 | glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); | 372 | glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); |
3782 | 442 | glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA); | 373 | glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA); |
3783 | 443 | 374 | ||
3789 | 444 | /* draw the window geometry */ | 375 | gWindow->glDrawTexture (texture, transform, attrib, mask); |
3785 | 445 | gWindow->glDrawGeometry (); | ||
3786 | 446 | |||
3787 | 447 | /* disable blending */ | ||
3788 | 448 | glDisable (GL_BLEND); | ||
3790 | 449 | } | 376 | } |
3791 | 450 | else | 377 | else |
3792 | 451 | { | 378 | { |
3793 | 452 | /* no adjustments to saturation, brightness or opacity */ | 379 | /* no adjustments to saturation, brightness or opacity */ |
3794 | 453 | 380 | ||
3797 | 454 | /* draw the window geometry */ | 381 | gWindow->glDrawTexture (texture, transform, attrib, mask); |
3796 | 455 | gWindow->glDrawGeometry (); | ||
3798 | 456 | } | 382 | } |
3799 | 457 | 383 | ||
3800 | 458 | /* disable the current texture */ | 384 | /* disable the current texture */ |
3801 | @@ -461,12 +387,13 @@ | |||
3802 | 461 | /* set the screens texture mode back to replace */ | 387 | /* set the screens texture mode back to replace */ |
3803 | 462 | ns->gScreen->setTexEnvMode (GL_REPLACE); | 388 | ns->gScreen->setTexEnvMode (GL_REPLACE); |
3804 | 463 | } | 389 | } |
3805 | 390 | #endif | ||
3806 | 464 | } | 391 | } |
3807 | 465 | } | 392 | } |
3808 | 466 | else | 393 | else |
3809 | 467 | { | 394 | { |
3810 | 468 | /* not negative */ | 395 | /* not negative */ |
3812 | 469 | gWindow->glDrawTexture (texture, attrib, mask); | 396 | gWindow->glDrawTexture (texture, transform, attrib, mask); |
3813 | 470 | } | 397 | } |
3814 | 471 | } | 398 | } |
3815 | 472 | 399 | ||
3816 | 473 | 400 | ||
3817 | === modified file 'plugins/neg/src/neg.h' | |||
3818 | --- plugins/neg/src/neg.h 2011-05-27 08:32:06 +0000 | |||
3819 | +++ plugins/neg/src/neg.h 2012-08-22 06:16:22 +0000 | |||
3820 | @@ -57,10 +57,6 @@ | |||
3821 | 57 | CompOption::Vector opt, | 57 | CompOption::Vector opt, |
3822 | 58 | bool all); | 58 | bool all); |
3823 | 59 | 59 | ||
3824 | 60 | int | ||
3825 | 61 | getFragmentFunction (GLTexture *texture, | ||
3826 | 62 | bool alpha); | ||
3827 | 63 | |||
3828 | 64 | GLScreen *gScreen; | 60 | GLScreen *gScreen; |
3829 | 65 | }; | 61 | }; |
3830 | 66 | 62 | ||
3831 | @@ -89,8 +85,9 @@ | |||
3832 | 89 | bool isNeg; | 85 | bool isNeg; |
3833 | 90 | 86 | ||
3834 | 91 | void | 87 | void |
3837 | 92 | glDrawTexture(GLTexture *texture, | 88 | glDrawTexture (GLTexture *texture, |
3838 | 93 | GLFragment::Attrib &attrib, | 89 | const GLMatrix &transform, |
3839 | 90 | const GLWindowPaintAttrib &attrib, | ||
3840 | 94 | unsigned int mask); | 91 | unsigned int mask); |
3841 | 95 | 92 | ||
3842 | 96 | void toggle (); | 93 | void toggle (); |
3843 | 97 | 94 | ||
3844 | === modified file 'plugins/obs/src/obs.cpp' | |||
3845 | --- plugins/obs/src/obs.cpp 2010-07-02 02:49:24 +0000 | |||
3846 | +++ plugins/obs/src/obs.cpp 2012-08-22 06:16:22 +0000 | |||
3847 | @@ -151,29 +151,30 @@ | |||
3848 | 151 | we wrap into glDrawWindow here */ | 151 | we wrap into glDrawWindow here */ |
3849 | 152 | 152 | ||
3850 | 153 | bool | 153 | bool |
3854 | 154 | ObsWindow::glDraw (const GLMatrix& transform, | 154 | ObsWindow::glDraw (const GLMatrix &transform, |
3855 | 155 | GLFragment::Attrib& attrib, | 155 | const GLWindowPaintAttrib &attrib, |
3856 | 156 | const CompRegion& region, | 156 | const CompRegion ®ion, |
3857 | 157 | unsigned int mask) | 157 | unsigned int mask) |
3858 | 158 | { | 158 | { |
3859 | 159 | GLWindowPaintAttrib wAttrib (attrib); | ||
3860 | 159 | int factor; | 160 | int factor; |
3861 | 160 | 161 | ||
3862 | 161 | factor = customFactor[MODIFIER_OPACITY]; | 162 | factor = customFactor[MODIFIER_OPACITY]; |
3863 | 162 | if (factor != 100) | 163 | if (factor != 100) |
3864 | 163 | { | 164 | { |
3866 | 164 | attrib.setOpacity (factor * attrib.getOpacity () / 100); | 165 | wAttrib.opacity = factor * wAttrib.opacity / 100; |
3867 | 165 | mask |= PAINT_WINDOW_TRANSLUCENT_MASK; | 166 | mask |= PAINT_WINDOW_TRANSLUCENT_MASK; |
3868 | 166 | } | 167 | } |
3869 | 167 | 168 | ||
3870 | 168 | factor = customFactor[MODIFIER_BRIGHTNESS]; | 169 | factor = customFactor[MODIFIER_BRIGHTNESS]; |
3871 | 169 | if (factor != 100) | 170 | if (factor != 100) |
3873 | 170 | attrib.setBrightness (factor * attrib.getBrightness () / 100); | 171 | wAttrib.brightness = factor * wAttrib.brightness / 100; |
3874 | 171 | 172 | ||
3875 | 172 | factor = customFactor[MODIFIER_SATURATION]; | 173 | factor = customFactor[MODIFIER_SATURATION]; |
3876 | 173 | if (factor != 100) | 174 | if (factor != 100) |
3878 | 174 | attrib.setSaturation (factor * attrib.getSaturation () / 100); | 175 | wAttrib.saturation = factor * wAttrib.saturation / 100; |
3879 | 175 | 176 | ||
3881 | 176 | return gWindow->glDraw (transform, attrib, region, mask); | 177 | return gWindow->glDraw (transform, wAttrib, region, mask); |
3882 | 177 | } | 178 | } |
3883 | 178 | 179 | ||
3884 | 179 | void | 180 | void |
3885 | 180 | 181 | ||
3886 | === modified file 'plugins/obs/src/obs.h' | |||
3887 | --- plugins/obs/src/obs.h 2012-01-18 16:26:45 +0000 | |||
3888 | +++ plugins/obs/src/obs.h 2012-08-22 06:16:22 +0000 | |||
3889 | @@ -66,7 +66,7 @@ | |||
3890 | 66 | 66 | ||
3891 | 67 | bool glPaint (const GLWindowPaintAttrib &, const GLMatrix &, | 67 | bool glPaint (const GLWindowPaintAttrib &, const GLMatrix &, |
3892 | 68 | const CompRegion &, unsigned int); | 68 | const CompRegion &, unsigned int); |
3894 | 69 | bool glDraw (const GLMatrix &, GLFragment::Attrib &, | 69 | bool glDraw (const GLMatrix &, const GLWindowPaintAttrib &, |
3895 | 70 | const CompRegion &, unsigned int); | 70 | const CompRegion &, unsigned int); |
3896 | 71 | 71 | ||
3897 | 72 | void changePaintModifier (unsigned int, int); | 72 | void changePaintModifier (unsigned int, int); |
3898 | 73 | 73 | ||
3899 | === modified file 'plugins/opengl/CMakeLists.txt' | |||
3900 | --- plugins/opengl/CMakeLists.txt 2009-03-15 05:09:18 +0000 | |||
3901 | +++ plugins/opengl/CMakeLists.txt 2012-08-22 06:16:22 +0000 | |||
3902 | @@ -2,7 +2,17 @@ | |||
3903 | 2 | 2 | ||
3904 | 3 | include (CompizPlugin) | 3 | include (CompizPlugin) |
3905 | 4 | 4 | ||
3906 | 5 | find_package (OpenGL) | ||
3907 | 6 | if (OPENGL_FOUND) | ||
3908 | 7 | compiz_plugin(opengl PLUGINDEPS composite LIBRARIES ${OPENGL_gl_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR}) | ||
3909 | 8 | endif () | ||
3910 | 9 | \ No newline at end of file | 5 | \ No newline at end of file |
3911 | 6 | set (INTERNAL_LIBRARIES | ||
3912 | 7 | compiz_opengl_double_buffer) | ||
3913 | 8 | |||
3914 | 9 | add_subdirectory (src/doublebuffer) | ||
3915 | 10 | |||
3916 | 11 | if (USE_GLES) | ||
3917 | 12 | compiz_plugin(opengl PLUGINDEPS composite CFLAGSADD "-DUSE_GLES -std=c++0x" LIBRARIES ${OPENGLES2_LIBRARIES} ${INTERNAL_LIBRARIES} INCDIRS ${OPENGLES2_INCLUDE_DIR}) | ||
3918 | 13 | else (USE_GLES) | ||
3919 | 14 | find_package (OpenGL) | ||
3920 | 15 | if (OPENGL_FOUND) | ||
3921 | 16 | compiz_plugin(opengl PLUGINDEPS composite CFLAGSADD -std=c++0x LIBRARIES ${OPENGL_gl_LIBRARY} ${INTERNAL_LIBRARIES} INCDIRS ${OPENGL_INCLUDE_DIR}) | ||
3922 | 17 | endif (OPENGL_FOUND) | ||
3923 | 18 | endif (USE_GLES) | ||
3924 | 19 | |||
3925 | 10 | 20 | ||
3926 | === modified file 'plugins/opengl/compiz-opengl.pc.in' | |||
3927 | --- plugins/opengl/compiz-opengl.pc.in 2009-03-15 05:09:18 +0000 | |||
3928 | +++ plugins/opengl/compiz-opengl.pc.in 2012-08-22 06:16:22 +0000 | |||
3929 | @@ -8,5 +8,5 @@ | |||
3930 | 8 | Version: @VERSION@ | 8 | Version: @VERSION@ |
3931 | 9 | 9 | ||
3932 | 10 | Requires: compiz compiz-composite | 10 | Requires: compiz compiz-composite |
3934 | 11 | Libs: -lGL -L${libdir} -lopengl | 11 | Libs: @PKGCONFIG_LIBS@ -L${libdir} -lopengl |
3935 | 12 | Cflags: @COMPIZ_CFLAGS@ -I${includedir}/compiz | 12 | Cflags: @COMPIZ_CFLAGS@ -I${includedir}/compiz |
3936 | 13 | \ No newline at end of file | 13 | \ No newline at end of file |
3937 | 14 | 14 | ||
3938 | === added file 'plugins/opengl/include/opengl/doublebuffer.h' | |||
3939 | --- plugins/opengl/include/opengl/doublebuffer.h 1970-01-01 00:00:00 +0000 | |||
3940 | +++ plugins/opengl/include/opengl/doublebuffer.h 2012-08-22 06:16:22 +0000 | |||
3941 | @@ -0,0 +1,39 @@ | |||
3942 | 1 | #ifndef _COMPIZ_OPENGL_BUFFERBLIT_H | ||
3943 | 2 | #define _COMPIZ_OPENGL_BUFFERBLIT_H | ||
3944 | 3 | |||
3945 | 4 | #include <core/region.h> | ||
3946 | 5 | |||
3947 | 6 | namespace compiz | ||
3948 | 7 | { | ||
3949 | 8 | namespace opengl | ||
3950 | 9 | { | ||
3951 | 10 | |||
3952 | 11 | class DoubleBuffer | ||
3953 | 12 | { | ||
3954 | 13 | public: | ||
3955 | 14 | DoubleBuffer (); | ||
3956 | 15 | virtual ~DoubleBuffer (); | ||
3957 | 16 | |||
3958 | 17 | virtual void swap () const = 0; | ||
3959 | 18 | virtual bool blitAvailable () const = 0; | ||
3960 | 19 | virtual void blit (const CompRegion ®ion) const = 0; | ||
3961 | 20 | virtual bool fallbackBlitAvailable () const = 0; | ||
3962 | 21 | virtual void fallbackBlit (const CompRegion ®ion) const = 0; | ||
3963 | 22 | |||
3964 | 23 | typedef enum | ||
3965 | 24 | { | ||
3966 | 25 | VSYNC, | ||
3967 | 26 | PERSISTENT_BACK_BUFFER, | ||
3968 | 27 | _NSETTINGS | ||
3969 | 28 | } Setting; | ||
3970 | 29 | |||
3971 | 30 | void set (Setting name, bool value); | ||
3972 | 31 | void render (const CompRegion ®ion, bool fullscreen); | ||
3973 | 32 | |||
3974 | 33 | protected: | ||
3975 | 34 | bool setting[_NSETTINGS]; | ||
3976 | 35 | }; | ||
3977 | 36 | |||
3978 | 37 | } | ||
3979 | 38 | } | ||
3980 | 39 | #endif | ||
3981 | 0 | 40 | ||
3982 | === removed file 'plugins/opengl/include/opengl/fragment.h' | |||
3983 | --- plugins/opengl/include/opengl/fragment.h 2012-01-18 16:26:45 +0000 | |||
3984 | +++ plugins/opengl/include/opengl/fragment.h 1970-01-01 00:00:00 +0000 | |||
3985 | @@ -1,125 +0,0 @@ | |||
3986 | 1 | /* | ||
3987 | 2 | * Copyright © 2008 Dennis Kasprzyk | ||
3988 | 3 | * Copyright © 2007 Novell, Inc. | ||
3989 | 4 | * | ||
3990 | 5 | * Permission to use, copy, modify, distribute, and sell this software | ||
3991 | 6 | * and its documentation for any purpose is hereby granted without | ||
3992 | 7 | * fee, provided that the above copyright notice appear in all copies | ||
3993 | 8 | * and that both that copyright notice and this permission notice | ||
3994 | 9 | * appear in supporting documentation, and that the name of | ||
3995 | 10 | * Dennis Kasprzyk not be used in advertising or publicity pertaining to | ||
3996 | 11 | * distribution of the software without specific, written prior permission. | ||
3997 | 12 | * Dennis Kasprzyk makes no representations about the suitability of this | ||
3998 | 13 | * software for any purpose. It is provided "as is" without express or | ||
3999 | 14 | * implied warranty. | ||
4000 | 15 | * | ||
4001 | 16 | * DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
4002 | 17 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN | ||
4003 | 18 | * NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
4004 | 19 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS | ||
4005 | 20 | * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | ||
4006 | 21 | * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | ||
4007 | 22 | * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
4008 | 23 | * | ||
4009 | 24 | * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org> | ||
4010 | 25 | * David Reveman <davidr@novell.com> | ||
4011 | 26 | */ | ||
4012 | 27 | |||
4013 | 28 | #ifndef _GLFRAGMENT_H | ||
4014 | 29 | #define _GLFRAGMENT_H | ||
4015 | 30 | |||
4016 | 31 | #define MAX_FRAGMENT_FUNCTIONS 16 | ||
4017 | 32 | |||
4018 | 33 | #define COMP_FETCH_TARGET_2D 0 | ||
4019 | 34 | #define COMP_FETCH_TARGET_RECT 1 | ||
4020 | 35 | #define COMP_FETCH_TARGET_NUM 2 | ||
4021 | 36 | |||
4022 | 37 | struct GLWindowPaintAttrib; | ||
4023 | 38 | class GLScreen; | ||
4024 | 39 | class GLTexture; | ||
4025 | 40 | |||
4026 | 41 | /** | ||
4027 | 42 | * Describes a texture modification fragment program | ||
4028 | 43 | * for a texture | ||
4029 | 44 | */ | ||
4030 | 45 | namespace GLFragment { | ||
4031 | 46 | |||
4032 | 47 | class Storage; | ||
4033 | 48 | |||
4034 | 49 | typedef unsigned int FunctionId; | ||
4035 | 50 | |||
4036 | 51 | class PrivateFunctionData; | ||
4037 | 52 | class PrivateAttrib; | ||
4038 | 53 | |||
4039 | 54 | class FunctionData { | ||
4040 | 55 | public: | ||
4041 | 56 | FunctionData (); | ||
4042 | 57 | ~FunctionData (); | ||
4043 | 58 | |||
4044 | 59 | /** | ||
4045 | 60 | * Returns the status of this fragment program | ||
4046 | 61 | * (valid or invalid) | ||
4047 | 62 | */ | ||
4048 | 63 | bool status (); | ||
4049 | 64 | |||
4050 | 65 | void addTempHeaderOp (const char *name); | ||
4051 | 66 | |||
4052 | 67 | void addParamHeaderOp (const char *name); | ||
4053 | 68 | |||
4054 | 69 | void addAttribHeaderOp (const char *name); | ||
4055 | 70 | |||
4056 | 71 | |||
4057 | 72 | void addFetchOp (const char *dst, const char *offset, int target); | ||
4058 | 73 | |||
4059 | 74 | void addColorOp (const char *dst, const char *src); | ||
4060 | 75 | |||
4061 | 76 | void addDataOp (const char *str, ...); | ||
4062 | 77 | |||
4063 | 78 | void addBlendOp (const char *str, ...); | ||
4064 | 79 | |||
4065 | 80 | FunctionId createFragmentFunction (const char *name); | ||
4066 | 81 | |||
4067 | 82 | private: | ||
4068 | 83 | PrivateFunctionData *priv; | ||
4069 | 84 | }; | ||
4070 | 85 | |||
4071 | 86 | class Attrib { | ||
4072 | 87 | public: | ||
4073 | 88 | Attrib (const GLWindowPaintAttrib &paint); | ||
4074 | 89 | Attrib (const Attrib&); | ||
4075 | 90 | ~Attrib (); | ||
4076 | 91 | |||
4077 | 92 | Attrib &operator= (const Attrib &rhs); | ||
4078 | 93 | |||
4079 | 94 | unsigned int allocTextureUnits (unsigned int nTexture); | ||
4080 | 95 | |||
4081 | 96 | unsigned int allocParameters (unsigned int nParam); | ||
4082 | 97 | |||
4083 | 98 | void addFunction (FunctionId function); | ||
4084 | 99 | |||
4085 | 100 | bool enable (bool *blending); | ||
4086 | 101 | void disable (); | ||
4087 | 102 | |||
4088 | 103 | unsigned short getSaturation (); | ||
4089 | 104 | unsigned short getBrightness (); | ||
4090 | 105 | unsigned short getOpacity (); | ||
4091 | 106 | |||
4092 | 107 | void setSaturation (unsigned short); | ||
4093 | 108 | void setBrightness (unsigned short); | ||
4094 | 109 | void setOpacity (unsigned short); | ||
4095 | 110 | |||
4096 | 111 | bool hasFunctions (); | ||
4097 | 112 | |||
4098 | 113 | private: | ||
4099 | 114 | PrivateAttrib *priv; | ||
4100 | 115 | }; | ||
4101 | 116 | |||
4102 | 117 | void destroyFragmentFunction (FunctionId id); | ||
4103 | 118 | |||
4104 | 119 | FunctionId getSaturateFragmentFunction (GLTexture *texture, | ||
4105 | 120 | int param); | ||
4106 | 121 | }; | ||
4107 | 122 | |||
4108 | 123 | |||
4109 | 124 | |||
4110 | 125 | #endif | ||
4111 | 126 | 0 | ||
4112 | === added file 'plugins/opengl/include/opengl/framebufferobject.h' | |||
4113 | --- plugins/opengl/include/opengl/framebufferobject.h 1970-01-01 00:00:00 +0000 | |||
4114 | +++ plugins/opengl/include/opengl/framebufferobject.h 2012-08-22 06:16:22 +0000 | |||
4115 | @@ -0,0 +1,104 @@ | |||
4116 | 1 | /* | ||
4117 | 2 | * Copyright (c) 2011 Collabora, Ltd. | ||
4118 | 3 | * | ||
4119 | 4 | * Permission to use, copy, modify, distribute, and sell this software | ||
4120 | 5 | * and its documentation for any purpose is hereby granted without | ||
4121 | 6 | * fee, provided that the above copyright notice appear in all copies | ||
4122 | 7 | * and that both that copyright notice and this permission notice | ||
4123 | 8 | * appear in supporting documentation, and that the name of | ||
4124 | 9 | * Collabora Ltd. not be used in advertising or publicity pertaining to | ||
4125 | 10 | * distribution of the software without specific, written prior permission. | ||
4126 | 11 | * Collabora Ltd. makes no representations about the suitability of this | ||
4127 | 12 | * software for any purpose. It is provided "as is" without express or | ||
4128 | 13 | * implied warranty. | ||
4129 | 14 | * | ||
4130 | 15 | * COLLABORA LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
4131 | 16 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN | ||
4132 | 17 | * NO EVENT SHALL COLLABORA LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
4133 | 18 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS | ||
4134 | 19 | * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | ||
4135 | 20 | * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | ||
4136 | 21 | * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
4137 | 22 | * | ||
4138 | 23 | * Authors: Pekka Paalanen <ppaalanen@gmail.com> | ||
4139 | 24 | */ | ||
4140 | 25 | |||
4141 | 26 | #ifndef _COMPIZ_GLFRAMEBUFFEROBJECT_H | ||
4142 | 27 | #define _COMPIZ_GLFRAMEBUFFEROBJECT_H | ||
4143 | 28 | |||
4144 | 29 | #include <opengl/opengl.h> | ||
4145 | 30 | |||
4146 | 31 | struct PrivateGLFramebufferObject; | ||
4147 | 32 | |||
4148 | 33 | /** | ||
4149 | 34 | * Class representing a framebuffer object in GL, supporting only one | ||
4150 | 35 | * color attachment as per GLES 2 spec. The color attachment is referred | ||
4151 | 36 | * to as the texture (of the FBO). | ||
4152 | 37 | * | ||
4153 | 38 | * Usage: | ||
4154 | 39 | * 1. create a GLFramebufferObject (requires a GL context) | ||
4155 | 40 | * 2. call allocate (size), and check status () | ||
4156 | 41 | * 3. old = bind () | ||
4157 | 42 | * 4. do your rendering | ||
4158 | 43 | * 5. rebind (old) | ||
4159 | 44 | * 6. use the rendered texture via tex () | ||
4160 | 45 | * 7. go to 2 or 3, or delete to quit (requires a GL context) | ||
4161 | 46 | */ | ||
4162 | 47 | class GLFramebufferObject | ||
4163 | 48 | { | ||
4164 | 49 | public: | ||
4165 | 50 | GLFramebufferObject (); | ||
4166 | 51 | ~GLFramebufferObject (); | ||
4167 | 52 | |||
4168 | 53 | /** | ||
4169 | 54 | * Ensure the texture is of the given size, recreating it if needed, | ||
4170 | 55 | * and replace the FBO color attachment with it. The texture contents | ||
4171 | 56 | * become undefined, unless specified in the 'image' argument. | ||
4172 | 57 | * When specifying 'image', it's also possible to pass-in the | ||
4173 | 58 | * desired image's 'format' and 'type'. | ||
4174 | 59 | * | ||
4175 | 60 | * Returns true on success, and false on texture allocation failure. | ||
4176 | 61 | */ | ||
4177 | 62 | bool allocate (const CompSize &size, | ||
4178 | 63 | const char *image = NULL, | ||
4179 | 64 | GLenum format = GL_RGBA, | ||
4180 | 65 | GLenum type = GL_UNSIGNED_BYTE); | ||
4181 | 66 | |||
4182 | 67 | /** | ||
4183 | 68 | * Bind this as the current FBO, previous binding in GL context is | ||
4184 | 69 | * undone. GL rendering is now targeted to this FBO. | ||
4185 | 70 | * Returns a pointer to the previously bound FBO, or NULL if | ||
4186 | 71 | * the previous binding was zero (the window system provided | ||
4187 | 72 | * framebuffer). | ||
4188 | 73 | * | ||
4189 | 74 | * The previous FBO is no longer bound, so you can use its | ||
4190 | 75 | * texture. To restore the previous FBO, call rebind (FBO) with | ||
4191 | 76 | * the returned pointer as the argument. | ||
4192 | 77 | */ | ||
4193 | 78 | GLFramebufferObject *bind (); | ||
4194 | 79 | |||
4195 | 80 | /** | ||
4196 | 81 | * Bind the given FBO as the current FBO, without looking up the | ||
4197 | 82 | * previous binding. The argument can be NULL, in which case the | ||
4198 | 83 | * window system provided framebuffer gets bound (FBO is unbound). | ||
4199 | 84 | */ | ||
4200 | 85 | static void rebind (GLFramebufferObject *fbo); | ||
4201 | 86 | |||
4202 | 87 | /** | ||
4203 | 88 | * Check the FBO completeness. Returns true on complete. | ||
4204 | 89 | * Otherwise returns false and reports the error to log. | ||
4205 | 90 | */ | ||
4206 | 91 | bool checkStatus (); | ||
4207 | 92 | |||
4208 | 93 | /** | ||
4209 | 94 | * Return a pointer to the texture that is the color attachment. | ||
4210 | 95 | * This will return NULL, if allocate () has not been called, or | ||
4211 | 96 | * the last allocate () call failed. | ||
4212 | 97 | */ | ||
4213 | 98 | GLTexture *tex (); | ||
4214 | 99 | |||
4215 | 100 | private: | ||
4216 | 101 | PrivateGLFramebufferObject *priv; | ||
4217 | 102 | }; | ||
4218 | 103 | |||
4219 | 104 | #endif // _COMPIZ_GLFRAMEBUFFEROBJECT_H | ||
4220 | 0 | 105 | ||
4221 | === modified file 'plugins/opengl/include/opengl/matrix.h' | |||
4222 | --- plugins/opengl/include/opengl/matrix.h 2009-03-15 05:09:18 +0000 | |||
4223 | +++ plugins/opengl/include/opengl/matrix.h 2012-08-22 06:16:22 +0000 | |||
4224 | @@ -44,6 +44,8 @@ | |||
4225 | 44 | void reset (); | 44 | void reset (); |
4226 | 45 | void toScreenSpace (const CompOutput *output, float z); | 45 | void toScreenSpace (const CompOutput *output, float z); |
4227 | 46 | 46 | ||
4228 | 47 | bool invert (); | ||
4229 | 48 | |||
4230 | 47 | void rotate (const float angle, const float x, | 49 | void rotate (const float angle, const float x, |
4231 | 48 | const float y, const float z); | 50 | const float y, const float z); |
4232 | 49 | void rotate (const float angle, const GLVector& vector); | 51 | void rotate (const float angle, const GLVector& vector); |
4233 | 50 | 52 | ||
4234 | === modified file 'plugins/opengl/include/opengl/opengl.h' | |||
4235 | --- plugins/opengl/include/opengl/opengl.h 2012-01-20 09:05:56 +0000 | |||
4236 | +++ plugins/opengl/include/opengl/opengl.h 2012-08-22 06:16:22 +0000 | |||
4237 | @@ -28,16 +28,52 @@ | |||
4238 | 28 | #ifndef _COMPIZ_OPENGL_H | 28 | #ifndef _COMPIZ_OPENGL_H |
4239 | 29 | #define _COMPIZ_OPENGL_H | 29 | #define _COMPIZ_OPENGL_H |
4240 | 30 | 30 | ||
4241 | 31 | #ifdef USE_GLES | ||
4242 | 32 | #define SUPPORT_X11 | ||
4243 | 33 | #include <GLES2/gl2.h> | ||
4244 | 34 | #include <GLES2/gl2ext.h> | ||
4245 | 35 | #include <EGL/egl.h> | ||
4246 | 36 | #include <EGL/eglext.h> | ||
4247 | 37 | #else | ||
4248 | 31 | #include <GL/gl.h> | 38 | #include <GL/gl.h> |
4249 | 32 | #include <GL/glx.h> | 39 | #include <GL/glx.h> |
4250 | 40 | #endif | ||
4251 | 41 | |||
4252 | 42 | #include <core/size.h> | ||
4253 | 43 | #include <core/pluginclasshandler.h> | ||
4254 | 33 | 44 | ||
4255 | 34 | #include <opengl/matrix.h> | 45 | #include <opengl/matrix.h> |
4256 | 35 | #include <opengl/texture.h> | 46 | #include <opengl/texture.h> |
4262 | 36 | #include <opengl/fragment.h> | 47 | #include <opengl/framebufferobject.h> |
4263 | 37 | 48 | #include <opengl/vertexbuffer.h> | |
4264 | 38 | #define COMPIZ_OPENGL_ABI 4 | 49 | #include <opengl/program.h> |
4265 | 39 | 50 | #include <opengl/programcache.h> | |
4266 | 40 | #include <core/pluginclasshandler.h> | 51 | #include <opengl/shadercache.h> |
4267 | 52 | |||
4268 | 53 | #define COMPIZ_OPENGL_ABI 5 | ||
4269 | 54 | |||
4270 | 55 | /* | ||
4271 | 56 | * Some plugins check for #ifdef USE_MODERN_COMPIZ_GL. Support it for now, but | ||
4272 | 57 | * but the offending code should be changed to: #if COMPIZ_OPENGL_ABI >= 5 | ||
4273 | 58 | * Or the preprocessor checks should be removed altogether. | ||
4274 | 59 | */ | ||
4275 | 60 | #define USE_MODERN_COMPIZ_GL 1 | ||
4276 | 61 | |||
4277 | 62 | #if !defined(GL_BGRA) | ||
4278 | 63 | #if !defined(GL_BGRA_EXT) | ||
4279 | 64 | #error GL_BGRA support is required | ||
4280 | 65 | #else | ||
4281 | 66 | #define GL_BGRA GL_BGRA_EXT | ||
4282 | 67 | #endif | ||
4283 | 68 | #endif | ||
4284 | 69 | |||
4285 | 70 | #if !defined(GL_BGRA) | ||
4286 | 71 | #if !defined(GL_BGRA_EXT) | ||
4287 | 72 | #error GL_BGRA support is required | ||
4288 | 73 | #else | ||
4289 | 74 | #define GL_BGRA GL_BGRA_EXT | ||
4290 | 75 | #endif | ||
4291 | 76 | #endif | ||
4292 | 41 | 77 | ||
4293 | 42 | /** | 78 | /** |
4294 | 43 | * camera distance from screen, 0.5 * tan (FOV) | 79 | * camera distance from screen, 0.5 * tan (FOV) |
4295 | @@ -75,8 +111,26 @@ | |||
4296 | 75 | #endif | 111 | #endif |
4297 | 76 | 112 | ||
4298 | 77 | namespace GL { | 113 | namespace GL { |
4300 | 78 | 114 | #ifdef USE_GLES | |
4301 | 115 | typedef EGLImageKHR (*EGLCreateImageKHRProc) (EGLDisplay dpy, | ||
4302 | 116 | EGLContext ctx, | ||
4303 | 117 | EGLenum target, | ||
4304 | 118 | EGLClientBuffer buffer, | ||
4305 | 119 | const EGLint *attrib_list); | ||
4306 | 120 | typedef EGLBoolean (*EGLDestroyImageKHRProc) (EGLDisplay dpy, | ||
4307 | 121 | EGLImageKHR image); | ||
4308 | 122 | |||
4309 | 123 | typedef void (*GLEGLImageTargetTexture2DOESProc) (GLenum target, | ||
4310 | 124 | GLeglImageOES image); | ||
4311 | 125 | |||
4312 | 126 | typedef EGLBoolean (*EGLPostSubBufferNVProc) (EGLDisplay dpy, | ||
4313 | 127 | EGLSurface surface, | ||
4314 | 128 | EGLint x, EGLint y, | ||
4315 | 129 | EGLint width, EGLint height); | ||
4316 | 130 | |||
4317 | 131 | #else | ||
4318 | 79 | typedef void (*FuncPtr) (void); | 132 | typedef void (*FuncPtr) (void); |
4319 | 133 | |||
4320 | 80 | typedef FuncPtr (*GLXGetProcAddressProc) (const GLubyte *procName); | 134 | typedef FuncPtr (*GLXGetProcAddressProc) (const GLubyte *procName); |
4321 | 81 | 135 | ||
4322 | 82 | typedef void (*GLXBindTexImageProc) (Display *display, | 136 | typedef void (*GLXBindTexImageProc) (Display *display, |
4323 | @@ -122,11 +176,6 @@ | |||
4324 | 122 | const int *attribList); | 176 | const int *attribList); |
4325 | 123 | typedef void (*GLXDestroyPixmapProc) (Display *display, | 177 | typedef void (*GLXDestroyPixmapProc) (Display *display, |
4326 | 124 | GLXPixmap pixmap); | 178 | GLXPixmap pixmap); |
4327 | 125 | |||
4328 | 126 | typedef void (*GLActiveTextureProc) (GLenum texture); | ||
4329 | 127 | typedef void (*GLClientActiveTextureProc) (GLenum texture); | ||
4330 | 128 | typedef void (*GLMultiTexCoord2fProc) (GLenum, GLfloat, GLfloat); | ||
4331 | 129 | |||
4332 | 130 | typedef void (*GLGenProgramsProc) (GLsizei n, | 179 | typedef void (*GLGenProgramsProc) (GLsizei n, |
4333 | 131 | GLuint *programs); | 180 | GLuint *programs); |
4334 | 132 | typedef void (*GLDeleteProgramsProc) (GLsizei n, | 181 | typedef void (*GLDeleteProgramsProc) (GLsizei n, |
4335 | @@ -146,11 +195,16 @@ | |||
4336 | 146 | typedef void (*GLGetProgramivProc) (GLenum target, | 195 | typedef void (*GLGetProgramivProc) (GLenum target, |
4337 | 147 | GLenum pname, | 196 | GLenum pname, |
4338 | 148 | int *params); | 197 | int *params); |
4339 | 198 | #endif | ||
4340 | 199 | |||
4341 | 200 | typedef void (*GLActiveTextureProc) (GLenum texture); | ||
4342 | 201 | typedef void (*GLClientActiveTextureProc) (GLenum texture); | ||
4343 | 202 | typedef void (*GLMultiTexCoord2fProc) (GLenum, GLfloat, GLfloat); | ||
4344 | 149 | 203 | ||
4345 | 150 | typedef void (*GLGenFramebuffersProc) (GLsizei n, | 204 | typedef void (*GLGenFramebuffersProc) (GLsizei n, |
4346 | 151 | GLuint *framebuffers); | 205 | GLuint *framebuffers); |
4347 | 152 | typedef void (*GLDeleteFramebuffersProc) (GLsizei n, | 206 | typedef void (*GLDeleteFramebuffersProc) (GLsizei n, |
4349 | 153 | GLuint *framebuffers); | 207 | const GLuint *framebuffers); |
4350 | 154 | typedef void (*GLBindFramebufferProc) (GLenum target, | 208 | typedef void (*GLBindFramebufferProc) (GLenum target, |
4351 | 155 | GLuint framebuffer); | 209 | GLuint framebuffer); |
4352 | 156 | typedef GLenum (*GLCheckFramebufferStatusProc) (GLenum target); | 210 | typedef GLenum (*GLCheckFramebufferStatusProc) (GLenum target); |
4353 | @@ -161,6 +215,136 @@ | |||
4354 | 161 | GLint level); | 215 | GLint level); |
4355 | 162 | typedef void (*GLGenerateMipmapProc) (GLenum target); | 216 | typedef void (*GLGenerateMipmapProc) (GLenum target); |
4356 | 163 | 217 | ||
4357 | 218 | typedef void (*GLBindBufferProc) (GLenum target, | ||
4358 | 219 | GLuint buffer); | ||
4359 | 220 | typedef void (*GLDeleteBuffersProc) (GLsizei n, | ||
4360 | 221 | const GLuint *buffers); | ||
4361 | 222 | typedef void (*GLGenBuffersProc) (GLsizei n, | ||
4362 | 223 | GLuint *buffers); | ||
4363 | 224 | typedef void (*GLBufferDataProc) (GLenum target, | ||
4364 | 225 | GLsizeiptr size, | ||
4365 | 226 | const GLvoid *data, | ||
4366 | 227 | GLenum usage); | ||
4367 | 228 | typedef void (*GLBufferSubDataProc) (GLenum target, | ||
4368 | 229 | GLintptr offset, | ||
4369 | 230 | GLsizeiptr size, | ||
4370 | 231 | const GLvoid *data); | ||
4371 | 232 | |||
4372 | 233 | typedef void (*GLGetShaderivProc) (GLuint shader, | ||
4373 | 234 | GLenum pname, | ||
4374 | 235 | GLint *params); | ||
4375 | 236 | typedef void (*GLGetShaderInfoLogProc) (GLuint shader, | ||
4376 | 237 | GLsizei bufsize, | ||
4377 | 238 | GLsizei *length, | ||
4378 | 239 | GLchar *infoLog); | ||
4379 | 240 | typedef void (*GLGetProgramivProc) (GLuint program, | ||
4380 | 241 | GLenum pname, | ||
4381 | 242 | GLint* params); | ||
4382 | 243 | typedef void (*GLGetProgramInfoLogProc) (GLuint program, | ||
4383 | 244 | GLsizei bufsize, | ||
4384 | 245 | GLsizei *length, | ||
4385 | 246 | GLchar *infoLog); | ||
4386 | 247 | typedef GLuint (*GLCreateShaderProc) (GLenum type); | ||
4387 | 248 | typedef void (*GLShaderSourceProc) (GLuint shader, | ||
4388 | 249 | GLsizei count, | ||
4389 | 250 | const GLchar **string, | ||
4390 | 251 | const GLint* length); | ||
4391 | 252 | typedef void (*GLCompileShaderProc) (GLuint shader); | ||
4392 | 253 | typedef GLuint (*GLCreateProgramProc) (); | ||
4393 | 254 | typedef void (*GLAttachShaderProc) (GLuint program, | ||
4394 | 255 | GLuint shader); | ||
4395 | 256 | typedef void (*GLLinkProgramProc) (GLuint program); | ||
4396 | 257 | typedef void (*GLValidateProgramProc) (GLuint program); | ||
4397 | 258 | typedef void (*GLDeleteShaderProc) (GLuint shader); | ||
4398 | 259 | typedef void (*GLDeleteProgramProc) (GLuint program); | ||
4399 | 260 | typedef void (*GLUseProgramProc) (GLuint program); | ||
4400 | 261 | typedef int (*GLGetUniformLocationProc) (GLuint program, | ||
4401 | 262 | const GLchar* name); | ||
4402 | 263 | typedef void (*GLUniform1fProc) (GLint location, GLfloat x); | ||
4403 | 264 | typedef void (*GLUniform1iProc) (GLint location, GLint x); | ||
4404 | 265 | typedef void (*GLUniform2fProc) (GLint location, GLfloat x, GLfloat y); | ||
4405 | 266 | typedef void (*GLUniform3fProc) (GLint location, | ||
4406 | 267 | GLfloat x, | ||
4407 | 268 | GLfloat y, | ||
4408 | 269 | GLfloat z); | ||
4409 | 270 | typedef void (*GLUniform4fProc) (GLint location, | ||
4410 | 271 | GLfloat x, | ||
4411 | 272 | GLfloat y, | ||
4412 | 273 | GLfloat z, | ||
4413 | 274 | GLfloat w); | ||
4414 | 275 | typedef void (*GLUniform2iProc) (GLint location, GLint x, GLint y); | ||
4415 | 276 | typedef void (*GLUniform3iProc) (GLint location, | ||
4416 | 277 | GLint x, | ||
4417 | 278 | GLint y, | ||
4418 | 279 | GLint z); | ||
4419 | 280 | typedef void (*GLUniform4iProc) (GLint location, | ||
4420 | 281 | GLint x, | ||
4421 | 282 | GLint y, | ||
4422 | 283 | GLint z, | ||
4423 | 284 | GLint w); | ||
4424 | 285 | typedef void (*GLUniformMatrix4fvProc) (GLint location, | ||
4425 | 286 | GLsizei count, | ||
4426 | 287 | GLboolean transpose, | ||
4427 | 288 | const GLfloat *value); | ||
4428 | 289 | typedef int (*GLGetAttribLocationProc) (GLuint program, | ||
4429 | 290 | const GLchar *name); | ||
4430 | 291 | |||
4431 | 292 | typedef void (*GLEnableVertexAttribArrayProc) (GLuint index); | ||
4432 | 293 | typedef void (*GLDisableVertexAttribArrayProc) (GLuint index); | ||
4433 | 294 | typedef void (*GLVertexAttribPointerProc) (GLuint index, | ||
4434 | 295 | GLint size, | ||
4435 | 296 | GLenum type, | ||
4436 | 297 | GLboolean normalized, | ||
4437 | 298 | GLsizei stride, | ||
4438 | 299 | const GLvoid *ptr); | ||
4439 | 300 | |||
4440 | 301 | typedef void (*GLGenRenderbuffersProc) (GLsizei n, | ||
4441 | 302 | GLuint *rb); | ||
4442 | 303 | typedef void (*GLDeleteRenderbuffersProc) (GLsizei n, | ||
4443 | 304 | const GLuint *rb); | ||
4444 | 305 | typedef void (*GLBindRenderbufferProc) (GLenum target, | ||
4445 | 306 | GLuint renderbuffer); | ||
4446 | 307 | typedef void (*GLFramebufferRenderbufferProc) (GLenum target, | ||
4447 | 308 | GLenum attachment, | ||
4448 | 309 | GLenum renderbuffertarget, | ||
4449 | 310 | GLuint renderbuffer); | ||
4450 | 311 | typedef void (*GLRenderbufferStorageProc) (GLenum target, | ||
4451 | 312 | GLenum internalformat, | ||
4452 | 313 | GLsizei width, | ||
4453 | 314 | GLsizei height); | ||
4454 | 315 | |||
4455 | 316 | |||
4456 | 317 | /* GL_ARB_shader_objects */ | ||
4457 | 318 | #ifndef USE_GLES | ||
4458 | 319 | typedef GLhandleARB (*GLCreateShaderObjectARBProc) (GLenum type); | ||
4459 | 320 | typedef GLhandleARB (*GLCreateProgramObjectARBProc) (); | ||
4460 | 321 | typedef void (*GLShaderSourceARBProc) (GLhandleARB shader, | ||
4461 | 322 | GLsizei count, | ||
4462 | 323 | const GLchar **string, | ||
4463 | 324 | const GLint* length); | ||
4464 | 325 | typedef void (*GLCompileShaderARBProc) (GLhandleARB shader); | ||
4465 | 326 | typedef void (*GLValidateProgramARBProc) (GLhandleARB program); | ||
4466 | 327 | typedef void (*GLDeleteObjectARBProc) (GLhandleARB object); | ||
4467 | 328 | typedef void (*GLAttachObjectARBProc) (GLhandleARB program, | ||
4468 | 329 | GLhandleARB shader); | ||
4469 | 330 | typedef void (*GLLinkProgramARBProc) (GLhandleARB program); | ||
4470 | 331 | typedef void (*GLUseProgramObjectARBProc) (GLhandleARB program); | ||
4471 | 332 | typedef int (*GLGetUniformLocationARBProc) (GLhandleARB program, | ||
4472 | 333 | const GLchar* name); | ||
4473 | 334 | typedef int (*GLGetAttribLocationARBProc) (GLhandleARB program, | ||
4474 | 335 | const GLchar *name); | ||
4475 | 336 | |||
4476 | 337 | typedef void (*GLGetObjectParameterivProc) (GLhandleARB object, GLenum type, int *param); | ||
4477 | 338 | typedef void (*GLGetInfoLogProc) (GLhandleARB object, int maxLen, int *len, char *log); | ||
4478 | 339 | #endif | ||
4479 | 340 | |||
4480 | 341 | #ifdef USE_GLES | ||
4481 | 342 | extern EGLCreateImageKHRProc createImage; | ||
4482 | 343 | extern EGLDestroyImageKHRProc destroyImage; | ||
4483 | 344 | |||
4484 | 345 | extern GLEGLImageTargetTexture2DOESProc eglImageTargetTexture; | ||
4485 | 346 | |||
4486 | 347 | #else | ||
4487 | 164 | extern GLXBindTexImageProc bindTexImage; | 348 | extern GLXBindTexImageProc bindTexImage; |
4488 | 165 | extern GLXReleaseTexImageProc releaseTexImage; | 349 | extern GLXReleaseTexImageProc releaseTexImage; |
4489 | 166 | extern GLXQueryDrawableProc queryDrawable; | 350 | extern GLXQueryDrawableProc queryDrawable; |
4490 | @@ -172,11 +356,6 @@ | |||
4491 | 172 | extern GLXGetFBConfigAttribProc getFBConfigAttrib; | 356 | extern GLXGetFBConfigAttribProc getFBConfigAttrib; |
4492 | 173 | extern GLXCreatePixmapProc createPixmap; | 357 | extern GLXCreatePixmapProc createPixmap; |
4493 | 174 | extern GLXDestroyPixmapProc destroyPixmap; | 358 | extern GLXDestroyPixmapProc destroyPixmap; |
4494 | 175 | |||
4495 | 176 | extern GLActiveTextureProc activeTexture; | ||
4496 | 177 | extern GLClientActiveTextureProc clientActiveTexture; | ||
4497 | 178 | extern GLMultiTexCoord2fProc multiTexCoord2f; | ||
4498 | 179 | |||
4499 | 180 | extern GLGenProgramsProc genPrograms; | 359 | extern GLGenProgramsProc genPrograms; |
4500 | 181 | extern GLDeleteProgramsProc deletePrograms; | 360 | extern GLDeleteProgramsProc deletePrograms; |
4501 | 182 | extern GLBindProgramProc bindProgram; | 361 | extern GLBindProgramProc bindProgram; |
4502 | @@ -184,6 +363,11 @@ | |||
4503 | 184 | extern GLProgramParameter4fProc programEnvParameter4f; | 363 | extern GLProgramParameter4fProc programEnvParameter4f; |
4504 | 185 | extern GLProgramParameter4fProc programLocalParameter4f; | 364 | extern GLProgramParameter4fProc programLocalParameter4f; |
4505 | 186 | extern GLGetProgramivProc getProgramiv; | 365 | extern GLGetProgramivProc getProgramiv; |
4506 | 366 | #endif | ||
4507 | 367 | |||
4508 | 368 | extern GLActiveTextureProc activeTexture; | ||
4509 | 369 | extern GLClientActiveTextureProc clientActiveTexture; | ||
4510 | 370 | extern GLMultiTexCoord2fProc multiTexCoord2f; | ||
4511 | 187 | 371 | ||
4512 | 188 | extern GLGenFramebuffersProc genFramebuffers; | 372 | extern GLGenFramebuffersProc genFramebuffers; |
4513 | 189 | extern GLDeleteFramebuffersProc deleteFramebuffers; | 373 | extern GLDeleteFramebuffersProc deleteFramebuffers; |
4514 | @@ -192,20 +376,177 @@ | |||
4515 | 192 | extern GLFramebufferTexture2DProc framebufferTexture2D; | 376 | extern GLFramebufferTexture2DProc framebufferTexture2D; |
4516 | 193 | extern GLGenerateMipmapProc generateMipmap; | 377 | extern GLGenerateMipmapProc generateMipmap; |
4517 | 194 | 378 | ||
4518 | 379 | extern GLBindBufferProc bindBuffer; | ||
4519 | 380 | extern GLDeleteBuffersProc deleteBuffers; | ||
4520 | 381 | extern GLGenBuffersProc genBuffers; | ||
4521 | 382 | extern GLBufferDataProc bufferData; | ||
4522 | 383 | extern GLBufferSubDataProc bufferSubData; | ||
4523 | 384 | |||
4524 | 385 | |||
4525 | 386 | extern GLGetShaderivProc getShaderiv; | ||
4526 | 387 | extern GLGetShaderInfoLogProc getShaderInfoLog; | ||
4527 | 388 | extern GLGetProgramivProc getProgramiv; | ||
4528 | 389 | extern GLGetProgramInfoLogProc getProgramInfoLog; | ||
4529 | 390 | extern GLCreateShaderProc createShader; | ||
4530 | 391 | extern GLShaderSourceProc shaderSource; | ||
4531 | 392 | extern GLCompileShaderProc compileShader; | ||
4532 | 393 | extern GLCreateProgramProc createProgram; | ||
4533 | 394 | extern GLAttachShaderProc attachShader; | ||
4534 | 395 | extern GLLinkProgramProc linkProgram; | ||
4535 | 396 | extern GLValidateProgramProc validateProgram; | ||
4536 | 397 | extern GLDeleteShaderProc deleteShader; | ||
4537 | 398 | extern GLDeleteProgramProc deleteProgram; | ||
4538 | 399 | extern GLUseProgramProc useProgram; | ||
4539 | 400 | extern GLGetUniformLocationProc getUniformLocation; | ||
4540 | 401 | extern GLUniform1fProc uniform1f; | ||
4541 | 402 | extern GLUniform1iProc uniform1i; | ||
4542 | 403 | extern GLUniform2fProc uniform2f; | ||
4543 | 404 | extern GLUniform2iProc uniform2i; | ||
4544 | 405 | extern GLUniform3fProc uniform3f; | ||
4545 | 406 | extern GLUniform3iProc uniform3i; | ||
4546 | 407 | extern GLUniform4fProc uniform4f; | ||
4547 | 408 | extern GLUniform4iProc uniform4i; | ||
4548 | 409 | extern GLUniformMatrix4fvProc uniformMatrix4fv; | ||
4549 | 410 | extern GLGetAttribLocationProc getAttribLocation; | ||
4550 | 411 | |||
4551 | 412 | extern GLEnableVertexAttribArrayProc enableVertexAttribArray; | ||
4552 | 413 | extern GLDisableVertexAttribArrayProc disableVertexAttribArray; | ||
4553 | 414 | extern GLVertexAttribPointerProc vertexAttribPointer; | ||
4554 | 415 | |||
4555 | 416 | extern GLGenRenderbuffersProc genRenderbuffers; | ||
4556 | 417 | extern GLDeleteRenderbuffersProc deleteRenderbuffers; | ||
4557 | 418 | extern GLBindRenderbufferProc bindRenderbuffer; | ||
4558 | 419 | extern GLFramebufferRenderbufferProc framebufferRenderbuffer; | ||
4559 | 420 | extern GLRenderbufferStorageProc renderbufferStorage; | ||
4560 | 421 | |||
4561 | 422 | #ifndef USE_GLES | ||
4562 | 423 | extern GLCreateShaderObjectARBProc createShaderObjectARB; | ||
4563 | 424 | extern GLCreateProgramObjectARBProc createProgramObjectARB; | ||
4564 | 425 | extern GLShaderSourceARBProc shaderSourceARB; | ||
4565 | 426 | extern GLCompileShaderARBProc compileShaderARB; | ||
4566 | 427 | extern GLValidateProgramARBProc validateProgramARB; | ||
4567 | 428 | extern GLDeleteObjectARBProc deleteObjectARB; | ||
4568 | 429 | extern GLAttachObjectARBProc attachObjectARB; | ||
4569 | 430 | extern GLLinkProgramARBProc linkProgramARB; | ||
4570 | 431 | extern GLUseProgramObjectARBProc useProgramObjectARB; | ||
4571 | 432 | extern GLGetUniformLocationARBProc getUniformLocationARB; | ||
4572 | 433 | extern GLGetAttribLocationARBProc getAttribLocationARB; | ||
4573 | 434 | |||
4574 | 435 | extern GLGetObjectParameterivProc getObjectParameteriv; | ||
4575 | 436 | extern GLGetInfoLogProc getInfoLog; | ||
4576 | 437 | #endif | ||
4577 | 438 | |||
4578 | 439 | #ifdef USE_GLES | ||
4579 | 440 | |||
4580 | 441 | static const GLenum FRAMEBUFFER_BINDING = GL_FRAMEBUFFER_BINDING; | ||
4581 | 442 | static const GLenum FRAMEBUFFER = GL_FRAMEBUFFER; | ||
4582 | 443 | static const GLenum RENDERBUFFER = GL_RENDERBUFFER; | ||
4583 | 444 | static const GLenum COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0; | ||
4584 | 445 | static const GLenum DEPTH_ATTACHMENT = GL_DEPTH_ATTACHMENT; | ||
4585 | 446 | static const GLenum STENCIL_ATTACHMENT = GL_STENCIL_ATTACHMENT; | ||
4586 | 447 | static const GLenum DEPTH24_STENCIL8 = GL_DEPTH24_STENCIL8_OES; | ||
4587 | 448 | |||
4588 | 449 | /* OpenGL|ES does not support different draw/read framebuffers */ | ||
4589 | 450 | static const GLenum DRAW_FRAMEBUFFER = GL_FRAMEBUFFER; | ||
4590 | 451 | static const GLenum READ_FRAMEBUFFER = GL_FRAMEBUFFER; | ||
4591 | 452 | |||
4592 | 453 | static const GLenum FRAMEBUFFER_COMPLETE = GL_FRAMEBUFFER_COMPLETE; | ||
4593 | 454 | static const GLenum FRAMEBUFFER_UNDEFINED = 0; | ||
4594 | 455 | static const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; | ||
4595 | 456 | static const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT; | ||
4596 | 457 | static const GLenum FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 0; | ||
4597 | 458 | static const GLenum FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 0; | ||
4598 | 459 | static const GLenum FRAMEBUFFER_UNSUPPORTED = GL_FRAMEBUFFER_UNSUPPORTED; | ||
4599 | 460 | static const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0; | ||
4600 | 461 | static const GLenum FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = 0; | ||
4601 | 462 | static const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS; | ||
4602 | 463 | |||
4603 | 464 | static const GLenum ARRAY_BUFFER = GL_ARRAY_BUFFER; | ||
4604 | 465 | static const GLenum STATIC_DRAW = GL_STATIC_DRAW; | ||
4605 | 466 | static const GLenum STREAM_DRAW = GL_STREAM_DRAW; | ||
4606 | 467 | static const GLenum DYNAMIC_DRAW = GL_DYNAMIC_DRAW; | ||
4607 | 468 | |||
4608 | 469 | static const GLenum INFO_LOG_LENGTH = GL_INFO_LOG_LENGTH; | ||
4609 | 470 | static const GLenum COMPILE_STATUS = GL_COMPILE_STATUS; | ||
4610 | 471 | static const GLenum LINK_STATUS = GL_LINK_STATUS; | ||
4611 | 472 | static const GLenum FRAGMENT_SHADER = GL_FRAGMENT_SHADER; | ||
4612 | 473 | static const GLenum VERTEX_SHADER = GL_VERTEX_SHADER; | ||
4613 | 474 | |||
4614 | 475 | #else | ||
4615 | 476 | |||
4616 | 477 | static const GLenum FRAMEBUFFER_BINDING = GL_FRAMEBUFFER_BINDING_EXT; | ||
4617 | 478 | static const GLenum FRAMEBUFFER = GL_FRAMEBUFFER_EXT; | ||
4618 | 479 | static const GLenum RENDERBUFFER = GL_RENDERBUFFER; | ||
4619 | 480 | static const GLenum COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0_EXT; | ||
4620 | 481 | static const GLenum DEPTH_ATTACHMENT = GL_DEPTH_ATTACHMENT_EXT; | ||
4621 | 482 | static const GLenum STENCIL_ATTACHMENT = GL_STENCIL_ATTACHMENT_EXT; | ||
4622 | 483 | static const GLenum DEPTH24_STENCIL8 = GL_DEPTH24_STENCIL8_EXT; | ||
4623 | 484 | |||
4624 | 485 | static const GLenum DRAW_FRAMEBUFFER = GL_DRAW_FRAMEBUFFER_EXT; | ||
4625 | 486 | static const GLenum READ_FRAMEBUFFER = GL_READ_FRAMEBUFFER_EXT; | ||
4626 | 487 | static const GLenum FRAMEBUFFER_COMPLETE = GL_FRAMEBUFFER_COMPLETE_EXT; | ||
4627 | 488 | static const GLenum FRAMEBUFFER_UNDEFINED = GL_FRAMEBUFFER_UNDEFINED; | ||
4628 | 489 | static const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT; | ||
4629 | 490 | static const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT; | ||
4630 | 491 | static const GLenum FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT; | ||
4631 | 492 | static const GLenum FRAMEBUFFER_INCOMPLETE_READ_BUFFER = GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT; | ||
4632 | 493 | static const GLenum FRAMEBUFFER_UNSUPPORTED = GL_FRAMEBUFFER_UNSUPPORTED_EXT; | ||
4633 | 494 | static const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT; | ||
4634 | 495 | static const GLenum FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT; | ||
4635 | 496 | static const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0; | ||
4636 | 497 | |||
4637 | 498 | static const GLenum ARRAY_BUFFER = GL_ARRAY_BUFFER_ARB; | ||
4638 | 499 | static const GLenum STATIC_DRAW = GL_STATIC_DRAW_ARB; | ||
4639 | 500 | static const GLenum STREAM_DRAW = GL_STREAM_DRAW_ARB; | ||
4640 | 501 | static const GLenum DYNAMIC_DRAW = GL_DYNAMIC_DRAW_ARB; | ||
4641 | 502 | |||
4642 | 503 | static const GLenum INFO_LOG_LENGTH = GL_OBJECT_INFO_LOG_LENGTH_ARB; | ||
4643 | 504 | static const GLenum COMPILE_STATUS = GL_OBJECT_COMPILE_STATUS_ARB; | ||
4644 | 505 | static const GLenum LINK_STATUS = GL_OBJECT_LINK_STATUS_ARB; | ||
4645 | 506 | static const GLenum FRAGMENT_SHADER = GL_FRAGMENT_SHADER_ARB; | ||
4646 | 507 | static const GLenum VERTEX_SHADER = GL_VERTEX_SHADER_ARB; | ||
4647 | 508 | |||
4648 | 509 | #endif | ||
4649 | 510 | |||
4650 | 195 | extern bool textureFromPixmap; | 511 | extern bool textureFromPixmap; |
4651 | 196 | extern bool textureRectangle; | 512 | extern bool textureRectangle; |
4652 | 197 | extern bool textureNonPowerOfTwo; | 513 | extern bool textureNonPowerOfTwo; |
4653 | 514 | extern bool textureNonPowerOfTwoMipmap; | ||
4654 | 198 | extern bool textureEnvCombine; | 515 | extern bool textureEnvCombine; |
4655 | 199 | extern bool textureEnvCrossbar; | 516 | extern bool textureEnvCrossbar; |
4656 | 200 | extern bool textureBorderClamp; | 517 | extern bool textureBorderClamp; |
4657 | 201 | extern bool textureCompression; | 518 | extern bool textureCompression; |
4658 | 202 | extern GLint maxTextureSize; | 519 | extern GLint maxTextureSize; |
4661 | 203 | extern bool fbo; | 520 | extern bool fboSupported; |
4662 | 204 | extern bool fragmentProgram; | 521 | extern bool fboStencilSupported; |
4663 | 522 | extern bool fboEnabled; | ||
4664 | 523 | extern bool vboSupported; | ||
4665 | 524 | extern bool vboEnabled; | ||
4666 | 525 | extern bool shaders; | ||
4667 | 526 | extern bool stencilBuffer; | ||
4668 | 205 | extern GLint maxTextureUnits; | 527 | extern GLint maxTextureUnits; |
4669 | 206 | 528 | ||
4670 | 207 | extern bool canDoSaturated; | 529 | extern bool canDoSaturated; |
4671 | 208 | extern bool canDoSlightlySaturated; | 530 | extern bool canDoSlightlySaturated; |
4672 | 531 | |||
4673 | 532 | #ifndef USE_GLES | ||
4674 | 533 | void getProgramInfoLogARBWrapper (GLuint object, int maxLen, int *len, char *log); | ||
4675 | 534 | void getShaderInfoLogARBWrapper (GLuint object, int maxLen, int *len, char *log); | ||
4676 | 535 | void getShaderivARBWrapper (GLuint object, GLenum type, int *param); | ||
4677 | 536 | void getProgramivARBWrapper (GLuint object, GLenum type, int *param); | ||
4678 | 537 | GLuint createShaderARBWrapper (GLenum type); | ||
4679 | 538 | GLuint createProgramARBWrapper (GLenum type); | ||
4680 | 539 | void shaderSourceARBWrapper (GLuint shader, GLsizei count, const GLchar **string, const GLint *length); | ||
4681 | 540 | void compileShaderARBWrapper (GLuint shader); | ||
4682 | 541 | void validateProgramARBWrapper (GLuint program); | ||
4683 | 542 | void deleteShaderARBWrapper (GLuint shader); | ||
4684 | 543 | void deleteProgramARBWrapper (GLuint program); | ||
4685 | 544 | void attachShaderARBWrapper (GLuint program, GLuint shader); | ||
4686 | 545 | void linkProgramARBWrapper (GLuint program); | ||
4687 | 546 | void useProgramARBWrapper (GLuint program); | ||
4688 | 547 | int getUniformLocationARBWrapper (GLuint program, const GLchar *name); | ||
4689 | 548 | int getAttribLocationARBWrapper (GLuint program, const GLchar *name); | ||
4690 | 549 | #endif | ||
4691 | 209 | }; | 550 | }; |
4692 | 210 | 551 | ||
4693 | 211 | struct GLScreenPaintAttrib { | 552 | struct GLScreenPaintAttrib { |
4694 | @@ -220,6 +561,7 @@ | |||
4695 | 220 | 561 | ||
4696 | 221 | #define MAX_DEPTH 32 | 562 | #define MAX_DEPTH 32 |
4697 | 222 | 563 | ||
4698 | 564 | #ifndef USE_GLES | ||
4699 | 223 | struct GLFBConfig { | 565 | struct GLFBConfig { |
4700 | 224 | GLXFBConfig fbConfig; | 566 | GLXFBConfig fbConfig; |
4701 | 225 | int yInverted; | 567 | int yInverted; |
4702 | @@ -227,6 +569,7 @@ | |||
4703 | 227 | int textureFormat; | 569 | int textureFormat; |
4704 | 228 | int textureTargets; | 570 | int textureTargets; |
4705 | 229 | }; | 571 | }; |
4706 | 572 | #endif | ||
4707 | 230 | 573 | ||
4708 | 231 | #define NOTHING_TRANS_FILTER 0 | 574 | #define NOTHING_TRANS_FILTER 0 |
4709 | 232 | #define SCREEN_TRANS_FILTER 1 | 575 | #define SCREEN_TRANS_FILTER 1 |
4710 | @@ -236,6 +579,7 @@ | |||
4711 | 236 | extern GLScreenPaintAttrib defaultScreenPaintAttrib; | 579 | extern GLScreenPaintAttrib defaultScreenPaintAttrib; |
4712 | 237 | 580 | ||
4713 | 238 | class GLScreen; | 581 | class GLScreen; |
4714 | 582 | class GLFramebufferObject; | ||
4715 | 239 | 583 | ||
4716 | 240 | class GLScreenInterface : | 584 | class GLScreenInterface : |
4717 | 241 | public WrapableInterface<GLScreen, GLScreenInterface> | 585 | public WrapableInterface<GLScreen, GLScreenInterface> |
4718 | @@ -302,11 +646,32 @@ | |||
4719 | 302 | CompOutput *); | 646 | CompOutput *); |
4720 | 303 | virtual void glDisableOutputClipping (); | 647 | virtual void glDisableOutputClipping (); |
4721 | 304 | 648 | ||
4722 | 649 | virtual GLMatrix *projectionMatrix (); | ||
4723 | 650 | |||
4724 | 651 | /** | ||
4725 | 652 | * Hookable function used by plugins to shade the final composited | ||
4726 | 653 | * Output. | ||
4727 | 654 | * | ||
4728 | 655 | * @param tmpRegion Describes the final composited output region | ||
4729 | 656 | * @param scratchFbo Describes the final composited FBO that is | ||
4730 | 657 | * to be rendered. | ||
4731 | 658 | */ | ||
4732 | 659 | virtual void glPaintCompositedOutput (const CompRegion ®ion, | ||
4733 | 660 | GLFramebufferObject *fbo, | ||
4734 | 661 | unsigned int mask); | ||
4735 | 662 | |||
4736 | 663 | /** | ||
4737 | 664 | * Hookable function used by plugins to determine stenciling mask | ||
4738 | 665 | */ | ||
4739 | 666 | virtual void glBufferStencil (const GLMatrix &matrix, | ||
4740 | 667 | GLVertexBuffer &vertexBuffer, | ||
4741 | 668 | CompOutput *output); | ||
4742 | 669 | |||
4743 | 305 | }; | 670 | }; |
4744 | 306 | 671 | ||
4745 | 307 | 672 | ||
4746 | 308 | class GLScreen : | 673 | class GLScreen : |
4748 | 309 | public WrapableHandler<GLScreenInterface, 6>, | 674 | public WrapableHandler<GLScreenInterface, 8>, |
4749 | 310 | public PluginClassHandler<GLScreen, CompScreen, COMPIZ_OPENGL_ABI>, | 675 | public PluginClassHandler<GLScreen, CompScreen, COMPIZ_OPENGL_ABI>, |
4750 | 311 | public CompOption::Class | 676 | public CompOption::Class |
4751 | 312 | { | 677 | { |
4752 | @@ -332,7 +697,9 @@ | |||
4753 | 332 | /** | 697 | /** |
4754 | 333 | * Gets the libGL address of a particular openGL functor | 698 | * Gets the libGL address of a particular openGL functor |
4755 | 334 | */ | 699 | */ |
4756 | 700 | #ifndef USE_GLES | ||
4757 | 335 | GL::FuncPtr getProcAddress (const char *name); | 701 | GL::FuncPtr getProcAddress (const char *name); |
4758 | 702 | #endif | ||
4759 | 336 | 703 | ||
4760 | 337 | void updateBackground (); | 704 | void updateBackground (); |
4761 | 338 | 705 | ||
4762 | @@ -346,8 +713,6 @@ | |||
4763 | 346 | */ | 713 | */ |
4764 | 347 | void setFilter (int, GLTexture::Filter); | 714 | void setFilter (int, GLTexture::Filter); |
4765 | 348 | 715 | ||
4766 | 349 | GLFragment::Storage * fragmentStorage (); | ||
4767 | 350 | |||
4768 | 351 | /** | 716 | /** |
4769 | 352 | * Sets a new compiz-wid openGL texture environment mode | 717 | * Sets a new compiz-wid openGL texture environment mode |
4770 | 353 | */ | 718 | */ |
4771 | @@ -356,7 +721,6 @@ | |||
4772 | 356 | /** | 721 | /** |
4773 | 357 | * Turns lighting on and off | 722 | * Turns lighting on and off |
4774 | 358 | */ | 723 | */ |
4775 | 359 | |||
4776 | 360 | void setLighting (bool lighting); | 724 | void setLighting (bool lighting); |
4777 | 361 | 725 | ||
4778 | 362 | /** | 726 | /** |
4779 | @@ -371,7 +735,28 @@ | |||
4780 | 371 | GLTexture::BindPixmapHandle registerBindPixmap (GLTexture::BindPixmapProc); | 735 | GLTexture::BindPixmapHandle registerBindPixmap (GLTexture::BindPixmapProc); |
4781 | 372 | void unregisterBindPixmap (GLTexture::BindPixmapHandle); | 736 | void unregisterBindPixmap (GLTexture::BindPixmapHandle); |
4782 | 373 | 737 | ||
4783 | 738 | #ifndef USE_GLES | ||
4784 | 374 | GLFBConfig * glxPixmapFBConfig (unsigned int depth); | 739 | GLFBConfig * glxPixmapFBConfig (unsigned int depth); |
4785 | 740 | #endif | ||
4786 | 741 | |||
4787 | 742 | #ifdef USE_GLES | ||
4788 | 743 | EGLContext getEGLContext (); | ||
4789 | 744 | #endif | ||
4790 | 745 | |||
4791 | 746 | /** | ||
4792 | 747 | * Returns a GLProgram from the cache or creates one and caches it | ||
4793 | 748 | */ | ||
4794 | 749 | GLProgram *getProgram (std::list<const GLShaderData*>); | ||
4795 | 750 | |||
4796 | 751 | /** | ||
4797 | 752 | * Returns a GLShaderData from the cache or creates one and caches it | ||
4798 | 753 | */ | ||
4799 | 754 | const GLShaderData *getShaderData (GLShaderParameters ¶ms); | ||
4800 | 755 | |||
4801 | 756 | /** | ||
4802 | 757 | * Returns the FBO compiz is using for the screen | ||
4803 | 758 | */ | ||
4804 | 759 | GLFramebufferObject *fbo (); | ||
4805 | 375 | 760 | ||
4806 | 376 | /** | 761 | /** |
4807 | 377 | * Returns a default icon texture | 762 | * Returns a default icon texture |
4808 | @@ -380,12 +765,6 @@ | |||
4809 | 380 | 765 | ||
4810 | 381 | void resetRasterPos (); | 766 | void resetRasterPos (); |
4811 | 382 | 767 | ||
4812 | 383 | /** | ||
4813 | 384 | * Returns a 4x4 const float array which | ||
4814 | 385 | * represents the current projection matrix | ||
4815 | 386 | */ | ||
4816 | 387 | const float * projectionMatrix (); | ||
4817 | 388 | |||
4818 | 389 | bool glInitContext (XVisualInfo *); | 768 | bool glInitContext (XVisualInfo *); |
4819 | 390 | 769 | ||
4820 | 391 | WRAPABLE_HND (0, GLScreenInterface, bool, glPaintOutput, | 770 | WRAPABLE_HND (0, GLScreenInterface, bool, glPaintOutput, |
4821 | @@ -402,7 +781,16 @@ | |||
4822 | 402 | const GLMatrix &, const CompRegion &, CompOutput *); | 781 | const GLMatrix &, const CompRegion &, CompOutput *); |
4823 | 403 | WRAPABLE_HND (4, GLScreenInterface, void, glDisableOutputClipping); | 782 | WRAPABLE_HND (4, GLScreenInterface, void, glDisableOutputClipping); |
4824 | 404 | 783 | ||
4825 | 784 | WRAPABLE_HND (5, GLScreenInterface, GLMatrix *, projectionMatrix); | ||
4826 | 785 | WRAPABLE_HND (6, GLScreenInterface, void, glPaintCompositedOutput, | ||
4827 | 786 | const CompRegion &, GLFramebufferObject *, unsigned int); | ||
4828 | 787 | |||
4829 | 788 | WRAPABLE_HND (7, GLScreenInterface, void, glBufferStencil, const GLMatrix &, | ||
4830 | 789 | GLVertexBuffer &, | ||
4831 | 790 | CompOutput *); | ||
4832 | 791 | |||
4833 | 405 | friend class GLTexture; | 792 | friend class GLTexture; |
4834 | 793 | friend class GLWindow; | ||
4835 | 406 | 794 | ||
4836 | 407 | private: | 795 | private: |
4837 | 408 | PrivateGLScreen *priv; | 796 | PrivateGLScreen *priv; |
4838 | @@ -454,7 +842,7 @@ | |||
4839 | 454 | * @param mask Bitmask which describes how this window is drawn | 842 | * @param mask Bitmask which describes how this window is drawn |
4840 | 455 | */ | 843 | */ |
4841 | 456 | virtual bool glDraw (const GLMatrix &matrix, | 844 | virtual bool glDraw (const GLMatrix &matrix, |
4843 | 457 | GLFragment::Attrib &attrib, | 845 | const GLWindowPaintAttrib &attrib, |
4844 | 458 | const CompRegion ®ion, | 846 | const CompRegion ®ion, |
4845 | 459 | unsigned int mask); | 847 | unsigned int mask); |
4846 | 460 | 848 | ||
4847 | @@ -479,51 +867,18 @@ | |||
4848 | 479 | const CompRegion &clipRegion, | 867 | const CompRegion &clipRegion, |
4849 | 480 | unsigned int min = MAXSHORT, | 868 | unsigned int min = MAXSHORT, |
4850 | 481 | unsigned int max = MAXSHORT); | 869 | unsigned int max = MAXSHORT); |
4854 | 482 | virtual void glDrawTexture (GLTexture *texture, GLFragment::Attrib &, | 870 | virtual void glDrawTexture (GLTexture *texture, const GLMatrix &, |
4855 | 483 | unsigned int); | 871 | const GLWindowPaintAttrib &, unsigned int); |
4853 | 484 | virtual void glDrawGeometry (); | ||
4856 | 485 | }; | 872 | }; |
4857 | 486 | 873 | ||
4858 | 487 | class GLWindow : | 874 | class GLWindow : |
4860 | 488 | public WrapableHandler<GLWindowInterface, 5>, | 875 | public WrapableHandler<GLWindowInterface, 4>, |
4861 | 489 | public PluginClassHandler<GLWindow, CompWindow, COMPIZ_OPENGL_ABI> | 876 | public PluginClassHandler<GLWindow, CompWindow, COMPIZ_OPENGL_ABI> |
4862 | 490 | { | 877 | { |
4863 | 491 | public: | 878 | public: |
4864 | 492 | 879 | ||
4865 | 493 | /** | ||
4866 | 494 | * Class which describes the texture geometry and transformation points | ||
4867 | 495 | * of a window | ||
4868 | 496 | */ | ||
4869 | 497 | class Geometry { | ||
4870 | 498 | public: | ||
4871 | 499 | Geometry (); | ||
4872 | 500 | ~Geometry (); | ||
4873 | 501 | |||
4874 | 502 | void reset (); | ||
4875 | 503 | |||
4876 | 504 | /** | ||
4877 | 505 | * Set the number of vertices in the texture geometry | ||
4878 | 506 | */ | ||
4879 | 507 | bool moreVertices (int newSize); | ||
4880 | 508 | |||
4881 | 509 | /** | ||
4882 | 510 | * Set the number of indices in the texture geometry | ||
4883 | 511 | */ | ||
4884 | 512 | bool moreIndices (int newSize); | ||
4885 | 513 | |||
4886 | 514 | public: | ||
4887 | 515 | GLfloat *vertices; | ||
4888 | 516 | int vertexSize; | ||
4889 | 517 | int vertexStride; | ||
4890 | 518 | GLushort *indices; | ||
4891 | 519 | int indexSize; | ||
4892 | 520 | int vCount; | ||
4893 | 521 | int texUnits; | ||
4894 | 522 | int texCoordSize; | ||
4895 | 523 | int indexCount; | ||
4896 | 524 | }; | ||
4897 | 525 | |||
4898 | 526 | static GLWindowPaintAttrib defaultPaintAttrib; | 880 | static GLWindowPaintAttrib defaultPaintAttrib; |
4899 | 881 | |||
4900 | 527 | public: | 882 | public: |
4901 | 528 | 883 | ||
4902 | 529 | GLWindow (CompWindow *w); | 884 | GLWindow (CompWindow *w); |
4903 | @@ -566,9 +921,20 @@ | |||
4904 | 566 | void updatePaintAttribs (); | 921 | void updatePaintAttribs (); |
4905 | 567 | 922 | ||
4906 | 568 | /** | 923 | /** |
4910 | 569 | * Returns the window texture geometry | 924 | * Returns the window vertex buffer object |
4911 | 570 | */ | 925 | */ |
4912 | 571 | Geometry & geometry (); | 926 | GLVertexBuffer * vertexBuffer (); |
4913 | 927 | |||
4914 | 928 | /** | ||
4915 | 929 | * Add a vertex and/or fragment shader function to the pipeline. | ||
4916 | 930 | * | ||
4917 | 931 | * @param name Name of the plugin adding the functions | ||
4918 | 932 | * @param vertex_shader Function to add to the vertex shader | ||
4919 | 933 | * @param fragment_shader Function to add to the fragment shader | ||
4920 | 934 | */ | ||
4921 | 935 | void addShaders (std::string name, | ||
4922 | 936 | std::string vertex_shader, | ||
4923 | 937 | std::string fragment_shader); | ||
4924 | 572 | 938 | ||
4925 | 573 | GLTexture *getIcon (int width, int height); | 939 | GLTexture *getIcon (int width, int height); |
4926 | 574 | 940 | ||
4927 | @@ -576,14 +942,15 @@ | |||
4928 | 576 | const GLWindowPaintAttrib &, const GLMatrix &, | 942 | const GLWindowPaintAttrib &, const GLMatrix &, |
4929 | 577 | const CompRegion &, unsigned int); | 943 | const CompRegion &, unsigned int); |
4930 | 578 | WRAPABLE_HND (1, GLWindowInterface, bool, glDraw, const GLMatrix &, | 944 | WRAPABLE_HND (1, GLWindowInterface, bool, glDraw, const GLMatrix &, |
4932 | 579 | GLFragment::Attrib &, const CompRegion &, unsigned int); | 945 | const GLWindowPaintAttrib &, const CompRegion &, |
4933 | 946 | unsigned int); | ||
4934 | 580 | WRAPABLE_HND (2, GLWindowInterface, void, glAddGeometry, | 947 | WRAPABLE_HND (2, GLWindowInterface, void, glAddGeometry, |
4935 | 581 | const GLTexture::MatrixList &, const CompRegion &, | 948 | const GLTexture::MatrixList &, const CompRegion &, |
4936 | 582 | const CompRegion &, | 949 | const CompRegion &, |
4937 | 583 | unsigned int = MAXSHORT, unsigned int = MAXSHORT); | 950 | unsigned int = MAXSHORT, unsigned int = MAXSHORT); |
4938 | 584 | WRAPABLE_HND (3, GLWindowInterface, void, glDrawTexture, | 951 | WRAPABLE_HND (3, GLWindowInterface, void, glDrawTexture, |
4941 | 585 | GLTexture *texture, GLFragment::Attrib &, unsigned int); | 952 | GLTexture *texture, const GLMatrix &, |
4942 | 586 | WRAPABLE_HND (4, GLWindowInterface, void, glDrawGeometry); | 953 | const GLWindowPaintAttrib &, unsigned int); |
4943 | 587 | 954 | ||
4944 | 588 | friend class GLScreen; | 955 | friend class GLScreen; |
4945 | 589 | friend class PrivateGLScreen; | 956 | friend class PrivateGLScreen; |
4946 | @@ -593,3 +960,4 @@ | |||
4947 | 593 | }; | 960 | }; |
4948 | 594 | 961 | ||
4949 | 595 | #endif | 962 | #endif |
4950 | 963 | |||
4951 | 596 | 964 | ||
4952 | === added file 'plugins/opengl/include/opengl/program.h' | |||
4953 | --- plugins/opengl/include/opengl/program.h 1970-01-01 00:00:00 +0000 | |||
4954 | +++ plugins/opengl/include/opengl/program.h 2012-08-22 06:16:22 +0000 | |||
4955 | @@ -0,0 +1,75 @@ | |||
4956 | 1 | /* | ||
4957 | 2 | * Copyright © 2011 Linaro Ltd. | ||
4958 | 3 | * | ||
4959 | 4 | * Permission to use, copy, modify, distribute, and sell this software | ||
4960 | 5 | * and its documentation for any purpose is hereby granted without | ||
4961 | 6 | * fee, provided that the above copyright notice appear in all copies | ||
4962 | 7 | * and that both that copyright notice and this permission notice | ||
4963 | 8 | * appear in supporting documentation, and that the name of | ||
4964 | 9 | * Linaro Ltd. not be used in advertising or publicity pertaining to | ||
4965 | 10 | * distribution of the software without specific, written prior permission. | ||
4966 | 11 | * Linaro Ltd. makes no representations about the suitability of this | ||
4967 | 12 | * software for any purpose. It is provided "as is" without express or | ||
4968 | 13 | * implied warranty. | ||
4969 | 14 | * | ||
4970 | 15 | * LINARO LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
4971 | 16 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN | ||
4972 | 17 | * NO EVENT SHALL LINARO LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
4973 | 18 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS | ||
4974 | 19 | * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | ||
4975 | 20 | * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | ||
4976 | 21 | * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
4977 | 22 | * | ||
4978 | 23 | * Authors: Travis Watkins <travis.watkins@linaro.org> | ||
4979 | 24 | */ | ||
4980 | 25 | |||
4981 | 26 | #ifndef _COMPIZ_GLPROGRAM_H | ||
4982 | 27 | #define _COMPIZ_GLPROGRAM_H | ||
4983 | 28 | |||
4984 | 29 | #ifdef USE_GLES | ||
4985 | 30 | #include <GLES2/gl2.h> | ||
4986 | 31 | #else | ||
4987 | 32 | #include <GL/gl.h> | ||
4988 | 33 | #endif | ||
4989 | 34 | |||
4990 | 35 | #include <core/core.h> | ||
4991 | 36 | #include <opengl/matrix.h> | ||
4992 | 37 | |||
4993 | 38 | class PrivateProgram; | ||
4994 | 39 | |||
4995 | 40 | class GLProgram | ||
4996 | 41 | { | ||
4997 | 42 | public: | ||
4998 | 43 | GLProgram (CompString &vertexShader, CompString &fragmentShader); | ||
4999 | 44 | ~GLProgram (); | ||
5000 | 45 |
The diff is quite large, however it should be possible still to do a code review:
+static bool invert ())
+unproject (float winx, float winy, float winz,
+ const GLMatrix &modelview,
+ const GLMatrix &projection,
+ const GLint viewport[4],
+ float *objx, float *objy, float *objz)
+{
+ GLMatrix finalMatrix = projection * modelview;
+ float in[4], out[4];
+
+ if (!finalMatrix.
+ return false;
+
+ in[0] = winx;
+ in[1] = winy;
+ in[2] = winz;
+ in[3] = 1.0;
+
+ /* Map x and y from window coordinates */
+ in[0] = (in[0] - viewport[0]) / viewport[2];
+ in[1] = (in[1] - viewport[1]) / viewport[3];
+
+ /* Map to range -1 to 1 */
+ in[0] = in[0] * 2 - 1;
+ in[1] = in[1] * 2 - 1;
+ in[2] = in[2] * 2 - 1;
+
+ for (int i = 0; i < 4; i++)
+ {
+ out[i] = in[0] * finalMatrix[i] +
+ in[1] * finalMatrix[4 + i] +
+ in[2] * finalMatrix[8 + i] +
+ in[3] * finalMatrix[12 + i];
+ }
+
+ if (out[3] == 0.0)
+ return false;
+
+ out[0] /= out[3];
+ out[1] /= out[3];
+ out[2] /= out[3];
+
+ *objx = out[0];
+ *objy = out[1];
+ *objz = out[2];
+
+ return true;
+}
+
+static bool
+project (float objx, float objy, float objz,
+ const float modelview[16], const float projection[16],
+ const GLint viewport[4],
+ float *winx, float *winy, float *winz)
+{
+ unsigned int i;
+ float in[4];
+ float out[4];
+
+ in[0] = objx;
+ in[1] = objy;
+ in[2] = objz;
+ in[3] = 1.0;
+
+ for (i = 0; i < 4; i++) {
+ out[i] =
+ in[0] * modelview[i] +
+ in[1] * modelview[4 + i] +
+ in[2] * modelview[8 + i] +
+ in[3] * modelview[12 + i];
+ }
+
+ for (i = 0; i < 4; i++) {
+ in[i] =
+ out[0] * projection[i] +
+ out[1] * projection[4 + i] +
+ out[2] * projection[8 + i] +
+ out[3] * projection[12 + i];
+ }
+
+ if (in[3] == 0.0)
+ return false;
+
+ in[0] /= in[3];
+ in[1] /= in[3];
+ in[2] /= in[3];
+ /* Map x, y and z to range 0-1 */
+ in[0] = in[0] * 0.5 + 0.5;
+ in[1] = in[1] * 0.5 + 0.5;
+ in[2] = in[2] * 0.5 + 0.5;
+
+ /* Map x,y to viewport */
+ in[0] = in[0] * viewport[2] + viewport[0];
+ in[1] = in[1] * viewport[3] + viewport[1];
+
+ *winx = in[0];
+ *winy = in[1];
+ *winz = in[2];
+ return true;
+}
This is re-usable in cube and should be put somewhere. GLMatrix?
=== added file 'cmake/ FindOpenGLES2. cmake' LES2.cmake 1970-01-01 00:00:00 +0000 LES2.cmake 2012-08-10 08:27:48 +0000 INCLUDE_ DIR - the GLES include directory OPENGLES2_ INCLUDE_ DIR GLES2/gl2.h share/include OpenGL/ include /usr/X11R6/include OPENGLES2_ LIBRARY OpenGL/ lib
--- cmake/FindOpenG
+++ cmake/FindOpenG
@@ -0,0 +1,51 @@
+# - Try to find OpenGLES
+# Once done this will define
+#
+# OPENGLES2_FOUND - system has OpenGLES
+# OPENGLES2_
+# OPENGLES2_LIBRARY - the GLES library
+# OPENGLES2_LIBRARIES - Link this to use OpenGLES
+#
+
+FIND_PATH(
+ /usr/openwin/
+ /opt/graphics/
+ /usr/include
+)
+
+FIND_LIBRARY(
+ NAMES GLESv2
+ PATHS /opt/graphics/
+ /usr/openwin/lib
+ /usr/shlib /usr/X11R6/lib
+ /usr/lib
+)
+
+FIND_L...