diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-09-17 08:04:36 +0200 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-09-17 09:59:50 +0200 |
commit | 079c861f08d27aa8b6368aebc37f235979049286 (patch) | |
tree | 835917e048fe884135f8fbea373579c20e7ac81d /include/vcl/opengl | |
parent | b3d50feaa87b670baf68288974005ac26ad31736 (diff) |
fdo#81237: 2D OpenGL charts was upside-down
The problem is that LO drawinglayer uses a coordinate system
with an origin at the top-left corner of the screen, while
OpenGL uses a complete coordinate system (with all four
quarters, e.g.: allows negative values). The points in
LO are always positive values which means they are drawn
in the first quarter of the OpenGL coordinate system which
also means that the origin is at the bottom-left corner
of the scene. This difference causes the flipped scene.
* To solve that problem scale the projection matrix with -1.0f
along the y axis.
* glDisable(GL_CULL_FACE) is necessary to avoid dropping primitives
after scaling with -1.0.
* Since projection matrix mirrors also the textures we don't need to
do that inside the ConvertBitmapExToRGBATextureBuffer() method.
Change-Id: Ieba642f3e665778a12368fe50a20865ec8f73514
Diffstat (limited to 'include/vcl/opengl')
-rw-r--r-- | include/vcl/opengl/OpenGLHelper.hxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx index f4ed8ea288d3..8c04e320d4be 100644 --- a/include/vcl/opengl/OpenGLHelper.hxx +++ b/include/vcl/opengl/OpenGLHelper.hxx @@ -25,9 +25,9 @@ public: * The caller is responsible for allocate the memory for the RGBA buffer, before call * this method. RGBA buffer size is assumed to be 4*width*height. * Since OpenGL uses textures flipped relative to BitmapEx storage this method - * also mirrors the bitmap vertically. + * also adds the possibility to mirror the bitmap vertically at the same time. **/ - static void ConvertBitmapExToRGBATextureBuffer(const BitmapEx& rBitmapEx, sal_uInt8* o_pRGBABuffer); + static void ConvertBitmapExToRGBATextureBuffer(const BitmapEx& rBitmapEx, sal_uInt8* o_pRGBABuffer, const bool bFlip = false); static BitmapEx ConvertBGRABufferToBitmapEx(const sal_uInt8* const pBuffer, long nWidth, long nHeight); static void renderToFile(long nWidth, long nHeight, const OUString& rFileName); |