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