19ccb72b80
When the CoglGLES2Context is bound to read from a CoglOffscreen then the result will be upside down from what GL expects if glCopyTexImage2D is used directly. To fix that, this patch now wraps glCopyTexImage2D and glCopyTexSubImage2D so that the copy is doing by binding an FBO to the target texture and then rendering a quad sampling from the texture in the offscreen framebuffer. The rendering is done using the Cogl context rather than the GLES2 context because otherwise it would have to do a fair bit of work to try and stash the old state on the context before setting up the state to do the blit. The down side of this is that the contexts need to be synchronized so that the rendering will be up-to-date. As far as I understand from the GL spec, this requires a glFinish and then the texture needs to be rebound in the new context because updates to shared objects are guaranteed to be reflected until the object is rebound. GLES2 supports using glCopyTexImage2D for cube map textures. As Cogl doesn't currently have support for cube maps, it is quite hard to get that to work with this patch. For now attempts to copy to a cube map texture will just be sliently ignored. This patch also includes a test case which renders an image to the framebuffer and then copies it to a texture. The texture is then rendered back to the framebuffer and the contents are checked for the correct orientation using glReadPixels. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 30b6da8134bad95267265e26685c7475f6c351c9) |
||
---|---|---|
.. | ||
config.env.in | ||
Makefile.am | ||
run-tests.sh | ||
test-atlas-migration.c | ||
test-backface-culling.c | ||
test-bitmask.c | ||
test-blend-strings.c | ||
test-color-mask.c | ||
test-conform-main.c | ||
test-custom-attributes.c | ||
test-depth-test.c | ||
test-euler-quaternion.c | ||
test-fixed.c | ||
test-fixtures.c | ||
test-gles2-context.c | ||
test-just-vertex-shader.c | ||
test-launcher.sh.in | ||
test-layer-remove.c | ||
test-materials.c | ||
test-multitexture.c | ||
test-no-gl-header.c | ||
test-npot-texture.c | ||
test-object.c | ||
test-offscreen.c | ||
test-path.c | ||
test-pipeline-uniforms.c | ||
test-pipeline-user-matrix.c | ||
test-pixel-buffer.c | ||
test-point-size.c | ||
test-point-sprite.c | ||
test-premult.c | ||
test-primitive.c | ||
test-read-texture-formats.c | ||
test-readpixels.c | ||
test-snippets.c | ||
test-sparse-pipeline.c | ||
test-sub-texture.c | ||
test-texture-3d.c | ||
test-texture-get-set-data.c | ||
test-texture-mipmaps.c | ||
test-texture-pixmap-x11.c | ||
test-texture-rectangle.c | ||
test-utils.c | ||
test-utils.h | ||
test-version.c | ||
test-vertex-buffer-contiguous.c | ||
test-vertex-buffer-interleved.c | ||
test-vertex-buffer-mutability.c | ||
test-viewport.c | ||
test-wrap-modes.c | ||
test-write-texture-formats.c |