Open CASCADE Technology 7.8.0
|
This class generalize access to the GL context and available extensions. More...
#include <OpenGl_Context.hxx>
Public Types | |
typedef NCollection_Shared< NCollection_DataMap< TCollection_AsciiString, Handle< OpenGl_Resource > > > | OpenGl_ResourcesMap |
![]() | |
typedef void | base_type |
Returns a type descriptor about this object. | |
Public Member Functions | |
OpenGl_Context (const Handle< OpenGl_Caps > &theCaps=NULL) | |
Empty constructor. You should call Init() to perform initialization with bound GL context. | |
virtual | ~OpenGl_Context () |
Destructor. | |
void | forcedRelease () |
Release all resources, including shared ones. | |
void | Share (const Handle< OpenGl_Context > &theShareCtx) |
Share GL context resources. theShareCtx - handle to context to retrieve handles to shared resources. | |
Standard_Boolean | Init (const Standard_Boolean theIsCoreProfile=Standard_False) |
Initialize class from currently bound OpenGL context. Method should be called only once. | |
Standard_Boolean | IsValid () const |
Standard_Boolean | Init (const Aspect_Drawable theSurface, const Aspect_Display theDisplay, const Aspect_RenderingContext theContext, const Standard_Boolean theIsCoreProfile=Standard_False) |
Initialize class from specified surface and rendering context. Method should be called only once. The meaning of parameters is platform-specific. | |
Aspect_Drawable | Window () const |
Return window handle currently bound to this OpenGL context (EGLSurface | HWND | GLXDrawable). | |
Aspect_Display | GetDisplay () const |
Return display / window device context (EGLDisplay | HDC | Display*). | |
Aspect_RenderingContext | RenderingContext () const |
Return rendering context (EGLContext | HGLRC | GLXContext | EAGLContext* | NSOpenGLContext*). | |
Standard_Boolean | CheckExtension (const char *theExtName) const |
Check if theExtName extension is supported by active GL context. | |
template<typename FuncType_t > | |
Standard_Boolean | FindProcVerbose (const char *&theLastFailFuncName, const char *theFuncName, FuncType_t &theFuncPtr) |
Auxiliary template to retrieve GL function pointer. Pointer to function retrieved from library is statically casted to requested type - there no way to check real signature of exported function. The context should be bound before call. | |
template<typename FuncType_t > | |
Standard_Boolean | FindProc (const char *theFuncName, FuncType_t &theFuncPtr) |
Auxiliary template to retrieve GL function pointer. Same as FindProcVerbose() but without auxiliary last function name argument. | |
Aspect_GraphicsLibrary | GraphicsLibrary () const |
Return active graphics library. | |
Standard_Boolean | IsGlGreaterEqual (const Standard_Integer theVerMajor, const Standard_Integer theVerMinor) const |
Standard_Integer | VersionMajor () const |
Return cached GL version major number. | |
Standard_Integer | VersionMinor () const |
Return cached GL version minor number. | |
const OpenGl_GlFunctions * | Functions () const |
Access entire map of loaded OpenGL functions. | |
bool | ResetErrors (const bool theToPrintErrors=false) |
Clean up errors stack for this GL context (glGetError() in loop). | |
Standard_Boolean | IsCurrent () const |
This method uses system-dependent API to retrieve information about GL context bound to the current thread. | |
Standard_Boolean | MakeCurrent () |
Activates current context. Class should be initialized with appropriate info. | |
void | SwapBuffers () |
Swap front/back buffers for this GL context (should be activated before!). | |
Standard_Boolean | SetSwapInterval (const Standard_Integer theInterval) |
Setup swap interval (VSync). | |
Standard_Boolean | IsRender () const |
Return true if active mode is GL_RENDER (cached state) | |
Standard_Boolean | IsFeedback () const |
Return true if active mode is GL_FEEDBACK (cached state) | |
Standard_Size | AvailableMemory () const |
This function retrieves information from GL about free GPU memory that is: | |
TCollection_AsciiString | MemoryInfo () const |
This function retrieves information from GL about GPU memory and contains more vendor-specific values than AvailableMemory(). | |
void | MemoryInfo (TColStd_IndexedDataMapOfStringString &theDict) const |
This function retrieves information from GL about GPU memory. | |
void | DiagnosticInformation (TColStd_IndexedDataMapOfStringString &theDict, Graphic3d_DiagnosticInfo theFlags) const |
Fill in the dictionary with OpenGL info. Should be called with bound context. | |
void | WindowBufferBits (Graphic3d_Vec4i &theColorBits, Graphic3d_Vec2i &theDepthStencilBits) const |
Fetches information about window buffer pixel format. | |
const Handle< OpenGl_Resource > & | GetResource (const TCollection_AsciiString &theKey) const |
Access shared resource by its name. | |
template<typename TheHandleType > | |
Standard_Boolean | GetResource (const TCollection_AsciiString &theKey, TheHandleType &theValue) const |
Access shared resource by its name. | |
Standard_Boolean | ShareResource (const TCollection_AsciiString &theKey, const Handle< OpenGl_Resource > &theResource) |
Register shared resource. Notice that after registration caller shouldn't release it by himself - it will be automatically released on context destruction. | |
void | ReleaseResource (const TCollection_AsciiString &theKey, const Standard_Boolean theToDelay=Standard_False) |
Release shared resource. If there are more than one reference to this resource (also used by some other existing object) then call will be ignored. This means that current object itself should nullify handle before this call. Notice that this is unrecommended operation at all and should be used only in case of fat resources to release memory for other needs. | |
template<class T > | |
void | DelayedRelease (Handle< T > &theResource) |
Append resource to queue for delayed clean up. Resources in this queue will be released at next redraw call. | |
void | ReleaseDelayed () |
Clean up the delayed release queue. | |
const OpenGl_ResourcesMap & | SharedResources () const |
Return map of shared resources. | |
OpenGl_Clipping & | ChangeClipping () |
const OpenGl_Clipping & | Clipping () const |
const Handle< OpenGl_ShaderManager > & | ShaderManager () const |
Standard_Integer | TextureWrapClamp () const |
Either GL_CLAMP_TO_EDGE (1.2+) or GL_CLAMP (1.1). | |
Standard_Boolean | HasTextureBaseLevel () const |
const Handle< Image_SupportedFormats > & | SupportedTextureFormats () const |
Return map of supported texture formats. | |
Standard_Integer | MaxDegreeOfAnisotropy () const |
Standard_Integer | MaxTextureSize () const |
Standard_Integer | MaxCombinedTextureUnits () const |
Standard_Integer | MaxTextureUnitsFFP () const |
This method returns the multi-texture limit for obsolete fixed-function pipeline. Use MaxCombinedTextureUnits() instead for limits for using programmable pipeline. | |
Graphic3d_TextureUnit | SpriteTextureUnit () const |
Return texture unit to be used for sprites (Graphic3d_TextureUnit_PointSprite by default). | |
Standard_Boolean | HasTextureMultisampling () const |
Standard_Integer | MaxMsaaSamples () const |
Standard_Integer | MaxDumpSizeX () const |
Standard_Integer | MaxDumpSizeY () const |
Standard_Integer | MaxDrawBuffers () const |
Standard_Integer | MaxColorAttachments () const |
Standard_Integer | MaxClipPlanes () const |
Get maximum number of clip planes supported by OpenGl. This value is implementation dependent. At least 6 planes should be supported by OpenGl (see specs). | |
Standard_Boolean | HasRayTracing () const |
Standard_Boolean | HasRayTracingTextures () const |
Standard_Boolean | HasRayTracingAdaptiveSampling () const |
Standard_Boolean | HasRayTracingAdaptiveSamplingAtomic () const |
bool | HasSRGB () const |
Returns TRUE if sRGB rendering is supported. | |
bool | ToRenderSRGB () const |
Returns TRUE if sRGB rendering is supported and permitted. | |
bool | IsWindowSRGB () const |
Returns TRUE if window/surface buffer is sRGB-ready. | |
void | SetWindowSRGB (bool theIsSRgb) |
Overrides if window/surface buffer is sRGB-ready or not (initialized with the context). | |
bool | IsWindowDeepColor () const |
Returns TRUE if window/surface buffer has deep color (10bit per component / 30bit RGB) or better precision. | |
OpenGl_Vec4 | Vec4FromQuantityColor (const OpenGl_Vec4 &theColor) const |
Convert Quantity_ColorRGBA into vec4 with conversion or no conversion into non-linear sRGB basing on ToRenderSRGB() flag. | |
const OpenGl_Vec4 & | Vec4LinearFromQuantityColor (const OpenGl_Vec4 &theColor) const |
Convert Quantity_ColorRGBA into vec4. Quantity_Color is expected to be linear RGB, hence conversion is NOT required. | |
OpenGl_Vec4 | Vec4sRGBFromQuantityColor (const OpenGl_Vec4 &theColor) const |
Convert Quantity_ColorRGBA (linear RGB) into non-linear sRGB vec4. | |
Standard_Boolean | HasPBR () const |
Returns TRUE if PBR shading model is supported. Basically, feature requires OpenGL 3.0+ / OpenGL ES 3.0+ hardware; more precisely: | |
Graphic3d_TextureUnit | PBREnvLUTTexUnit () const |
Returns texture unit where Environment Lookup Table is expected to be bound, or 0 if PBR is unavailable. | |
Graphic3d_TextureUnit | PBRDiffIBLMapSHTexUnit () const |
Returns texture unit where Diffuse (irradiance) IBL map's spherical harmonics coefficients is expected to be bound, or 0 if PBR is unavailable. | |
Graphic3d_TextureUnit | PBRSpecIBLMapTexUnit () const |
Returns texture unit where Specular IBL map is expected to be bound, or 0 if PBR is unavailable. | |
Graphic3d_TextureUnit | ShadowMapTexUnit () const |
Returns texture unit where shadow map is expected to be bound, or 0 if unavailable. | |
Graphic3d_TextureUnit | DepthPeelingDepthTexUnit () const |
Returns texture unit for occDepthPeelingDepth within enabled Depth Peeling. | |
Graphic3d_TextureUnit | DepthPeelingFrontColorTexUnit () const |
Returns texture unit for occDepthPeelingFrontColor within enabled Depth Peeling. | |
bool | ToUseVbo () const |
Returns true if VBO is supported and permitted. | |
Standard_Boolean | IsGlNormalizeEnabled () const |
Standard_Boolean | SetGlNormalizeEnabled (Standard_Boolean isEnabled) |
Sets GL_NORMALIZE enabled or disabled. | |
Standard_Integer | PolygonMode () const |
Standard_Integer | SetPolygonMode (const Standard_Integer theMode) |
Sets polygon rasterization mode (glPolygonMode() function). | |
bool | IsPolygonHatchEnabled () const |
bool | SetPolygonHatchEnabled (const bool theIsEnabled) |
Sets enabled state of polygon hatching rasterization without affecting currently selected hatching pattern. | |
Standard_Integer | PolygonHatchStyle () const |
Standard_Integer | SetPolygonHatchStyle (const Handle< Graphic3d_HatchStyle > &theStyle) |
Sets polygon hatch pattern. Zero-index value is a default alias for solid filling. | |
void | SetPolygonOffset (const Graphic3d_PolygonOffset &theOffset) |
Sets and applies current polygon offset. | |
const Graphic3d_PolygonOffset & | PolygonOffset () const |
Returns currently applied polygon offset parameters. | |
const Handle< Graphic3d_Camera > & | Camera () const |
Returns camera object. | |
void | SetCamera (const Handle< Graphic3d_Camera > &theCamera) |
Sets camera object to the context and update matrices. | |
void | ApplyModelWorldMatrix () |
Applies matrix into shader manager stored in ModelWorldState to OpenGl. In "model -> world -> view -> projection" it performs: model -> world. | |
void | ApplyWorldViewMatrix () |
Applies matrix stored in WorldViewState to OpenGl. In "model -> world -> view -> projection" it performs: model -> world -> view, where model -> world is identical matrix. | |
void | ApplyModelViewMatrix () |
Applies combination of matrices stored in ModelWorldState and WorldViewState to OpenGl. In "model -> world -> view -> projection" it performs: model -> world -> view. | |
void | ApplyProjectionMatrix () |
Applies matrix stored in ProjectionState to OpenGl. In "model -> world -> view -> projection" it performs: view -> projection. | |
const Handle< Message_Messenger > & | Messenger () const |
void | PushMessage (const unsigned int theSource, const unsigned int theType, const unsigned int theId, const unsigned int theSeverity, const TCollection_ExtendedString &theMessage) |
Callback for GL_ARB_debug_output extension. | |
Standard_Boolean | ExcludeMessage (const unsigned int theSource, const unsigned int theId) |
Adds a filter for messages with theId and theSource (GL_DEBUG_SOURCE_) | |
Standard_Boolean | IncludeMessage (const unsigned int theSource, const unsigned int theId) |
Removes a filter for messages with theId and theSource (GL_DEBUG_SOURCE_) | |
Standard_Boolean | HasStereoBuffers () const |
![]() | |
Standard_Transient () | |
Empty constructor. | |
Standard_Transient (const Standard_Transient &) | |
Copy constructor – does nothing. | |
Standard_Transient & | operator= (const Standard_Transient &) |
Assignment operator, needed to avoid copying reference counter. | |
virtual | ~Standard_Transient () |
Destructor must be virtual. | |
virtual const opencascade::handle< Standard_Type > & | DynamicType () const |
Returns a type descriptor about this object. | |
Standard_Boolean | IsInstance (const opencascade::handle< Standard_Type > &theType) const |
Returns a true value if this is an instance of Type. | |
Standard_Boolean | IsInstance (const Standard_CString theTypeName) const |
Returns a true value if this is an instance of TypeName. | |
Standard_Boolean | IsKind (const opencascade::handle< Standard_Type > &theType) const |
Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. | |
Standard_Boolean | IsKind (const Standard_CString theTypeName) const |
Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. | |
Standard_Transient * | This () const |
Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero. | |
Standard_Integer | GetRefCount () const noexcept |
Get the reference counter of this object. | |
void | IncrementRefCounter () noexcept |
Increments the reference counter of this object. | |
Standard_Integer | DecrementRefCounter () noexcept |
Decrements the reference counter of this object; returns the decremented value. | |
virtual void | Delete () const |
Memory deallocator for transient classes. | |
Data Fields | |
core profiles | |
OpenGl_GlCore11 * | core11ffp |
OpenGL 1.1 core functionality. | |
OpenGl_GlCore11Fwd * | core11fwd |
OpenGL 1.1 without deprecated entry points. | |
OpenGl_GlCore15 * | core15 |
OpenGL 1.5 without deprecated entry points. | |
OpenGl_GlCore20 * | core20 |
OpenGL 2.0 without deprecated entry points. | |
OpenGl_GlCore30 * | core30 |
OpenGL 3.0 without deprecated entry points. | |
OpenGl_GlCore32 * | core32 |
OpenGL 3.2 core profile. | |
OpenGl_GlCore33 * | core33 |
OpenGL 3.3 core profile. | |
OpenGl_GlCore41 * | core41 |
OpenGL 4.1 core profile. | |
OpenGl_GlCore42 * | core42 |
OpenGL 4.2 core profile. | |
OpenGl_GlCore43 * | core43 |
OpenGL 4.3 core profile. | |
OpenGl_GlCore44 * | core44 |
OpenGL 4.4 core profile. | |
OpenGl_GlCore45 * | core45 |
OpenGL 4.5 core profile. | |
OpenGl_GlCore46 * | core46 |
OpenGL 4.6 core profile. | |
OpenGl_GlCore15 * | core15fwd |
obsolete entry left for code portability; core15 should be used instead | |
OpenGl_GlCore20 * | core20fwd |
obsolete entry left for code portability; core20 should be used instead | |
Handle< OpenGl_Caps > | caps |
context options | |
extensions | |
Standard_Boolean | hasGetBufferData |
flag indicating if GetBufferSubData() is supported | |
Standard_Boolean | hasPackRowLength |
supporting of GL_PACK_ROW_LENGTH parameters (any desktop OpenGL; OpenGL ES 3.0) | |
Standard_Boolean | hasUnpackRowLength |
supporting of GL_UNPACK_ROW_LENGTH parameters (any desktop OpenGL; OpenGL ES 3.0) | |
Standard_Boolean | hasHighp |
highp in GLSL ES fragment shader is supported | |
Standard_Boolean | hasUintIndex |
GLuint for index buffer is supported (always available on desktop; on OpenGL ES - since 3.0 or as extension GL_OES_element_index_uint) | |
Standard_Boolean | hasTexRGBA8 |
always available on desktop; on OpenGL ES - since 3.0 or as extension GL_OES_rgb8_rgba8 | |
Standard_Boolean | hasTexFloatLinear |
texture-filterable state for 32-bit floating texture formats (always on desktop, GL_OES_texture_float_linear within OpenGL ES) | |
Standard_Boolean | hasTexSRGB |
sRGB texture formats (desktop OpenGL 2.1, OpenGL ES 3.0 or OpenGL ES 2.0 + GL_EXT_sRGB) | |
Standard_Boolean | hasFboSRGB |
sRGB FBO render targets (desktop OpenGL 2.1, OpenGL ES 3.0) | |
Standard_Boolean | hasSRGBControl |
sRGB write control (any desktop OpenGL, OpenGL ES + GL_EXT_sRGB_write_control extension) | |
Standard_Boolean | hasFboRenderMipmap |
FBO render target could be non-zero mipmap level of texture. | |
OpenGl_FeatureFlag | hasFlatShading |
Complex flag indicating support of Flat shading (Graphic3d_TypeOfShadingModel_Phong) (always available on desktop; on OpenGL ES - since 3.0 or as extension GL_OES_standard_derivatives) | |
OpenGl_FeatureFlag | hasGlslBitwiseOps |
GLSL supports bitwise operations; OpenGL 3.0 / OpenGL ES 3.0 (GLSL 130 / GLSL ES 300) or OpenGL 2.1 + GL_EXT_gpu_shader4. | |
OpenGl_FeatureFlag | hasDrawBuffers |
Complex flag indicating support of multiple draw buffers (desktop OpenGL 2.0, OpenGL ES 3.0, GL_ARB_draw_buffers, GL_EXT_draw_buffers) | |
OpenGl_FeatureFlag | hasFloatBuffer |
Complex flag indicating support of float color buffer format (desktop OpenGL 3.0, GL_ARB_color_buffer_float, GL_EXT_color_buffer_float) | |
OpenGl_FeatureFlag | hasHalfFloatBuffer |
Complex flag indicating support of half-float color buffer format (desktop OpenGL 3.0, GL_ARB_color_buffer_float, GL_EXT_color_buffer_half_float) | |
OpenGl_FeatureFlag | hasSampleVariables |
Complex flag indicating support of MSAA variables in GLSL shader (desktop OpenGL 4.0, GL_ARB_sample_shading) | |
OpenGl_FeatureFlag | hasGeometryStage |
Complex flag indicating support of Geometry shader (desktop OpenGL 3.2, OpenGL ES 3.2, GL_EXT_geometry_shader) | |
Standard_Boolean | arbDrawBuffers |
GL_ARB_draw_buffers. | |
Standard_Boolean | arbNPTW |
GL_ARB_texture_non_power_of_two. | |
Standard_Boolean | arbTexRG |
GL_ARB_texture_rg. | |
Standard_Boolean | arbTexFloat |
GL_ARB_texture_float (on desktop OpenGL - since 3.0 or as extension GL_ARB_texture_float; on OpenGL ES - since 3.0);. | |
OpenGl_ArbSamplerObject * | arbSamplerObject |
GL_ARB_sampler_objects (on desktop OpenGL - since 3.3 or as extension GL_ARB_sampler_objects; on OpenGL ES - since 3.0) | |
OpenGl_ArbTexBindless * | arbTexBindless |
GL_ARB_bindless_texture. | |
OpenGl_ArbTBO * | arbTBO |
GL_ARB_texture_buffer_object (on desktop OpenGL - since 3.1 or as extension GL_ARB_texture_buffer_object; on OpenGL ES - since 3.2) | |
Standard_Boolean | arbTboRGB32 |
GL_ARB_texture_buffer_object_rgb32 (3-component TBO), in core since 4.0 (on OpenGL ES - since 3.2) | |
Standard_Boolean | arbClipControl |
GL_ARB_clip_control, in core since 4.5. | |
OpenGl_ArbIns * | arbIns |
GL_ARB_draw_instanced (on desktop OpenGL - since 3.1 or as extension GL_ARB_draw_instanced; on OpenGL ES - since 3.0 or as extension GL_ANGLE_instanced_arrays to WebGL 1.0) | |
OpenGl_ArbDbg * | arbDbg |
GL_ARB_debug_output (on desktop OpenGL - since 4.3 or as extension GL_ARB_debug_output; on OpenGL ES - since 3.2 or as extension GL_KHR_debug) | |
OpenGl_ArbFBO * | arbFBO |
GL_ARB_framebuffer_object. | |
OpenGl_ArbFBOBlit * | arbFBOBlit |
glBlitFramebuffer function, moved out from OpenGl_ArbFBO structure for compatibility with OpenGL ES 2.0 | |
Standard_Boolean | arbSampleShading |
GL_ARB_sample_shading. | |
Standard_Boolean | arbDepthClamp |
GL_ARB_depth_clamp (on desktop OpenGL - since 3.2 or as extensions GL_ARB_depth_clamp,NV_depth_clamp; unavailable on OpenGL ES) | |
Standard_Boolean | extFragDepth |
GL_EXT_frag_depth on OpenGL ES 2.0 (gl_FragDepthEXT built-in variable, before OpenGL ES 3.0) | |
Standard_Boolean | extDrawBuffers |
GL_EXT_draw_buffers. | |
OpenGl_ExtGS * | extGS |
GL_EXT_geometry_shader4. | |
Standard_Boolean | extBgra |
GL_EXT_bgra or GL_EXT_texture_format_BGRA8888 on OpenGL ES. | |
Standard_Boolean | extTexR16 |
GL_EXT_texture_norm16 on OpenGL ES; always available on desktop. | |
Standard_Boolean | extAnis |
GL_EXT_texture_filter_anisotropic. | |
Standard_Boolean | extPDS |
GL_EXT_packed_depth_stencil. | |
Standard_Boolean | atiMem |
GL_ATI_meminfo. | |
Standard_Boolean | nvxMem |
GL_NVX_gpu_memory_info. | |
Standard_Boolean | oesSampleVariables |
GL_OES_sample_variables. | |
Standard_Boolean | oesStdDerivatives |
GL_OES_standard_derivatives. | |
public properties tracking current state | |
OpenGl_MatrixState< Standard_ShortReal > | ModelWorldState |
state of orientation matrix | |
OpenGl_MatrixState< Standard_ShortReal > | WorldViewState |
state of orientation matrix | |
OpenGl_MatrixState< Standard_ShortReal > | ProjectionState |
state of projection matrix | |
methods to alter or retrieve current state | |
static Standard_Boolean | CheckIsTransparent (const OpenGl_Aspects *theAspect, const Handle< Graphic3d_PresentationAttributes > &theHighlight, Standard_ShortReal &theAlphaFront, Standard_ShortReal &theAlphaBack) |
Checks if transparency is required for the given aspect and highlight style. | |
static Standard_Boolean | CheckIsTransparent (const OpenGl_Aspects *theAspect, const Handle< Graphic3d_PresentationAttributes > &theHighlight) |
Checks if transparency is required for the given aspect and highlight style. | |
const Handle< OpenGl_FrameStats > & | FrameStats () const |
Return structure holding frame statistics. | |
void | SetFrameStats (const Handle< OpenGl_FrameStats > &theStats) |
Set structure holding frame statistics. This call makes sense only if application defines OpenGl_FrameStats sub-class. | |
const Standard_Integer * | Viewport () const |
Return cached viewport definition (x, y, width, height). | |
void | ResizeViewport (const Standard_Integer theRect[4]) |
Resize the viewport (alias for glViewport). | |
const Standard_Integer * | VirtualViewport () const |
Return virtual viewport definition (x, y, width, height). | |
Standard_Integer | ReadBuffer () |
Return active read buffer. | |
void | SetReadBuffer (const Standard_Integer theReadBuffer) |
Switch read buffer, wrapper for ::glReadBuffer(). | |
Standard_Integer | DrawBuffer (Standard_Integer theIndex=0) const |
Return active draw buffer attached to a render target referred by index (layout location). | |
void | SetDrawBuffer (const Standard_Integer theDrawBuffer) |
Switch draw buffer, wrapper for ::glDrawBuffer(). | |
void | SetDrawBuffers (const Standard_Integer theNb, const Standard_Integer *theDrawBuffers) |
Switch draw buffer, wrapper for ::glDrawBuffers (GLsizei, const GLenum*). | |
void | SetReadDrawBuffer (const Standard_Integer theBuffer) |
Switch read/draw buffers. | |
bool | IsFrameBufferSRGB () const |
Returns cached GL_FRAMEBUFFER_SRGB state. If TRUE, GLSL program is expected to write linear RGB color. Otherwise, GLSL program might need manually converting result color into sRGB color space. | |
void | SetFrameBufferSRGB (bool theIsFbo, bool theIsFboSRgb=true) |
Enables/disables GL_FRAMEBUFFER_SRGB flag. This flag can be set to: | |
const NCollection_Vec4< bool > & | ColorMaskRGBA () const |
Return cached flag indicating writing into color buffer is enabled or disabled (glColorMask). | |
void | SetColorMaskRGBA (const NCollection_Vec4< bool > &theToWriteColor) |
Enable/disable writing into color buffer (wrapper for glColorMask). | |
bool | ColorMask () const |
Return cached flag indicating writing into color buffer is enabled or disabled (glColorMask). | |
bool | SetColorMask (bool theToWriteColor) |
Enable/disable writing into color buffer (wrapper for glColorMask). Alpha component writes will be disabled unconditionally in case of caps->buffersOpaqueAlpha. | |
bool | AllowSampleAlphaToCoverage () const |
Return TRUE if GL_SAMPLE_ALPHA_TO_COVERAGE usage is allowed. | |
void | SetAllowSampleAlphaToCoverage (bool theToEnable) |
Allow GL_SAMPLE_ALPHA_TO_COVERAGE usage. | |
bool | SampleAlphaToCoverage () const |
Return GL_SAMPLE_ALPHA_TO_COVERAGE state. | |
bool | SetSampleAlphaToCoverage (bool theToEnable) |
Enable/disable GL_SAMPLE_ALPHA_TO_COVERAGE. | |
Graphic3d_TypeOfBackfacingModel | FaceCulling () const |
Return back face culling state. | |
void | SetFaceCulling (Graphic3d_TypeOfBackfacingModel theMode) |
Enable or disable back face culling (glEnable (GL_CULL_FACE)). | |
bool | ToCullBackFaces () const |
Return back face culling state. | |
void | SetCullBackFaces (bool theToEnable) |
Enable or disable back face culling (glCullFace() + glEnable(GL_CULL_FACE)). | |
void | FetchState () |
Fetch OpenGl context state. This class tracks value of several OpenGl state variables. Consulting the cached values is quicker than doing the same via OpenGl API. Call this method if any of the controlled OpenGl state variables has a possibility of being out-of-date. | |
const Handle< OpenGl_TextureSet > & | ActiveTextures () const |
Handle< OpenGl_TextureSet > | BindTextures (const Handle< OpenGl_TextureSet > &theTextures) |
Bind specified texture set to current context taking into account active GLSL program. | |
Handle< OpenGl_TextureSet > | BindTextures (const Handle< OpenGl_TextureSet > &theTextures, const Handle< OpenGl_ShaderProgram > &theProgram) |
Bind specified texture set to current context, or unbind previous one when NULL specified. | |
const Handle< OpenGl_ShaderProgram > & | ActiveProgram () const |
Standard_Boolean | BindProgram (const Handle< OpenGl_ShaderProgram > &theProgram) |
Bind specified program to current context, or unbind previous one when NULL specified. | |
void | SetShadingMaterial (const OpenGl_Aspects *theAspect, const Handle< Graphic3d_PresentationAttributes > &theHighlight) |
Setup current shading material. | |
void | SetColor4fv (const OpenGl_Vec4 &theColor) |
Setup current color. | |
void | SetTypeOfLine (const Aspect_TypeOfLine theType, const Standard_ShortReal theFactor=1.0f) |
Setup type of line. | |
void | SetLineStipple (const uint16_t thePattern) |
Setup stipple line pattern with 1.0f factor; wrapper for glLineStipple(). | |
void | SetLineStipple (const Standard_ShortReal theFactor, const uint16_t thePattern) |
Setup type of line; wrapper for glLineStipple(). | |
void | SetLineWidth (const Standard_ShortReal theWidth) |
Setup width of line. | |
void | SetPointSize (const Standard_ShortReal theSize) |
Setup point size. | |
void | SetPointSpriteOrigin () |
Setup point sprite origin using GL_POINT_SPRITE_COORD_ORIGIN state: | |
void | SetTextureMatrix (const Handle< Graphic3d_TextureParams > &theParams, const Standard_Boolean theIsTopDown) |
Setup texture matrix to active GLSL program or to FFP global state using glMatrixMode (GL_TEXTURE). | |
void | BindDefaultVao () |
Bind default Vertex Array Object. | |
const Handle< OpenGl_FrameBuffer > & | DefaultFrameBuffer () const |
Default Frame Buffer Object. | |
Handle< OpenGl_FrameBuffer > | SetDefaultFrameBuffer (const Handle< OpenGl_FrameBuffer > &theFbo) |
Setup new Default Frame Buffer Object and return previously set. This call doesn't change Active FBO! | |
Standard_Boolean | IsDebugContext () const |
Return debug context initialization state. | |
void | EnableFeatures () const |
Checks if transparency is required for the given aspect and highlight style. | |
void | DisableFeatures () const |
Checks if transparency is required for the given aspect and highlight style. | |
unsigned int | Resolution () const |
Return resolution for rendering text. | |
Standard_ShortReal | ResolutionRatio () const |
Resolution scale factor (rendered resolution to standard resolution). This scaling factor for parameters like text size to be properly displayed on device (screen / printer). | |
Standard_ShortReal | RenderScale () const |
Rendering scale factor (rendering viewport height to real window buffer height). | |
Standard_Boolean | HasRenderScale () const |
Return TRUE if rendering scale factor is not 1. | |
Standard_ShortReal | RenderScaleInv () const |
Rendering scale factor (inverted value). | |
Standard_ShortReal | LineWidthScale () const |
Return scale factor for line width. | |
void | SetResolution (unsigned int theResolution, Standard_ShortReal theRatio, Standard_ShortReal theScale) |
Set resolution ratio. Note that this method rounds @theRatio to nearest integer. | |
void | SetResolutionRatio (const Standard_ShortReal theRatio) |
Set resolution ratio. Note that this method rounds @theRatio to nearest integer. | |
Standard_ShortReal | LineFeather () const |
Return line feater width in pixels. | |
void | SetLineFeather (Standard_ShortReal theValue) |
Set line feater width. | |
bool | GetBufferSubData (unsigned int theTarget, intptr_t theOffset, intptr_t theSize, void *theData) |
Wrapper over glGetBufferSubData(), implemented as: | |
const TCollection_AsciiString & | Vendor () const |
Return Graphics Driver's vendor. | |
void | DumpJson (Standard_OStream &theOStream, Standard_Integer theDepth=-1) const |
Dumps the content of me into the stream. | |
void | DumpJsonOpenGlState (Standard_OStream &theOStream, Standard_Integer theDepth=-1) |
Dumps the content of openGL state into the stream. | |
void | SetShadeModel (Graphic3d_TypeOfShadingModel theModel) |
Set GL_SHADE_MODEL value. | |
This class generalize access to the GL context and available extensions.
Functions related to specific OpenGL version or extension are grouped into structures which can be accessed as fields of this class. The most simple way to check that required functionality is available - is NULL check for the group:
Current implementation provide access to OpenGL core functionality up to 4.6 version (core12, core13, core14, etc.) as well as several extensions (arbTBO, arbFBO, etc.).
OpenGL context might be initialized in Core Profile. In this case deprecated functionality become unavailable. To select which core** function set should be used in specific case:
Simplified extensions classification:
Notice that some systems provide mechanisms to simultaneously incorporate with GL contexts with different capabilities. For this reason OpenGl_Context should be initialized and used for each GL context independently.
Matrices of OpenGl transformations: model -> world -> view -> projection These matrices might be changed for local transformation, transform persistent using direct access to current matrix of ModelWorldState, WorldViewState and ProjectionState After, these matrices should be applied using ApplyModelWorldMatrix, ApplyWorldViewMatrix, ApplyModelViewMatrix or ApplyProjectionMatrix.
typedef NCollection_Shared< NCollection_DataMap<TCollection_AsciiString, Handle< OpenGl_Resource > > > OpenGl_Context::OpenGl_ResourcesMap |
OpenGl_Context::OpenGl_Context | ( | const Handle< OpenGl_Caps > & | theCaps = NULL | ) |
Empty constructor. You should call Init() to perform initialization with bound GL context.
|
virtual |
Destructor.
|
inline |
|
inline |
|
inline |
Return TRUE if GL_SAMPLE_ALPHA_TO_COVERAGE usage is allowed.
void OpenGl_Context::ApplyModelViewMatrix | ( | ) |
Applies combination of matrices stored in ModelWorldState and WorldViewState to OpenGl. In "model -> world -> view -> projection" it performs: model -> world -> view.
void OpenGl_Context::ApplyModelWorldMatrix | ( | ) |
Applies matrix into shader manager stored in ModelWorldState to OpenGl. In "model -> world -> view -> projection" it performs: model -> world.
void OpenGl_Context::ApplyProjectionMatrix | ( | ) |
Applies matrix stored in ProjectionState to OpenGl. In "model -> world -> view -> projection" it performs: view -> projection.
void OpenGl_Context::ApplyWorldViewMatrix | ( | ) |
Applies matrix stored in WorldViewState to OpenGl. In "model -> world -> view -> projection" it performs: model -> world -> view, where model -> world is identical matrix.
Standard_Size OpenGl_Context::AvailableMemory | ( | ) | const |
This function retrieves information from GL about free GPU memory that is:
void OpenGl_Context::BindDefaultVao | ( | ) |
Bind default Vertex Array Object.
Standard_Boolean OpenGl_Context::BindProgram | ( | const Handle< OpenGl_ShaderProgram > & | theProgram | ) |
Bind specified program to current context, or unbind previous one when NULL specified.
|
inline |
Bind specified texture set to current context taking into account active GLSL program.
Handle< OpenGl_TextureSet > OpenGl_Context::BindTextures | ( | const Handle< OpenGl_TextureSet > & | theTextures, |
const Handle< OpenGl_ShaderProgram > & | theProgram | ||
) |
Bind specified texture set to current context, or unbind previous one when NULL specified.
theTextures | [in] texture set to bind |
theProgram | [in] program attributes; when not NULL, mock textures will be bound to texture units expected by GLSL program, but undefined by texture set |
|
inline |
Returns camera object.
|
inline |
Standard_Boolean OpenGl_Context::CheckExtension | ( | const char * | theExtName | ) | const |
Check if theExtName extension is supported by active GL context.
|
static |
Check if theExtName extension is in extensions string.
|
inlinestatic |
Checks if transparency is required for the given aspect and highlight style.
|
static |
Checks if transparency is required for the given aspect and highlight style.
|
inline |
|
inline |
Return cached flag indicating writing into color buffer is enabled or disabled (glColorMask).
|
inline |
Return cached flag indicating writing into color buffer is enabled or disabled (glColorMask).
|
inline |
Default Frame Buffer Object.
Append resource to queue for delayed clean up. Resources in this queue will be released at next redraw call.
|
inline |
Returns texture unit for occDepthPeelingDepth within enabled Depth Peeling.
|
inline |
Returns texture unit for occDepthPeelingFrontColor within enabled Depth Peeling.
void OpenGl_Context::DiagnosticInformation | ( | TColStd_IndexedDataMapOfStringString & | theDict, |
Graphic3d_DiagnosticInfo | theFlags | ||
) | const |
Fill in the dictionary with OpenGL info. Should be called with bound context.
void OpenGl_Context::DisableFeatures | ( | ) | const |
Checks if transparency is required for the given aspect and highlight style.
|
inline |
Return active draw buffer attached to a render target referred by index (layout location).
void OpenGl_Context::DumpJson | ( | Standard_OStream & | theOStream, |
Standard_Integer | theDepth = -1 |
||
) | const |
Dumps the content of me into the stream.
void OpenGl_Context::DumpJsonOpenGlState | ( | Standard_OStream & | theOStream, |
Standard_Integer | theDepth = -1 |
||
) |
Dumps the content of openGL state into the stream.
void OpenGl_Context::EnableFeatures | ( | ) | const |
Checks if transparency is required for the given aspect and highlight style.
Standard_Boolean OpenGl_Context::ExcludeMessage | ( | const unsigned int | theSource, |
const unsigned int | theId | ||
) |
Adds a filter for messages with theId and theSource (GL_DEBUG_SOURCE_)
|
inline |
Return back face culling state.
void OpenGl_Context::FetchState | ( | ) |
|
inline |
Auxiliary template to retrieve GL function pointer. Same as FindProcVerbose() but without auxiliary last function name argument.
|
inline |
Auxiliary template to retrieve GL function pointer. Pointer to function retrieved from library is statically casted to requested type - there no way to check real signature of exported function. The context should be bound before call.
theLastFailFuncName | [out] set to theFuncName in case of failure, unmodified on success |
theFuncName | [in] function name to find |
theFuncPtr | [out] retrieved function pointer |
void OpenGl_Context::forcedRelease | ( | ) |
Release all resources, including shared ones.
|
static |
Format GL constant as hex value 0xABCD.
|
static |
Return text description of GL error.
|
static |
Format pointer as hex value 0xABCD.
|
static |
Format size value.
|
inline |
Return structure holding frame statistics.
|
inline |
Access entire map of loaded OpenGL functions.
bool OpenGl_Context::GetBufferSubData | ( | unsigned int | theTarget, |
intptr_t | theOffset, | ||
intptr_t | theSize, | ||
void * | theData | ||
) |
Wrapper over glGetBufferSubData(), implemented as:
[in] | theTarget | target buffer to map {GLenum} |
[in] | theOffset | offset to the beginning of sub-data {GLintptr} |
[in] | theSize | number of bytes to read {GLsizeiptr} |
[out] | theData | destination pointer to fill |
|
inline |
Return display / window device context (EGLDisplay | HDC | Display*).
|
inlinestatic |
Function for getting power of to number larger or equal to input number.
theNumber | number to 'power of two' |
theThreshold | upper threshold |
const Handle< OpenGl_Resource > & OpenGl_Context::GetResource | ( | const TCollection_AsciiString & | theKey | ) | const |
Access shared resource by its name.
theKey | - unique identifier; |
|
inline |
Access shared resource by its name.
theKey | - unique identifier; |
theValue | - handle to fill; |
|
inline |
Return active graphics library.
|
inline |
Returns TRUE if PBR shading model is supported. Basically, feature requires OpenGL 3.0+ / OpenGL ES 3.0+ hardware; more precisely:
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Return TRUE if rendering scale factor is not 1.
|
inline |
Returns TRUE if sRGB rendering is supported.
|
inline |
|
inline |
|
inline |
Standard_Boolean OpenGl_Context::IncludeMessage | ( | const unsigned int | theSource, |
const unsigned int | theId | ||
) |
Removes a filter for messages with theId and theSource (GL_DEBUG_SOURCE_)
Standard_Boolean OpenGl_Context::Init | ( | const Aspect_Drawable | theSurface, |
const Aspect_Display | theDisplay, | ||
const Aspect_RenderingContext | theContext, | ||
const Standard_Boolean | theIsCoreProfile = Standard_False |
||
) |
Initialize class from specified surface and rendering context. Method should be called only once. The meaning of parameters is platform-specific.
EGL:
Windows (Win32):
Linux (Xlib):
theSurface | [in] surface / window (EGLSurface | HWND | GLXDrawable/Window) |
theDisplay | [in] display or device context (EGLDisplay | HDC | Display*) |
theContext | [in] rendering context (EGLContext | HGLRC | GLXContext | EAGLContext* | NSOpenGLContext*) |
theIsCoreProfile | [in] flag indicating that passed GL rendering context has been created with Core Profile |
Standard_Boolean OpenGl_Context::Init | ( | const Standard_Boolean | theIsCoreProfile = Standard_False | ) |
Initialize class from currently bound OpenGL context. Method should be called only once.
Standard_Boolean OpenGl_Context::IsCurrent | ( | ) | const |
This method uses system-dependent API to retrieve information about GL context bound to the current thread.
|
inline |
Return debug context initialization state.
Standard_Boolean OpenGl_Context::IsFeedback | ( | ) | const |
Return true if active mode is GL_FEEDBACK (cached state)
|
inline |
Returns cached GL_FRAMEBUFFER_SRGB state. If TRUE, GLSL program is expected to write linear RGB color. Otherwise, GLSL program might need manually converting result color into sRGB color space.
|
inline |
|
inline |
|
inline |
Standard_Boolean OpenGl_Context::IsRender | ( | ) | const |
Return true if active mode is GL_RENDER (cached state)
|
inline |
|
inline |
Returns TRUE if window/surface buffer has deep color (10bit per component / 30bit RGB) or better precision.
|
inline |
Returns TRUE if window/surface buffer is sRGB-ready.
When offscreen FBOs are created in sRGB, but window is not sRGB-ready, blitting into window should be done with manual gamma correction.
In desktop OpenGL, window buffer can be considered as sRGB-ready by default, even when application has NOT requested sRGB-ready pixel format, and rendering is managed via GL_FRAMEBUFFER_SRGB state.
In OpenGL ES, sRGB-ready window surface should be explicitly requested on construction, and cannot be disabled/enabled without GL_EXT_sRGB_write_control extension afterwards (GL_FRAMEBUFFER_SRGB can be considered as always tuned ON).
|
inline |
Return line feater width in pixels.
|
inline |
Return scale factor for line width.
Standard_Boolean OpenGl_Context::MakeCurrent | ( | ) |
Activates current context. Class should be initialized with appropriate info.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
This method returns the multi-texture limit for obsolete fixed-function pipeline. Use MaxCombinedTextureUnits() instead for limits for using programmable pipeline.
TCollection_AsciiString OpenGl_Context::MemoryInfo | ( | ) | const |
This function retrieves information from GL about GPU memory and contains more vendor-specific values than AvailableMemory().
void OpenGl_Context::MemoryInfo | ( | TColStd_IndexedDataMapOfStringString & | theDict | ) | const |
This function retrieves information from GL about GPU memory.
|
inline |
|
inline |
Returns texture unit where Diffuse (irradiance) IBL map's spherical harmonics coefficients is expected to be bound, or 0 if PBR is unavailable.
|
inline |
Returns texture unit where Environment Lookup Table is expected to be bound, or 0 if PBR is unavailable.
|
inline |
Returns texture unit where Specular IBL map is expected to be bound, or 0 if PBR is unavailable.
|
inline |
|
inline |
|
inline |
Returns currently applied polygon offset parameters.
void OpenGl_Context::PushMessage | ( | const unsigned int | theSource, |
const unsigned int | theType, | ||
const unsigned int | theId, | ||
const unsigned int | theSeverity, | ||
const TCollection_ExtendedString & | theMessage | ||
) |
Callback for GL_ARB_debug_output extension.
theSource | message source within GL_DEBUG_SOURCE_ enumeration |
theType | message type within GL_DEBUG_TYPE_ enumeration |
theId | message ID within source |
theSeverity | message severity within GL_DEBUG_SEVERITY_ enumeration |
theMessage | the message itself |
|
inline |
Return active read buffer.
|
static |
Read OpenGL version information from active context.
void OpenGl_Context::ReleaseDelayed | ( | ) |
Clean up the delayed release queue.
void OpenGl_Context::ReleaseResource | ( | const TCollection_AsciiString & | theKey, |
const Standard_Boolean | theToDelay = Standard_False |
||
) |
Release shared resource. If there are more than one reference to this resource (also used by some other existing object) then call will be ignored. This means that current object itself should nullify handle before this call. Notice that this is unrecommended operation at all and should be used only in case of fat resources to release memory for other needs.
theKey | unique identifier |
theToDelay | postpone release until next redraw call |
|
inline |
Return rendering context (EGLContext | HGLRC | GLXContext | EAGLContext* | NSOpenGLContext*).
|
inline |
Rendering scale factor (rendering viewport height to real window buffer height).
|
inline |
Rendering scale factor (inverted value).
Clean up errors stack for this GL context (glGetError() in loop).
void OpenGl_Context::ResizeViewport | ( | const Standard_Integer | theRect[4] | ) |
Resize the viewport (alias for glViewport).
theRect | viewport definition (x, y, width, height) |
|
inline |
Resolution scale factor (rendered resolution to standard resolution). This scaling factor for parameters like text size to be properly displayed on device (screen / printer).
|
inline |
Return GL_SAMPLE_ALPHA_TO_COVERAGE state.
|
inline |
Allow GL_SAMPLE_ALPHA_TO_COVERAGE usage.
void OpenGl_Context::SetCamera | ( | const Handle< Graphic3d_Camera > & | theCamera | ) |
Sets camera object to the context and update matrices.
void OpenGl_Context::SetColor4fv | ( | const OpenGl_Vec4 & | theColor | ) |
Setup current color.
Enable/disable writing into color buffer (wrapper for glColorMask). Alpha component writes will be disabled unconditionally in case of caps->buffersOpaqueAlpha.
void OpenGl_Context::SetColorMaskRGBA | ( | const NCollection_Vec4< bool > & | theToWriteColor | ) |
Enable/disable writing into color buffer (wrapper for glColorMask).
|
inline |
Enable or disable back face culling (glCullFace() + glEnable(GL_CULL_FACE)).
Handle< OpenGl_FrameBuffer > OpenGl_Context::SetDefaultFrameBuffer | ( | const Handle< OpenGl_FrameBuffer > & | theFbo | ) |
Setup new Default Frame Buffer Object and return previously set. This call doesn't change Active FBO!
void OpenGl_Context::SetDrawBuffer | ( | const Standard_Integer | theDrawBuffer | ) |
Switch draw buffer, wrapper for ::glDrawBuffer().
void OpenGl_Context::SetDrawBuffers | ( | const Standard_Integer | theNb, |
const Standard_Integer * | theDrawBuffers | ||
) |
Switch draw buffer, wrapper for ::glDrawBuffers (GLsizei, const GLenum*).
void OpenGl_Context::SetFaceCulling | ( | Graphic3d_TypeOfBackfacingModel | theMode | ) |
Enable or disable back face culling (glEnable (GL_CULL_FACE)).
Enables/disables GL_FRAMEBUFFER_SRGB flag. This flag can be set to:
[in] | theIsFbo | flag indicating writing into offscreen FBO (always expected sRGB-ready when sRGB FBO is supported) or into window buffer (FALSE, sRGB-readiness might vary). |
[in] | theIsFboSRgb | flag indicating off-screen FBO is sRGB-ready |
|
inline |
Set structure holding frame statistics. This call makes sense only if application defines OpenGl_FrameStats sub-class.
Standard_Boolean OpenGl_Context::SetGlNormalizeEnabled | ( | Standard_Boolean | isEnabled | ) |
Sets GL_NORMALIZE enabled or disabled.
|
inline |
Set line feater width.
void OpenGl_Context::SetLineStipple | ( | const Standard_ShortReal | theFactor, |
const uint16_t | thePattern | ||
) |
Setup type of line; wrapper for glLineStipple().
Setup stipple line pattern with 1.0f factor; wrapper for glLineStipple().
void OpenGl_Context::SetLineWidth | ( | const Standard_ShortReal | theWidth | ) |
Setup width of line.
void OpenGl_Context::SetPointSize | ( | const Standard_ShortReal | theSize | ) |
Setup point size.
void OpenGl_Context::SetPointSpriteOrigin | ( | ) |
Setup point sprite origin using GL_POINT_SPRITE_COORD_ORIGIN state:
Sets enabled state of polygon hatching rasterization without affecting currently selected hatching pattern.
Standard_Integer OpenGl_Context::SetPolygonHatchStyle | ( | const Handle< Graphic3d_HatchStyle > & | theStyle | ) |
Sets polygon hatch pattern. Zero-index value is a default alias for solid filling.
theStyle | type of hatch supported by base implementation of OpenGl_LineAttributes (Aspect_HatchStyle) or the type supported by custom implementation derived from OpenGl_LineAttributes class. |
Standard_Integer OpenGl_Context::SetPolygonMode | ( | const Standard_Integer | theMode | ) |
Sets polygon rasterization mode (glPolygonMode() function).
void OpenGl_Context::SetPolygonOffset | ( | const Graphic3d_PolygonOffset & | theOffset | ) |
Sets and applies current polygon offset.
void OpenGl_Context::SetReadBuffer | ( | const Standard_Integer | theReadBuffer | ) |
Switch read buffer, wrapper for ::glReadBuffer().
|
inline |
Switch read/draw buffers.
|
inline |
Set resolution ratio. Note that this method rounds @theRatio to nearest integer.
|
inline |
Set resolution ratio. Note that this method rounds @theRatio to nearest integer.
Enable/disable GL_SAMPLE_ALPHA_TO_COVERAGE.
void OpenGl_Context::SetShadeModel | ( | Graphic3d_TypeOfShadingModel | theModel | ) |
Set GL_SHADE_MODEL value.
void OpenGl_Context::SetShadingMaterial | ( | const OpenGl_Aspects * | theAspect, |
const Handle< Graphic3d_PresentationAttributes > & | theHighlight | ||
) |
Setup current shading material.
Standard_Boolean OpenGl_Context::SetSwapInterval | ( | const Standard_Integer | theInterval | ) |
Setup swap interval (VSync).
void OpenGl_Context::SetTextureMatrix | ( | const Handle< Graphic3d_TextureParams > & | theParams, |
const Standard_Boolean | theIsTopDown | ||
) |
Setup texture matrix to active GLSL program or to FFP global state using glMatrixMode (GL_TEXTURE).
theParams | [in] texture parameters |
theIsTopDown | [in] texture top-down flag |
void OpenGl_Context::SetTypeOfLine | ( | const Aspect_TypeOfLine | theType, |
const Standard_ShortReal | theFactor = 1.0f |
||
) |
Setup type of line.
|
inline |
Overrides if window/surface buffer is sRGB-ready or not (initialized with the context).
|
inline |
|
inline |
Returns texture unit where shadow map is expected to be bound, or 0 if unavailable.
void OpenGl_Context::Share | ( | const Handle< OpenGl_Context > & | theShareCtx | ) |
Share GL context resources. theShareCtx - handle to context to retrieve handles to shared resources.
|
inline |
Return map of shared resources.
Standard_Boolean OpenGl_Context::ShareResource | ( | const TCollection_AsciiString & | theKey, |
const Handle< OpenGl_Resource > & | theResource | ||
) |
Register shared resource. Notice that after registration caller shouldn't release it by himself - it will be automatically released on context destruction.
theKey | - unique identifier, shouldn't be empty; |
theResource | - new resource to register, shouldn't be NULL. |
|
inline |
Return texture unit to be used for sprites (Graphic3d_TextureUnit_PointSprite by default).
|
inline |
Return map of supported texture formats.
void OpenGl_Context::SwapBuffers | ( | ) |
Swap front/back buffers for this GL context (should be activated before!).
|
inline |
|
inline |
Return back face culling state.
|
inline |
Returns TRUE if sRGB rendering is supported and permitted.
|
inline |
Returns true if VBO is supported and permitted.
|
inline |
Convert Quantity_ColorRGBA into vec4 with conversion or no conversion into non-linear sRGB basing on ToRenderSRGB() flag.
|
inline |
Convert Quantity_ColorRGBA into vec4. Quantity_Color is expected to be linear RGB, hence conversion is NOT required.
|
inline |
Convert Quantity_ColorRGBA (linear RGB) into non-linear sRGB vec4.
|
inline |
Return Graphics Driver's vendor.
|
inline |
Return cached GL version major number.
|
inline |
Return cached GL version minor number.
|
inline |
Return cached viewport definition (x, y, width, height).
|
inline |
Return virtual viewport definition (x, y, width, height).
|
inline |
Return window handle currently bound to this OpenGL context (EGLSurface | HWND | GLXDrawable).
void OpenGl_Context::WindowBufferBits | ( | Graphic3d_Vec4i & | theColorBits, |
Graphic3d_Vec2i & | theDepthStencilBits | ||
) | const |
Fetches information about window buffer pixel format.
Standard_Boolean OpenGl_Context::arbClipControl |
GL_ARB_clip_control, in core since 4.5.
OpenGl_ArbDbg* OpenGl_Context::arbDbg |
Standard_Boolean OpenGl_Context::arbDepthClamp |
GL_ARB_depth_clamp (on desktop OpenGL - since 3.2 or as extensions GL_ARB_depth_clamp,NV_depth_clamp; unavailable on OpenGL ES)
Standard_Boolean OpenGl_Context::arbDrawBuffers |
GL_ARB_draw_buffers.
OpenGl_ArbFBO* OpenGl_Context::arbFBO |
GL_ARB_framebuffer_object.
OpenGl_ArbFBOBlit* OpenGl_Context::arbFBOBlit |
glBlitFramebuffer function, moved out from OpenGl_ArbFBO structure for compatibility with OpenGL ES 2.0
OpenGl_ArbIns* OpenGl_Context::arbIns |
Standard_Boolean OpenGl_Context::arbNPTW |
GL_ARB_texture_non_power_of_two.
OpenGl_ArbSamplerObject* OpenGl_Context::arbSamplerObject |
Standard_Boolean OpenGl_Context::arbSampleShading |
GL_ARB_sample_shading.
OpenGl_ArbTBO* OpenGl_Context::arbTBO |
Standard_Boolean OpenGl_Context::arbTboRGB32 |
OpenGl_ArbTexBindless* OpenGl_Context::arbTexBindless |
GL_ARB_bindless_texture.
Standard_Boolean OpenGl_Context::arbTexFloat |
GL_ARB_texture_float (on desktop OpenGL - since 3.0 or as extension GL_ARB_texture_float; on OpenGL ES - since 3.0);.
Standard_Boolean OpenGl_Context::arbTexRG |
GL_ARB_texture_rg.
Standard_Boolean OpenGl_Context::atiMem |
GL_ATI_meminfo.
Handle< OpenGl_Caps > OpenGl_Context::caps |
context options
OpenGl_GlCore11* OpenGl_Context::core11ffp |
OpenGL 1.1 core functionality.
OpenGl_GlCore11Fwd* OpenGl_Context::core11fwd |
OpenGL 1.1 without deprecated entry points.
OpenGl_GlCore15* OpenGl_Context::core15 |
OpenGL 1.5 without deprecated entry points.
OpenGl_GlCore15* OpenGl_Context::core15fwd |
obsolete entry left for code portability; core15 should be used instead
OpenGl_GlCore20* OpenGl_Context::core20 |
OpenGL 2.0 without deprecated entry points.
OpenGl_GlCore20* OpenGl_Context::core20fwd |
obsolete entry left for code portability; core20 should be used instead
OpenGl_GlCore30* OpenGl_Context::core30 |
OpenGL 3.0 without deprecated entry points.
OpenGl_GlCore32* OpenGl_Context::core32 |
OpenGL 3.2 core profile.
OpenGl_GlCore33* OpenGl_Context::core33 |
OpenGL 3.3 core profile.
OpenGl_GlCore41* OpenGl_Context::core41 |
OpenGL 4.1 core profile.
OpenGl_GlCore42* OpenGl_Context::core42 |
OpenGL 4.2 core profile.
OpenGl_GlCore43* OpenGl_Context::core43 |
OpenGL 4.3 core profile.
OpenGl_GlCore44* OpenGl_Context::core44 |
OpenGL 4.4 core profile.
OpenGl_GlCore45* OpenGl_Context::core45 |
OpenGL 4.5 core profile.
OpenGl_GlCore46* OpenGl_Context::core46 |
OpenGL 4.6 core profile.
Standard_Boolean OpenGl_Context::extAnis |
GL_EXT_texture_filter_anisotropic.
Standard_Boolean OpenGl_Context::extBgra |
GL_EXT_bgra or GL_EXT_texture_format_BGRA8888 on OpenGL ES.
Standard_Boolean OpenGl_Context::extDrawBuffers |
GL_EXT_draw_buffers.
Standard_Boolean OpenGl_Context::extFragDepth |
OpenGl_ExtGS* OpenGl_Context::extGS |
GL_EXT_geometry_shader4.
Standard_Boolean OpenGl_Context::extPDS |
GL_EXT_packed_depth_stencil.
Standard_Boolean OpenGl_Context::extTexR16 |
GL_EXT_texture_norm16 on OpenGL ES; always available on desktop.
OpenGl_FeatureFlag OpenGl_Context::hasDrawBuffers |
Standard_Boolean OpenGl_Context::hasFboRenderMipmap |
FBO render target could be non-zero mipmap level of texture.
Standard_Boolean OpenGl_Context::hasFboSRGB |
OpenGl_FeatureFlag OpenGl_Context::hasFlatShading |
Complex flag indicating support of Flat shading (Graphic3d_TypeOfShadingModel_Phong) (always available on desktop; on OpenGL ES - since 3.0 or as extension GL_OES_standard_derivatives)
OpenGl_FeatureFlag OpenGl_Context::hasFloatBuffer |
Complex flag indicating support of float color buffer format (desktop OpenGL 3.0, GL_ARB_color_buffer_float, GL_EXT_color_buffer_float)
OpenGl_FeatureFlag OpenGl_Context::hasGeometryStage |
Standard_Boolean OpenGl_Context::hasGetBufferData |
flag indicating if GetBufferSubData() is supported
OpenGl_FeatureFlag OpenGl_Context::hasGlslBitwiseOps |
OpenGl_FeatureFlag OpenGl_Context::hasHalfFloatBuffer |
Complex flag indicating support of half-float color buffer format (desktop OpenGL 3.0, GL_ARB_color_buffer_float, GL_EXT_color_buffer_half_float)
Standard_Boolean OpenGl_Context::hasHighp |
highp in GLSL ES fragment shader is supported
Standard_Boolean OpenGl_Context::hasPackRowLength |
supporting of GL_PACK_ROW_LENGTH parameters (any desktop OpenGL; OpenGL ES 3.0)
OpenGl_FeatureFlag OpenGl_Context::hasSampleVariables |
Complex flag indicating support of MSAA variables in GLSL shader (desktop OpenGL 4.0, GL_ARB_sample_shading)
Standard_Boolean OpenGl_Context::hasSRGBControl |
sRGB write control (any desktop OpenGL, OpenGL ES + GL_EXT_sRGB_write_control extension)
Standard_Boolean OpenGl_Context::hasTexFloatLinear |
texture-filterable state for 32-bit floating texture formats (always on desktop, GL_OES_texture_float_linear within OpenGL ES)
Standard_Boolean OpenGl_Context::hasTexRGBA8 |
always available on desktop; on OpenGL ES - since 3.0 or as extension GL_OES_rgb8_rgba8
Standard_Boolean OpenGl_Context::hasTexSRGB |
Standard_Boolean OpenGl_Context::hasUintIndex |
GLuint for index buffer is supported (always available on desktop; on OpenGL ES - since 3.0 or as extension GL_OES_element_index_uint)
Standard_Boolean OpenGl_Context::hasUnpackRowLength |
supporting of GL_UNPACK_ROW_LENGTH parameters (any desktop OpenGL; OpenGL ES 3.0)
OpenGl_MatrixState<Standard_ShortReal> OpenGl_Context::ModelWorldState |
state of orientation matrix
Standard_Boolean OpenGl_Context::nvxMem |
GL_NVX_gpu_memory_info.
Standard_Boolean OpenGl_Context::oesSampleVariables |
GL_OES_sample_variables.
Standard_Boolean OpenGl_Context::oesStdDerivatives |
GL_OES_standard_derivatives.
OpenGl_MatrixState<Standard_ShortReal> OpenGl_Context::ProjectionState |
state of projection matrix
OpenGl_MatrixState<Standard_ShortReal> OpenGl_Context::WorldViewState |
state of orientation matrix