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 <
UT/UT_Assert.h
>
23
#include "
RE_Render.h
"
24
25
class
RE_API
RE_ContextSpecificObject
26
{
27
public
:
28
RE_ContextSpecificObject
() : myContext(nullptr) {}
29
virtual
~RE_ContextSpecificObject
() {}
30
31
virtual
bool
init(
RE_Render
*
r
) = 0;
32
33
void
initContext(
RE_Render
*
r
);
34
bool
matchesContext(
RE_Render
*
r
)
const
;
35
void
clearContext
() { myContext =
nullptr
; }
36
37
protected
:
38
RE_Render
*getMyRender();
39
40
// Call in subclasses to ensure that the incoming render context matches
41
// the context this object was created with.
42
bool
initOrCheckRender
(
RE_Render
*
r
)
43
{
44
UT_ASSERT
(r);
45
if
(myContext ==
nullptr
)
46
{
47
myContext = r->
getContext
();
48
return
true
;
49
}
50
else
if
(myContext == r->
getContext
())
51
return
true
;
52
53
UT_ASSERT
(!
"Mismatched GL context with context-specific object"
);
54
return
false
;
55
}
56
57
private
:
58
RE_OGLContext
myContext;
59
};
60
61
// To be used within derived classes.
62
#define RE_CONTEXT_CHECK(r) UT_ASSERT(matchesContext(r))
63
64
#endif
RE_API
#define RE_API
Definition:
RE_API.h:10
UT_Assert.h
RE_Render.h
RE_Render
Definition:
RE_Render.h:29
RE_ContextSpecificObject::clearContext
void clearContext()
Definition:
RE_ContextSpecificObject.h:35
RE_OGLRender::getContext
RE_OGLContext getContext() const
Definition:
RE_OGLRender.h:279
RE_ContextSpecificObject
Definition:
RE_ContextSpecificObject.h:25
RE_ContextSpecificObject::~RE_ContextSpecificObject
virtual ~RE_ContextSpecificObject()
Definition:
RE_ContextSpecificObject.h:29
RE_ContextSpecificObject::initOrCheckRender
bool initOrCheckRender(RE_Render *r)
Definition:
RE_ContextSpecificObject.h:42
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:28
RE_OGLContext
QOpenGLContext * RE_OGLContext
Definition:
RE_Types.h:952
RE
RE_ContextSpecificObject.h
Generated on Sat Dec 7 2024 02:45:16 for HDK by
1.8.6