HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RE_PerContextData.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_PerContextData.h ( RE Library, C++)
7  *
8  * COMMENTS:
9  * Data that is kept with a RE_OGLContext, rather than RE_Render.
10  * RE_Renders are continually created and destroyed, while RE_OGLContexts
11  * are not.
12  */
13 #ifndef RE_PerContextData_h
14 #define RE_PerContextData_h
15 
16 #include "RE_API.h"
17 #include "RE_Font.h"
18 
19 #include <UT/UT_Array.h>
20 #include <UT/UT_NonCopyable.h>
21 
22 #include <utility>
23 
24 class RE_BufferGroup;
25 class RE_Render;
26 class RE_WindowDrawable;
28 
30 {
31 public:
32  // =======================================================================
33  // For new 2D UI drawing.
34  static RE_PerContextData *getDataForDrawable(RE_WindowDrawable *drawable);
35  static void clearDrawableData(RE_WindowDrawable *drawable);
36  // =======================================================================
37 
38  // =======================================================================
39  // For OpenGL 2D UI drawing.
40  static RE_PerContextData *getDataForContext(RE_OGLContext context);
41  static void clearContextData(RE_OGLContext context);
42  // =======================================================================
43 
44  // bucketed buffer groups for font rendering.
45  RE_FontBuffers *fetchFontBufferFromPool(RE_Render *r, int size);
46  void returnFontBufferToPool(RE_FontBuffers *buf);
47 
48  // buffer groups for immediate mode emuluation.
49  RE_BufferGroup *getBufferGroup(RE_Render *r, int size);
50 
51  void initBuffers(RE_Render *r);
52 
53 private:
54  void initBufferGroupRing();
55  RE_BufferGroup *getNextBufferGroup(RE_Render *r);
56  RE_BufferGroup *getLargeBufferGroup(RE_Render *r, int size);
57 
58  RE_BufferGroup *myBufferGroups;
59  RE_BufferGroup *myCurrentBufferGroup;
60  RE_BufferGroup *myLargeBufferGroups;
61  int myLargeBufferSerial;
62 
63  bool myInitialized;
64 
66  myFontBufferBuckets;
67 
71 };
72 
73 
75 {
76 public:
78  : myElemSize(0),
79  mySerial(0),
80  myP(nullptr),
81  myC(nullptr),
82  myImgUV(nullptr),
83  myPatUV(nullptr),
84  myPSize(nullptr),
85  myElemList(nullptr),
86  myVAO(nullptr),
87  myNext(nullptr) {}
88 
90 
91  void init(RE_Render *r, const int size);
92 
98 
101 
103  int mySerial;
104 
106 };
107 
108 #endif
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
RE_VertexArray * myC
RE_VertexArray * myImgUV
#define RE_API
Definition: RE_API.h:10
RE_VertexArray * myPSize
RE_VertexArray * myPatUV
RE_VertexArray * myP
RE_VertexArray * myElemList
void init(RE_Render *r, const int size)
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
GLsizeiptr size
Definition: glcorearb.h:664
RE_BufferGroup * myNext
GLboolean r
Definition: glcorearb.h:1222
QOpenGLContext * RE_OGLContext
Definition: RE_Types.h:949
RE_OGLVertexArrayList * myVAO