CFx SDK Documentation  2023 SP0
TrGL2Extensions.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 // GLES2 extensions
24 
25 #ifndef ODTRGL2EXTENSIONS
26 #define ODTRGL2EXTENSIONS
27 
28 #include "RxObject.h"
29 
30 // BGR/BGRA textures (kExtensionBGR/kExtensionBGRA)
31 #ifndef GL_BGR_EXT
32 #define GL_BGR_EXT 0x80E0
33 #endif // GL_BGR_EXT
34 #ifndef GL_BGRA_EXT
35 #define GL_BGRA_EXT 0x80E1
36 #endif // GL_BGRA_EXT
37 
38 // ClampToEdge wrap mode (kExtensionTextureEdgeClamp)
39 #ifndef GL_CLAMP
40 #define GL_CLAMP 0x2900
41 #endif // GL_CLAMP
42 
43 // ClampToBorder wrap mode (kExtensionTextureBorderClamp)
44 #ifndef GL_CLAMP_TO_BORDER
45 #define GL_CLAMP_TO_BORDER 0x812D
46 #endif // GL_CLAMP_TO_BORDER
47 #ifndef GL_TEXTURE_BORDER_COLOR
48 #define GL_TEXTURE_BORDER_COLOR 0x1004
49 #endif // GL_TEXTURE_BORDER_COLOR
50 
51 // Depth textures (kExtensionDepthTexture)
52 #ifndef GL_DEPTH_COMPONENT
53 #define GL_DEPTH_COMPONENT 0x1902
54 #endif // GL_DEPTH_COMPONENT
55 
56 // 24-bit depth buffer format (kExtensionDepth24)
57 #ifndef GL_DEPTH_COMPONENT24
58 #define GL_DEPTH_COMPONENT24 0x81A6
59 #endif // GL_DEPTH_COMPONENT24
60 
61 // Packed depth-stencil format (kExtensionPackedDepthStencil)
62 #ifndef GL_DEPTH_STENCIL
63 #define GL_DEPTH_STENCIL 0x84F9
64 #endif // GL_DEPTH_STENCIL
65 #ifndef GL_UNSIGNED_INT_24_8
66 #define GL_UNSIGNED_INT_24_8 0x84FA
67 #endif // GL_UNSIGNED_INT_24_8
68 #ifndef GL_DEPTH24_STENCIL8
69 #define GL_DEPTH24_STENCIL8 0x88F0
70 #endif // GL_DEPTH24_STENCIL8
71 // WebGL case
72 #ifndef GL_DEPTH_STENCIL_ATTACHMENT
73 #define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
74 #endif // GL_DEPTH_STENCIL_ATTACHMENT
75 
76 // GL_STENCIL_INDEX8 render buffer storage (kExtensionStencil8)
77 #ifndef GL_STENCIL_INDEX
78 #define GL_STENCIL_INDEX 0x1901
79 #endif // GL_STENCIL_INDEX
80 #ifndef GL_STENCIL_INDEX8
81 #define GL_STENCIL_INDEX8 0x8D48
82 #endif // GL_STENCIL_INDEX8
83 
84 // Half-float textures support (kExtensionTextureHalfFloat)
85 #ifndef GL_RGBA16F
86 #define GL_RGBA16F 0x881A
87 #endif // GL_RGBA16F
88 //#ifndef GL_ALPHA16F
89 //#define GL_ALPHA16F 0x881C
90 //#endif // GL_ALPHA16F
91 // This definitions is only for desktop OpenGL. Native OpenGL ES should use GL_RGBA instead and GL_HALF_FLOAT will be accepted as texture type.
92 #ifndef GL_HALF_FLOAT
93 #define GL_HALF_FLOAT 0x8D61
94 #endif // GL_HALF_FLOAT
95 
96 // Floating point textures support (kExtensionTextureFloat)
97 #ifndef GL_RGBA32F
98 #define GL_RGBA32F 0x8814
99 #endif // GL_RGBA32F
100 //#ifndef GL_ALPHA32F
101 //#define GL_ALPHA32F 0x8816
102 //#endif // GL_ALPHA32F
103 // This definitions is only for desktop OpenGL. Native OpenGL ES should use GL_RGBA instead and GL_FLOAT will be accepted as texture type.
104 
105 // Multiple Render Targets support (kExtensionDrawBuffers)
106 #ifndef GL_DRAW_BUFFER0
107 #define GL_DRAW_BUFFER0 0x8825
108 #endif // GL_DRAW_BUFFER0
109 
110 // Lines anti-aliasing
111 #ifndef GL_LINE_SMOOTH
112 #define GL_LINE_SMOOTH 0x0B20
113 #endif // GL_LINE_SMOOTH
114 #ifndef GL_LINE_SMOOTH_HINT
115 #define GL_LINE_SMOOTH_HINT 0x0C52
116 #endif // GL_LINE_SMOOTH_HINT
117 #ifndef GL_SMOOTH_LINE_WIDTH_RANGE
118 #define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
119 #endif // GL_SMOOTH_LINE_WIDTH_RANGE
120 
121 // Shading language version
122 #ifndef GL_SHADING_LANGUAGE_VERSION
123 #define GL_SHADING_LANGUAGE_VERSION 0x8B8C
124 #endif // GL_SHADING_LANGUAGE_VERSION
125 
126 // Required for some desktop GPU's which invoke compatible OpenGL profiles (not required since OpenGL 3.2)
127 #ifndef GL_POINT_SPRITE
128 #define GL_POINT_SPRITE 0x8861
129 #endif // GL_POINT_SPRITE
130 // OpenGL ES 2 GLSL point size (not required by native, but necessary for PC and WebGL)
131 #ifndef GL_VERTEX_PROGRAM_POINT_SIZE
132 #define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
133 #endif // GL_VERTEX_PROGRAM_POINT_SIZE
134 
135 // RGBA framebuffers
136 // Note: don't think that we must check availability for this format. It is defined with GL_EXT_texture extension for desktop OpenGL, but
137 // this format will be available anyway if frame buffers supported. It is defined with GL_OES_rgb8_rgba8 extension for OpemGL ES, but
138 // it is in any case is one of the native OpenGL formats, so don't think that it will be unavailable anywhere.
139 #ifndef GL_RGBA8
140 #define GL_RGBA8 0x8058
141 #endif // GL_RGBA8
142 //
143 
144 class OdTrGL2LocalContext;
145 
147 {
148  public:
150  {
166 
168  };
170  {
172 
174  };
175  protected:
180  friend class OdTrGL2LocalContext;
181  public:
183 
185 
187 
188  // Extension function callers
189  // kExtensionDrawBuffers
190  void glDrawBuffers(GLsizei n, const GLenum *bufs);
191 };
192 
193 #endif // ODTRGL2EXTENSIONS
unsigned int OdUInt32
OdUInt32 m_extensionChecked[kNumExtensions/32+1]
bool isExtensionSupported(ExtensionName nExt)
void glDrawBuffers(GLsizei n, const GLenum *bufs)
OdTrGL2LocalContext * m_pLocalContext
OdUInt32 m_extensionAvailable[kNumExtensions/32+1]
bool isFunctionAvailable(FunctionName nFunc)
void * m_pFunctionPtr[kNumFunctions]
typedef GLenum(APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target)