LibreOffice Module vcl (master)
1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
include
vcl
opengl
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
#ifndef INCLUDED_VCL_OPENGL_OPENGLCONTEXT_HXX
11
#define INCLUDED_VCL_OPENGL_OPENGLCONTEXT_HXX
12
13
#include <epoxy/gl.h>
14
15
#include <
vcl/dllapi.h
>
16
#include <
vcl/syschild.hxx
>
17
#include <rtl/ref.hxx>
18
19
#include <memory>
20
#include <unordered_map>
21
23
struct
VCL_DLLPUBLIC
GLWindow
24
{
25
unsigned
int
Width
;
26
unsigned
int
Height
;
27
bool
bMultiSampleSupported
;
28
29
GLWindow
()
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
41
class
VCL_DLLPUBLIC
OpenGLContext
42
{
43
friend
class
OpenGLTests;
44
protected
:
45
OpenGLContext
();
46
public
:
47
static
rtl::Reference<OpenGLContext>
Create
();
48
virtual
~
OpenGLContext
();
49
void
acquire
() { mnRefCount++; }
50
void
release
() {
if
( --mnRefCount == 0 )
delete
this
; }
51
void
dispose
();
52
53
void
requestLegacyContext();
54
55
bool
init
(
vcl::Window
* pParent);
56
57
void
reset();
58
60
virtual
bool
isCurrent();
62
virtual
bool
isAnyCurrent();
64
static
void
clearCurrent();
66
static
void
prepareForYield();
68
static
bool
hasCurrent();
69
71
virtual
void
makeCurrent();
73
void
registerAsCurrent();
75
virtual
void
resetCurrent();
77
virtual
void
restoreDefaultFramebuffer();
78
virtual
void
swapBuffers();
79
virtual
void
sync();
80
void
show();
81
82
void
setWinPosAndSize(
const
Point &rPos,
const
Size
& rSize);
83
virtual
const
GLWindow
& getOpenGLWindow()
const
= 0;
84
85
SystemChildWindow
* getChildWindow();
86
const
SystemChildWindow
* getChildWindow()
const
;
87
88
bool
isInitialized
()
const
89
{
90
return
mbInitialized
;
91
}
92
93
virtual
SystemWindowData
generateWinData(
vcl::Window
* pParent,
bool
bRequestLegacyContext);
94
95
private
:
96
virtual
void
initWindow();
97
virtual
void
destroyCurrentContext();
98
virtual
void
adjustToNewSize();
99
100
protected
:
101
bool
InitGL();
102
static
void
InitGLDebugging();
103
static
void
InitChildWindow(
SystemChildWindow
*pChildWindow);
104
static
void
BuffersSwapped();
105
virtual
GLWindow
& getModifiableOpenGLWindow() = 0;
106
virtual
bool
ImplInit();
107
108
VclPtr<vcl::Window>
m_xWindow
;
109
VclPtr<vcl::Window>
mpWindow
;
//points to m_pWindow or the parent window, don't delete it
110
VclPtr<SystemChildWindow>
m_pChildWindow
;
111
bool
mbInitialized
;
112
int
mnRefCount
;
113
bool
mbRequestLegacyContext
;
114
115
public
:
116
117
// Don't hold references to ourselves:
118
OpenGLContext
*
mpPrevContext
;
119
OpenGLContext
*
mpNextContext
;
120
};
121
122
#endif
123
124
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
GLWindow::bMultiSampleSupported
bool bMultiSampleSupported
Definition:
OpenGLContext.hxx:27
rtl::Reference< OpenGLContext >
VclPtr< vcl::Window >
OpenGLContext::mpNextContext
OpenGLContext * mpNextContext
Definition:
OpenGLContext.hxx:119
Create
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
VCL_DLLPUBLIC
#define VCL_DLLPUBLIC
Definition:
dllapi.h:29
GLWindow::Height
unsigned int Height
Definition:
OpenGLContext.hxx:26
mbInitialized
bool mbInitialized
OpenGLContext::acquire
void acquire()
Definition:
OpenGLContext.hxx:49
OpenGLContext::mnRefCount
int mnRefCount
Definition:
OpenGLContext.hxx:112
OpenGLContext::mbRequestLegacyContext
bool mbRequestLegacyContext
Definition:
OpenGLContext.hxx:113
OpenGLContext::isInitialized
bool isInitialized() const
Definition:
OpenGLContext.hxx:88
vcl::Window
Definition:
window.hxx:481
Size
syschild.hxx
GLWindow
Holds the information of our new child window.
Definition:
OpenGLContext.hxx:23
OpenGLContext
Definition:
OpenGLContext.hxx:41
dllapi.h
SystemChildWindow
Definition:
syschild.hxx:29
OpenGLContext::mpPrevContext
OpenGLContext * mpPrevContext
Definition:
OpenGLContext.hxx:118
GLWindow::Width
unsigned int Width
Definition:
OpenGLContext.hxx:25
ViewOptFlags1::Synchronize
OpenGLContext::m_xWindow
VclPtr< vcl::Window > m_xWindow
Definition:
OpenGLContext.hxx:108
init
FILE * init(int, char **)
OpenGLContext::release
void release()
Definition:
OpenGLContext.hxx:50
OpenGLContext::m_pChildWindow
VclPtr< SystemChildWindow > m_pChildWindow
Definition:
OpenGLContext.hxx:110
dispose
void dispose()
GLWindow::GLWindow
GLWindow()
Definition:
OpenGLContext.hxx:29
SystemWindowData
Definition:
sysdata.hxx:183
OpenGLContext::mbInitialized
bool mbInitialized
Definition:
OpenGLContext.hxx:111
OpenGLContext::mpWindow
VclPtr< vcl::Window > mpWindow
Definition:
OpenGLContext.hxx:109
Generated on Sat Feb 27 2021 02:50:15 for LibreOffice Module vcl (master) by
1.8.10