From f0bd1c6980e52f212ed95820420acfd0bcdf3cca Mon Sep 17 00:00:00 2001 From: Zolnai Tamás Date: Sun, 27 Apr 2014 14:17:05 +0200 Subject: OGFrameGrabber: use a BGRA buffer Change-Id: Ie827ba98a6ff65d63eb61df1d90e18919de86395 --- external/libgltf/UnpackedTarball_libgltf.mk | 1 + .../patches/format_parameter_for_bitmap.patch | 68 ++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 external/libgltf/patches/format_parameter_for_bitmap.patch (limited to 'external/libgltf') diff --git a/external/libgltf/UnpackedTarball_libgltf.mk b/external/libgltf/UnpackedTarball_libgltf.mk index dd28b67422fc..6e6157dbc939 100644 --- a/external/libgltf/UnpackedTarball_libgltf.mk +++ b/external/libgltf/UnpackedTarball_libgltf.mk @@ -26,6 +26,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,libgltf,\ external/libgltf/patches/avoid_c++11.patch \ external/libgltf/patches/json_charbuffer_used_as_cstring.patch \ external/libgltf/patches/shader_charbuffer_used_as_cstring.patch \ + external/libgltf/patches/format_parameter_for_bitmap.patch \ )) # vim: set noet sw=4 ts=4: diff --git a/external/libgltf/patches/format_parameter_for_bitmap.patch b/external/libgltf/patches/format_parameter_for_bitmap.patch new file mode 100644 index 000000000000..526e95834cea --- /dev/null +++ b/external/libgltf/patches/format_parameter_for_bitmap.patch @@ -0,0 +1,68 @@ +diff -ur libgltf.org/inc/libgltf.h libgltf/inc/libgltf.h +--- libgltf.org/inc/libgltf.h 2014-04-27 14:10:06.191988313 +0200 ++++ libgltf/inc/libgltf.h 2014-04-27 14:12:03.171983919 +0200 +@@ -47,7 +47,7 @@ + /** Get a bitmap of the screen in the given point in time. */ + extern "C" + void gltf_renderer_get_bitmap(glTFHandle *handle, double time, +- char* buffer, long width, long height); ++ char* buffer, long width, long height, GLenum format); + + /** Start playing the glTF animation to the current openGLcontext. */ + extern "C" +@@ -80,4 +80,4 @@ + /** Query where exactly the animation is, in seconds. */ + extern "C" + double gltf_animation_get_time(glTFHandle *handle); +-#endif +\ No newline at end of file ++#endif +diff -ur libgltf.org/src/libgltf.cpp libgltf/src/libgltf.cpp +--- libgltf.org/src/libgltf.cpp 2014-04-27 14:10:06.192988313 +0200 ++++ libgltf/src/libgltf.cpp 2014-04-27 14:12:06.648983788 +0200 +@@ -70,10 +70,10 @@ + + extern "C" + void gltf_renderer_get_bitmap(glTFHandle *handle, double time, +- char* buffer, long width, long height) ++ char* buffer, long width, long height, GLenum format) + { + class RenderScene* renderScene = (RenderScene*)handle->renderer; +- renderScene->renderToBuffer(&(handle->viewport), (unsigned char*)buffer); ++ renderScene->renderToBuffer(&(handle->viewport), (unsigned char*)buffer, format); + return; + } + +diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp +--- libgltf.org/src/RenderScene.cpp 2014-04-27 14:10:06.192988313 +0200 ++++ libgltf/src/RenderScene.cpp 2014-04-27 14:11:03.199986172 +0200 +@@ -630,7 +630,7 @@ + return pCamera; + } + +-void RenderScene::renderToBuffer(glTFViewport* pViewport, unsigned char * buffer) ++void RenderScene::renderToBuffer(glTFViewport* pViewport, unsigned char * buffer, GLenum format) + { + createRenderObj(pViewport->width, pViewport->height); + createTextureObj(pViewport->width, pViewport->height); +@@ -647,7 +647,7 @@ + GLenum fbResult = glCheckFramebufferStatus(GL_FRAMEBUFFER); + if( fbResult != GL_FRAMEBUFFER_COMPLETE ) + result = false; +- glReadPixels(0, 0, pViewport->width, pViewport->height, GL_BGR, ++ glReadPixels(0, 0, pViewport->width, pViewport->height, format, + GL_UNSIGNED_BYTE, buffer); + glBindFramebuffer(GL_FRAMEBUFFER, 0); + glDeleteFramebuffers(1, &mFBOID); +diff -ur libgltf.org/src/RenderScene.h libgltf/src/RenderScene.h +--- libgltf.org/src/RenderScene.h 2014-04-27 14:10:06.192988313 +0200 ++++ libgltf/src/RenderScene.h 2014-04-27 14:13:41.291980233 +0200 +@@ -91,7 +91,7 @@ + void render(void* lpParam); + void releaseRender(void* lpParam); + CPhysicalCamera* getCamera(); +- void renderToBuffer(glTFViewport* pViewpoit, unsigned char * buffer); ++ void renderToBuffer(glTFViewport* pViewpoit, unsigned char * buffer, GLenum format); + void renderRotateCamera(double horizontal, double vertical, + double planar, double time); + void renderMoveCamera(double x, double y, double z, double time); -- cgit