2014-04-15 00:55:07 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
2014-04-18 18:21:34 +02:00
|
|
|
#ifndef INCLUDED_VCL_OPENGL_OPENGLHELPER_HXX
|
|
|
|
#define INCLUDED_VCL_OPENGL_OPENGLHELPER_HXX
|
2014-04-15 00:55:07 +02:00
|
|
|
|
|
|
|
#include <GL/glew.h>
|
2014-05-11 18:04:01 +02:00
|
|
|
#include "glm/glm.hpp"
|
2014-04-15 00:55:07 +02:00
|
|
|
#include <vcl/vclopengl_dllapi.hxx>
|
2014-04-18 15:24:25 +02:00
|
|
|
#include <vcl/bitmapex.hxx>
|
2014-04-15 00:55:07 +02:00
|
|
|
|
|
|
|
#include <rtl/ustring.hxx>
|
|
|
|
|
2014-05-11 18:04:01 +02:00
|
|
|
#include <ostream>
|
|
|
|
|
2014-04-15 00:55:07 +02:00
|
|
|
class VCLOPENGL_DLLPUBLIC OpenGLHelper
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName);
|
|
|
|
|
2014-04-18 15:24:25 +02:00
|
|
|
static sal_uInt8* ConvertBitmapExToRGBABuffer(const BitmapEx& rBitmapEx);
|
2014-04-27 20:25:52 +02:00
|
|
|
static BitmapEx ConvertBGRABufferToBitmapEx(const sal_uInt8* const pBuffer, long nWidth, long nHeight);
|
2014-05-09 00:31:05 +02:00
|
|
|
static void renderToFile(long nWidth, long nHeight, const OUString& rFileName);
|
2014-04-29 08:27:58 +03:00
|
|
|
|
|
|
|
static const char* GLErrorString(GLenum errorCode);
|
2014-05-21 00:41:37 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The caller is responsible for deleting the buffer objects identified by
|
2014-05-21 14:23:07 +02:00
|
|
|
* nFramebufferId, nRenderbufferDepthId and nRenderbufferColorId
|
2014-05-21 00:41:37 +02:00
|
|
|
*/
|
|
|
|
static void createFramebuffer(long nWidth, long nHeight,
|
2014-05-21 14:23:07 +02:00
|
|
|
GLuint& nFramebufferId, GLuint& nRenderbufferTextId, GLuint& nRenderbufferColorId);
|
2014-04-15 00:55:07 +02:00
|
|
|
};
|
|
|
|
|
2014-05-11 18:04:01 +02:00
|
|
|
VCLOPENGL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStrm, const glm::mat4& rMatrix);
|
|
|
|
VCLOPENGL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStrm, const glm::vec4& rPos);
|
|
|
|
|
2014-04-15 00:55:07 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|