LibreOffice Module vcl (master) 1
OpenGLContext.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10#pragma once
11
12#include <vcl/dllapi.h>
13#include <vcl/sysdata.hxx>
14#include <vcl/vclptr.hxx>
15#include <rtl/ref.hxx>
16
17class Point;
18class Size;
20namespace vcl { class Window; }
21
24{
25 unsigned int Width;
26 unsigned int Height;
28
30 : Width(0)
31 , Height(0)
32 , bMultiSampleSupported(false)
33 {
34 }
35
36 virtual bool Synchronize(bool bOnoff) const;
37
38 virtual ~GLWindow();
39};
40
42{
43 friend class OpenGLTests;
44protected:
46public:
48 virtual ~OpenGLContext();
49
50 // Avoid implicitly defined copy constructors/assignments for the DLLPUBLIC class (they may
51 // require forward-declared classes used internally to be defined in places using OpenGLContext)
52 OpenGLContext(const OpenGLContext&) = delete;
56
57 void acquire() { mnRefCount++; }
58 void release() { if ( --mnRefCount == 0 ) delete this; }
59 void dispose();
60
61 void requestLegacyContext();
62
63 bool init(vcl::Window* pParent);
64
65 void reset();
66
68 virtual bool isCurrent();
70 virtual bool isAnyCurrent();
72 static void clearCurrent();
74 static void prepareForYield();
76 static bool hasCurrent();
77
79 virtual void makeCurrent();
81 void registerAsCurrent();
83 virtual void resetCurrent();
85 virtual void restoreDefaultFramebuffer();
86 virtual void swapBuffers();
87 virtual void sync();
88 void show();
89
90 void setWinPosAndSize(const Point &rPos, const Size& rSize);
91 virtual const GLWindow& getOpenGLWindow() const = 0;
92
93 SystemChildWindow* getChildWindow();
94 const SystemChildWindow* getChildWindow() const;
95
96 bool isInitialized() const
97 {
98 return mbInitialized;
99 }
100
101 virtual SystemWindowData generateWinData(vcl::Window* pParent, bool bRequestLegacyContext);
102
103private:
104 virtual void initWindow();
105 virtual void destroyCurrentContext();
106 virtual void adjustToNewSize();
107
108protected:
109 bool InitGL();
110 static void InitGLDebugging();
111 static void InitChildWindow(SystemChildWindow *pChildWindow);
112 static void BuffersSwapped();
114 virtual bool ImplInit();
115
117 VclPtr<vcl::Window> mpWindow; //points to m_pWindow or the parent window, don't delete it
122
123public:
124
125 // Don't hold references to ourselves:
128};
129
130/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool mbInitialized
FILE * init(int, char **)
virtual const GLWindow & getOpenGLWindow() const =0
VclPtr< SystemChildWindow > m_pChildWindow
OpenGLContext & operator=(const OpenGLContext &)=delete
OpenGLContext * mpPrevContext
bool isInitialized() const
OpenGLContext & operator=(OpenGLContext &&)=delete
VclPtr< vcl::Window > m_xWindow
bool mbRequestLegacyContext
VclPtr< vcl::Window > mpWindow
virtual GLWindow & getModifiableOpenGLWindow()=0
OpenGLContext(OpenGLContext &&)=delete
OpenGLContext * mpNextContext
OpenGLContext(const OpenGLContext &)=delete
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
void dispose()
Holds the information of our new child window.
unsigned int Width
unsigned int Height
bool bMultiSampleSupported