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