HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
RE_ContextSpecificObject.h
Go to the documentation of this file.
1
/*
2
* PROPRIETARY INFORMATION. This software is proprietary to
3
* Side Effects Software Inc., and is not to be reproduced,
4
* transmitted, or disclosed in any way without written permission.
5
*
6
* NAME: RE_ContextSpecificObject.h ( RE Library, C++)
7
*
8
* COMMENTS:
9
* This base class is for OpenGL objects that are context-specific,
10
* rather than shared. Example objects are:
11
*
12
* - Vertex Array Objects
13
* - Occlusion Query Objects
14
* - Timer Objects
15
*
16
* These objects are defined to be non-sharable by the OpenGL spec, even
17
* if two contexts belong to the same share-set.
18
*/
19
#ifndef RE_ContextSpecificObject_h
20
#define RE_ContextSpecificObject_h
21
22
#include "
RE_API.h
"
23
#include "
RE_Render.h
"
24
#include "
RE_Server.h
"
25
#include <
UT/UT_Assert.h
>
26
#include <
UT/UT_NonCopyable.h
>
27
28
class
RE_API
RE_ContextSpecificObject
29
{
30
public
:
31
RE_ContextSpecificObject
() : myContext(nullptr) {}
32
virtual
~RE_ContextSpecificObject
() {}
33
34
UT_NON_COPYABLE
(
RE_ContextSpecificObject
)
35
36
virtual
bool
init(
RE_Render
*
r
) = 0;
37
38
void
initContext(
RE_Render
*r);
39
bool
matchesContext(
RE_Render
*r) const;
40
void
clearContext() { myContext =
nullptr
; }
41
42
protected
:
43
RE_Render
*getMyRender();
44
45
// Call in subclasses to ensure that the incoming render context matches
46
// the context this object was created with.
47
bool
initOrCheckRender
(
RE_Render
*
r
)
48
{
49
UT_ASSERT
(r);
50
51
auto
render_context = (
RE_Server::useNewWindowDrawable
()
52
? r->
getDrawableContext
() : r->
getContext
());
53
54
if
(myContext ==
nullptr
)
55
{
56
myContext = render_context;
57
return
true
;
58
}
59
else
if
(myContext == render_context)
60
return
true
;
61
62
UT_ASSERT
(!
"Mismatched GL context with context-specific object"
);
63
return
false
;
64
}
65
66
private
:
67
RE_OGLContext
myContext;
68
};
69
70
// To be used within derived classes.
71
#define RE_CONTEXT_CHECK(r) UT_ASSERT(matchesContext(r))
72
73
#endif
RE_Server.h
RE_API.h
RE_API
#define RE_API
Definition:
RE_API.h:10
RE_OGLRender::getDrawableContext
RE_OGLContext getDrawableContext() const
UT_Assert.h
RE_Render.h
RE_Render
Definition:
RE_Render.h:29
UT_NON_COPYABLE
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
Definition:
UT_NonCopyable.h:31
UT_NonCopyable.h
RE_OGLRender::getContext
RE_OGLContext getContext() const
Definition:
RE_OGLRender.h:290
RE_ContextSpecificObject
Definition:
RE_ContextSpecificObject.h:28
RE_ContextSpecificObject::~RE_ContextSpecificObject
virtual ~RE_ContextSpecificObject()
Definition:
RE_ContextSpecificObject.h:32
RE_ContextSpecificObject::initOrCheckRender
bool initOrCheckRender(RE_Render *r)
Definition:
RE_ContextSpecificObject.h:47
RE_Server::useNewWindowDrawable
static bool useNewWindowDrawable()
UT_ASSERT
#define UT_ASSERT(ZZ)
Definition:
UT_Assert.h:156
r
GLboolean r
Definition:
glcorearb.h:1222
RE_ContextSpecificObject::RE_ContextSpecificObject
RE_ContextSpecificObject()
Definition:
RE_ContextSpecificObject.h:31
RE_OGLContext
QOpenGLContext * RE_OGLContext
Definition:
RE_Types.h:949
RE
RE_ContextSpecificObject.h
Generated on Wed Aug 27 2025 03:08:14 for HDK by
1.8.6