OCCT3D OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    OpenGl_Context Class Reference

    This class generalize access to the GL context and available extensions. More...

    #include <OpenGl_Context.hxx>

    Inheritance diagram for OpenGl_Context:

    Public Types

    typedef NCollection_Shared< NCollection_DataMap< TCollection_AsciiString, occ::handle< OpenGl_Resource > > > OpenGl_ResourcesMap
    typedef void base_type
     Returns a type descriptor about this object.

    Public Member Functions

     OpenGl_Context (const occ::handle< OpenGl_Caps > &theCaps=nullptr)
     Empty constructor. You should call Init() to perform initialization with bound GL context.
     ~OpenGl_Context () override
     Destructor.
    void forcedRelease ()
     Release all resources, including shared ones.
    void Share (const occ::handle< OpenGl_Context > &theShareCtx)
     Share GL context resources. theShareCtx - handle to context to retrieve handles to shared resources.
    bool Init (const bool theIsCoreProfile=false)
     Initialize class from currently bound OpenGL context. Method should be called only once.
    bool IsValid () const
    bool Init (const Aspect_Drawable theSurface, const Aspect_Display theDisplay, const Aspect_RenderingContext theContext, const bool theIsCoreProfile=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*).
    bool CheckExtension (const char *theExtName) const
     Check if theExtName extension is supported by active GL context.
    template<typename FuncType_t>
    bool 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>
    bool 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.
    bool IsGlGreaterEqual (const int theVerMajor, const int theVerMinor) const
    int VersionMajor () const
     Return cached GL version major number.
    int VersionMinor () const
     Return cached GL version minor number.
    const OpenGl_GlFunctionsFunctions () 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).
    bool IsCurrent () const
     This method uses system-dependent API to retrieve information about GL context bound to the current thread.
    bool 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!).
    bool SetSwapInterval (const int theInterval)
     Setup swap interval (VSync).
    bool IsRender () const
     Return true if active mode is GL_RENDER (cached state).
    bool IsFeedback () const
     Return true if active mode is GL_FEEDBACK (cached state).
    size_t 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 (NCollection_IndexedDataMap< TCollection_AsciiString, TCollection_AsciiString > &theDict) const
     This function retrieves information from GL about GPU memory.
    void DiagnosticInformation (NCollection_IndexedDataMap< TCollection_AsciiString, TCollection_AsciiString > &theDict, Graphic3d_DiagnosticInfo theFlags) const
     Fill in the dictionary with OpenGL info. Should be called with bound context.
    void WindowBufferBits (NCollection_Vec4< int > &theColorBits, NCollection_Vec2< int > &theDepthStencilBits) const
     Fetches information about window buffer pixel format.
    const occ::handle< OpenGl_Resource > & GetResource (const TCollection_AsciiString &theKey) const
     Access shared resource by its name.
    template<typename TheHandleType>
    bool GetResource (const TCollection_AsciiString &theKey, TheHandleType &theValue) const
     Access shared resource by its name.
    bool ShareResource (const TCollection_AsciiString &theKey, const occ::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 bool theToDelay=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 (occ::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_ResourcesMapSharedResources () const
     Return map of shared resources.
    OpenGl_ClippingChangeClipping ()
    const OpenGl_ClippingClipping () const
    const occ::handle< OpenGl_ShaderManager > & ShaderManager () const
    int TextureWrapClamp () const
     Either GL_CLAMP_TO_EDGE (1.2+) or GL_CLAMP (1.1).
    bool HasTextureBaseLevel () const
    const occ::handle< Image_SupportedFormats > & SupportedTextureFormats () const
     Return map of supported texture formats.
    int MaxDegreeOfAnisotropy () const
    int MaxTextureSize () const
    int MaxCombinedTextureUnits () const
    int 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).
    bool HasTextureMultisampling () const
    int MaxMsaaSamples () const
    int MaxDumpSizeX () const
    int MaxDumpSizeY () const
    int MaxDrawBuffers () const
    int MaxColorAttachments () const
    int 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).
    bool HasRayTracing () const
    bool HasRayTracingTextures () const
    bool HasRayTracingAdaptiveSampling () const
    bool 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.
    NCollection_Vec4< float > Vec4FromQuantityColor (const NCollection_Vec4< float > &theColor) const
     Convert Quantity_ColorRGBA into vec4 with conversion or no conversion into non-linear sRGB basing on ToRenderSRGB() flag.
    const NCollection_Vec4< float > & Vec4LinearFromQuantityColor (const NCollection_Vec4< float > &theColor) const
     Convert Quantity_ColorRGBA into vec4. Quantity_Color is expected to be linear RGB, hence conversion is NOT required.
    NCollection_Vec4< float > Vec4sRGBFromQuantityColor (const NCollection_Vec4< float > &theColor) const
     Convert Quantity_ColorRGBA (linear RGB) into non-linear sRGB vec4.
    bool 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.
    bool IsGlNormalizeEnabled () const
    bool SetGlNormalizeEnabled (bool isEnabled)
     Sets GL_NORMALIZE enabled or disabled.
    int PolygonMode () const
    int SetPolygonMode (const int 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.
    int PolygonHatchStyle () const
    int SetPolygonHatchStyle (const occ::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_PolygonOffsetPolygonOffset () const
     Returns currently applied polygon offset parameters.
    const occ::handle< Graphic3d_Camera > & Camera () const
     Returns camera object.
    void SetCamera (const occ::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 occ::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.
    bool ExcludeMessage (const unsigned int theSource, const unsigned int theId)
     Adds a filter for messages with theId and theSource (GL_DEBUG_SOURCE_).
    bool IncludeMessage (const unsigned int theSource, const unsigned int theId)
     Removes a filter for messages with theId and theSource (GL_DEBUG_SOURCE_).
    bool HasStereoBuffers () const
    Public Member Functions inherited from Standard_Transient
     Standard_Transient ()
     Empty constructor.
     Standard_Transient (const Standard_Transient &)
     Copy constructor – does nothing.
    Standard_Transientoperator= (const Standard_Transient &)
     Assignment operator, needed to avoid copying reference counter.
    virtual ~Standard_Transient ()=default
     Destructor must be virtual.
    virtual const opencascade::handle< Standard_Type > & DynamicType () const
     Returns a type descriptor about this object.
    bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
     Returns a true value if this is an instance of Type.
    bool IsInstance (const char *const theTypeName) const
     Returns a true value if this is an instance of TypeName.
    bool 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.
    bool IsKind (const char *const 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_TransientThis () 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.
    int GetRefCount () const noexcept
     Get the reference counter of this object.
    void IncrementRefCounter () noexcept
     Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
    int DecrementRefCounter () noexcept
     Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
    virtual void Delete () const
     Memory deallocator for transient classes.

    Static Public Member Functions

    static int GetPowerOfTwo (const int theNumber, const int theThreshold)
     Function for getting power of to number larger or equal to input number.
    static TCollection_AsciiString FormatGlEnumHex (int theGlEnum)
     Format GL constant as hex value 0xABCD.
    static TCollection_AsciiString FormatPointer (const void *thePtr)
     Format pointer as hex value 0xABCD.
    static TCollection_AsciiString FormatSize (size_t theSize)
     Format size value.
    static TCollection_AsciiString FormatGlError (int theGlError)
     Return text description of GL error.
    static void ReadGlVersion (int &theGlVerMajor, int &theGlVerMinor)
     Read OpenGL version information from active context.
    static bool CheckExtension (const char *theExtString, const char *theExtName)
     Check if theExtName extension is in extensions string.
    static constexpr const char * get_type_name ()
     Returns a type descriptor about this object.
    static const opencascade::handle< Standard_Type > & get_type_descriptor ()
     Returns type descriptor of Standard_Transient class.

    Data Fields

    core profiles
    OpenGl_GlCore11core11ffp
     OpenGL 1.1 core functionality.
    OpenGl_GlCore11Fwdcore11fwd
     OpenGL 1.1 without deprecated entry points.
    OpenGl_GlCore15core15
     OpenGL 1.5 without deprecated entry points.
    OpenGl_GlCore20core20
     OpenGL 2.0 without deprecated entry points.
    OpenGl_GlCore30core30
     OpenGL 3.0 without deprecated entry points.
    OpenGl_GlCore32core32
     OpenGL 3.2 core profile.
    OpenGl_GlCore33core33
     OpenGL 3.3 core profile.
    OpenGl_GlCore41core41
     OpenGL 4.1 core profile.
    OpenGl_GlCore42core42
     OpenGL 4.2 core profile.
    OpenGl_GlCore43core43
     OpenGL 4.3 core profile.
    OpenGl_GlCore44core44
     OpenGL 4.4 core profile.
    OpenGl_GlCore45core45
     OpenGL 4.5 core profile.
    OpenGl_GlCore46core46
     OpenGL 4.6 core profile.
    OpenGl_GlCore15core15fwd
     obsolete entry left for code portability; core15 should be used instead
    OpenGl_GlCore20core20fwd
     obsolete entry left for code portability; core20 should be used instead
    occ::handle< OpenGl_Capscaps
     context options
    extensions
    bool hasGetBufferData
     flag indicating if GetBufferSubData() is supported
    bool hasPackRowLength
     supporting of GL_PACK_ROW_LENGTH parameters (any desktop OpenGL; OpenGL ES 3.0)
    bool hasUnpackRowLength
     supporting of GL_UNPACK_ROW_LENGTH parameters (any desktop OpenGL; OpenGL ES 3.0)
    bool hasHighp
     highp in GLSL ES fragment shader is supported
    bool 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).
    bool hasTexRGBA8
     always available on desktop; on OpenGL ES - since 3.0 or as extension GL_OES_rgb8_rgba8
    bool hasTexFloatLinear
     texture-filterable state for 32-bit floating texture formats (always on desktop, GL_OES_texture_float_linear within OpenGL ES)
    bool hasTexSRGB
     sRGB texture formats (desktop OpenGL 2.1, OpenGL ES 3.0 or OpenGL ES 2.0 + GL_EXT_sRGB)
    bool hasFboSRGB
     sRGB FBO render targets (desktop OpenGL 2.1, OpenGL ES 3.0)
    bool hasSRGBControl
     sRGB write control (any desktop OpenGL, OpenGL ES + GL_EXT_sRGB_write_control extension)
    bool 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).
    bool arbDrawBuffers
     GL_ARB_draw_buffers.
    bool arbNPTW
     GL_ARB_texture_non_power_of_two.
    bool arbTexRG
     GL_ARB_texture_rg.
    bool 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_ArbSamplerObjectarbSamplerObject
     GL_ARB_sampler_objects (on desktop OpenGL - since 3.3 or as extension GL_ARB_sampler_objects; on OpenGL ES - since 3.0).
    OpenGl_ArbTexBindlessarbTexBindless
     GL_ARB_bindless_texture.
    OpenGl_ArbTBOarbTBO
     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).
    bool arbTboRGB32
     GL_ARB_texture_buffer_object_rgb32 (3-component TBO), in core since 4.0 (on OpenGL ES - since 3.2).
    bool arbClipControl
     GL_ARB_clip_control, in core since 4.5.
    OpenGl_ArbInsarbIns
     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_ArbDbgarbDbg
     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_ArbFBOarbFBO
     GL_ARB_framebuffer_object.
    OpenGl_ArbFBOBlitarbFBOBlit
     glBlitFramebuffer function, moved out from OpenGl_ArbFBO structure for compatibility with OpenGL ES 2.0
    bool arbSampleShading
     GL_ARB_sample_shading.
    bool 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).
    bool extFragDepth
     GL_EXT_frag_depth on OpenGL ES 2.0 (gl_FragDepthEXT built-in variable, before OpenGL ES 3.0).
    bool extDrawBuffers
     GL_EXT_draw_buffers.
    OpenGl_ExtGSextGS
     GL_EXT_geometry_shader4.
    bool extBgra
     GL_EXT_bgra or GL_EXT_texture_format_BGRA8888 on OpenGL ES.
    bool extTexR16
     GL_EXT_texture_norm16 on OpenGL ES; always available on desktop.
    bool extAnis
     GL_EXT_texture_filter_anisotropic.
    bool extPDS
     GL_EXT_packed_depth_stencil.
    bool atiMem
     GL_ATI_meminfo.
    bool nvxMem
     GL_NVX_gpu_memory_info.
    bool oesSampleVariables
     GL_OES_sample_variables.
    bool oesStdDerivatives
     GL_OES_standard_derivatives.

    public properties tracking current state

    OpenGl_MatrixState< float > ModelWorldState
     state of orientation matrix
    OpenGl_MatrixState< float > WorldViewState
     state of orientation matrix
    OpenGl_MatrixState< float > ProjectionState
     state of projection matrix

    methods to alter or retrieve current state

    Return structure holding frame statistics.

    static bool CheckIsTransparent (const OpenGl_Aspects *theAspect, const occ::handle< Graphic3d_PresentationAttributes > &theHighlight, float &theAlphaFront, float &theAlphaBack)
     Checks if transparency is required for the given aspect and highlight style.
    static bool CheckIsTransparent (const OpenGl_Aspects *theAspect, const occ::handle< Graphic3d_PresentationAttributes > &theHighlight)
     Checks if transparency is required for the given aspect and highlight style.
    const occ::handle< OpenGl_FrameStats > & FrameStats () const
     Checks if transparency is required for the given aspect and highlight style.
    void SetFrameStats (const occ::handle< OpenGl_FrameStats > &theStats)
     Set structure holding frame statistics. This call makes sense only if application defines OpenGl_FrameStats sub-class.
    const int * Viewport () const
     Return cached viewport definition (x, y, width, height).
    void ResizeViewport (const int theRect[4])
     Resize the viewport (alias for glViewport).
    const int * VirtualViewport () const
     Return virtual viewport definition (x, y, width, height).
    int ReadBuffer ()
     Return active read buffer.
    void SetReadBuffer (const int theReadBuffer)
     Switch read buffer, wrapper for ::glReadBuffer().
    int DrawBuffer (int theIndex=0) const
     Return active draw buffer attached to a render target referred by index (layout location).
    void SetDrawBuffer (const int theDrawBuffer)
     Switch draw buffer, wrapper for ::glDrawBuffer().
    void SetDrawBuffers (const int theNb, const int *theDrawBuffers)
     Switch draw buffer, wrapper for ::glDrawBuffers (GLsizei, const GLenum*).
    void SetReadDrawBuffer (const int 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 occ::handle< OpenGl_TextureSet > & ActiveTextures () const
    occ::handle< OpenGl_TextureSetBindTextures (const occ::handle< OpenGl_TextureSet > &theTextures)
     Bind specified texture set to current context taking into account active GLSL program.
    occ::handle< OpenGl_TextureSetBindTextures (const occ::handle< OpenGl_TextureSet > &theTextures, const occ::handle< OpenGl_ShaderProgram > &theProgram)
     Bind specified texture set to current context, or unbind previous one when NULL specified.
    const occ::handle< OpenGl_ShaderProgram > & ActiveProgram () const
    bool BindProgram (const occ::handle< OpenGl_ShaderProgram > &theProgram)
     Bind specified program to current context, or unbind previous one when NULL specified.
    void SetShadingMaterial (const OpenGl_Aspects *theAspect, const occ::handle< Graphic3d_PresentationAttributes > &theHighlight)
     Setup current shading material.
    void SetColor4fv (const NCollection_Vec4< float > &theColor)
     Setup current color.
    void SetColor4fv (const NCollection_Vec4< float > &theFrontColor, const NCollection_Vec4< float > &theBackColor)
     Setup current front and back colors.
    void SetTypeOfLine (const Aspect_TypeOfLine theType, const float 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 float theFactor, const uint16_t thePattern)
     Setup type of line; wrapper for glLineStipple().
    void SetLineWidth (const float theWidth)
     Setup width of line.
    void SetPointSize (const float theSize)
     Setup point size.
    void SetPointSpriteOrigin ()
     Setup point sprite origin using GL_POINT_SPRITE_COORD_ORIGIN state:
    void SetTextureMatrix (const occ::handle< Graphic3d_TextureParams > &theParams, const bool 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 occ::handle< OpenGl_FrameBuffer > & DefaultFrameBuffer () const
     Default Frame Buffer Object.
    occ::handle< OpenGl_FrameBufferSetDefaultFrameBuffer (const occ::handle< OpenGl_FrameBuffer > &theFbo)
     Setup new Default Frame Buffer Object and return previously set. This call doesn't change Active FBO!
    bool 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.
    float 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).
    float RenderScale () const
     Rendering scale factor (rendering viewport height to real window buffer height).
    bool HasRenderScale () const
     Return TRUE if rendering scale factor is not 1.
    float RenderScaleInv () const
     Rendering scale factor (inverted value).
    float LineWidthScale () const
     Return scale factor for line width.
    void SetResolution (unsigned int theResolution, float theRatio, float theScale)
     Set resolution ratio. Note that this method rounds @theRatio to nearest integer.
    void SetResolutionRatio (const float theRatio)
     Set resolution ratio. Note that this method rounds @theRatio to nearest integer.
    float LineFeather () const
     Return line feater width in pixels.
    void SetLineFeather (float 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_AsciiStringVendor () const
     Return Graphics Driver's vendor.
    void DumpJson (Standard_OStream &theOStream, int theDepth=-1) const
     Dumps the content of me into the stream.
    void DumpJsonOpenGlState (Standard_OStream &theOStream, int theDepth=-1)
     Dumps the content of openGL state into the stream.
    void SetShadeModel (Graphic3d_TypeOfShadingModel theModel)
     Set GL_SHADE_MODEL value.

    Detailed Description

    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:

    if (myContext->core20 != NULL)
    {
    myGlProgram = myContext->core20->glCreateProgram();
    .. do more stuff ..
    }
    else
    {
    .. compatibility with outdated configurations ..
    }

    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:

    • Determine the minimal OpenGL version required for implemented functionality and use it to access all functions. For example, if algorithm requires OpenGL 2.1+, it is better to write core20fwd->glEnable() rather than core11fwd->glEnable() for uniformity.
    • Validate minimal requirements at initialization/creation time and omit checks within code where algorithm should be already initialized. Properly escape code incompatible with Core Profile. The simplest way to check Core Profile is "if (core11ffp == NULL)".

    Simplified extensions classification:

    • prefixed with NV, AMD, ATI are vendor-specific (however may be provided by other vendors in some cases);
    • prefixed with EXT are accepted by 2+ vendors;
    • prefixed with ARB are accepted by Architecture Review Board and are candidates for inclusion into GL core functionality. Some functionality can be represented in several extensions simultaneously. In this case developer should be careful because different specification may differ in aspects (like enumeration values and error-handling).

    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.

    Member Typedef Documentation

    ◆ OpenGl_ResourcesMap

    Constructor & Destructor Documentation

    ◆ OpenGl_Context()

    OpenGl_Context::OpenGl_Context ( const occ::handle< OpenGl_Caps > & theCaps = nullptr)

    Empty constructor. You should call Init() to perform initialization with bound GL context.

    ◆ ~OpenGl_Context()

    OpenGl_Context::~OpenGl_Context ( )
    override

    Destructor.

    Member Function Documentation

    ◆ ActiveProgram()

    const occ::handle< OpenGl_ShaderProgram > & OpenGl_Context::ActiveProgram ( ) const
    inline
    Returns
    active GLSL program

    ◆ ActiveTextures()

    const occ::handle< OpenGl_TextureSet > & OpenGl_Context::ActiveTextures ( ) const
    inline
    Returns
    active textures

    ◆ AllowSampleAlphaToCoverage()

    bool OpenGl_Context::AllowSampleAlphaToCoverage ( ) const
    inline

    Return TRUE if GL_SAMPLE_ALPHA_TO_COVERAGE usage is allowed.

    ◆ ApplyModelViewMatrix()

    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.

    ◆ ApplyModelWorldMatrix()

    void OpenGl_Context::ApplyModelWorldMatrix ( )

    Applies matrix into shader manager stored in ModelWorldState to OpenGl. In "model -> world -> view -> projection" it performs: model -> world.

    ◆ ApplyProjectionMatrix()

    void OpenGl_Context::ApplyProjectionMatrix ( )

    Applies matrix stored in ProjectionState to OpenGl. In "model -> world -> view -> projection" it performs: view -> projection.

    ◆ ApplyWorldViewMatrix()

    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.

    ◆ AvailableMemory()

    size_t OpenGl_Context::AvailableMemory ( ) const

    This function retrieves information from GL about free GPU memory that is:

    • OS-dependent. On some OS it is per-process and on others - for entire system.
    • Vendor-dependent. Currently available only on NVIDIA and AMD/ATi drivers only.
    • Numbers meaning may vary. You should use this info only for diagnostics purposes.
      Returns
      free GPU dedicated memory in bytes.

    ◆ BindDefaultVao()

    void OpenGl_Context::BindDefaultVao ( )

    Bind default Vertex Array Object.

    ◆ BindProgram()

    bool OpenGl_Context::BindProgram ( const occ::handle< OpenGl_ShaderProgram > & theProgram)

    Bind specified program to current context, or unbind previous one when NULL specified.

    Returns
    true if some program is bound to context

    ◆ BindTextures() [1/2]

    occ::handle< OpenGl_TextureSet > OpenGl_Context::BindTextures ( const occ::handle< OpenGl_TextureSet > & theTextures)
    inline

    Bind specified texture set to current context taking into account active GLSL program.

    Deprecated
    ("BindTextures() with explicit GLSL program should be used instead")

    ◆ BindTextures() [2/2]

    occ::handle< OpenGl_TextureSet > OpenGl_Context::BindTextures ( const occ::handle< OpenGl_TextureSet > & theTextures,
    const occ::handle< OpenGl_ShaderProgram > & theProgram )

    Bind specified texture set to current context, or unbind previous one when NULL specified.

    Parameters
    [in]theTexturestexture set to bind
    [in]theProgramprogram attributes; when not NULL, mock textures will be bound to texture units expected by GLSL program, but undefined by texture set
    Returns
    previous texture set

    ◆ Camera()

    const occ::handle< Graphic3d_Camera > & OpenGl_Context::Camera ( ) const
    inline

    Returns camera object.

    ◆ ChangeClipping()

    OpenGl_Clipping & OpenGl_Context::ChangeClipping ( )
    inline
    Returns
    tool for management of clippings within this context.

    ◆ CheckExtension() [1/2]

    bool OpenGl_Context::CheckExtension ( const char * theExtName) const

    Check if theExtName extension is supported by active GL context.

    ◆ CheckExtension() [2/2]

    bool OpenGl_Context::CheckExtension ( const char * theExtString,
    const char * theExtName )
    static

    Check if theExtName extension is in extensions string.

    ◆ CheckIsTransparent() [1/2]

    bool OpenGl_Context::CheckIsTransparent ( const OpenGl_Aspects * theAspect,
    const occ::handle< Graphic3d_PresentationAttributes > & theHighlight )
    inlinestatic

    Checks if transparency is required for the given aspect and highlight style.

    ◆ CheckIsTransparent() [2/2]

    bool OpenGl_Context::CheckIsTransparent ( const OpenGl_Aspects * theAspect,
    const occ::handle< Graphic3d_PresentationAttributes > & theHighlight,
    float & theAlphaFront,
    float & theAlphaBack )
    static

    Checks if transparency is required for the given aspect and highlight style.

    ◆ Clipping()

    const OpenGl_Clipping & OpenGl_Context::Clipping ( ) const
    inline
    Returns
    tool for management of clippings within this context.

    ◆ ColorMask()

    bool OpenGl_Context::ColorMask ( ) const
    inline

    Return cached flag indicating writing into color buffer is enabled or disabled (glColorMask).

    ◆ ColorMaskRGBA()

    const NCollection_Vec4< bool > & OpenGl_Context::ColorMaskRGBA ( ) const
    inline

    Return cached flag indicating writing into color buffer is enabled or disabled (glColorMask).

    ◆ DefaultFrameBuffer()

    const occ::handle< OpenGl_FrameBuffer > & OpenGl_Context::DefaultFrameBuffer ( ) const
    inline

    Default Frame Buffer Object.

    ◆ DelayedRelease()

    template<class T>
    void OpenGl_Context::DelayedRelease ( occ::handle< T > & theResource)
    inline

    Append resource to queue for delayed clean up. Resources in this queue will be released at next redraw call.

    ◆ DepthPeelingDepthTexUnit()

    Graphic3d_TextureUnit OpenGl_Context::DepthPeelingDepthTexUnit ( ) const
    inline

    Returns texture unit for occDepthPeelingDepth within enabled Depth Peeling.

    ◆ DepthPeelingFrontColorTexUnit()

    Graphic3d_TextureUnit OpenGl_Context::DepthPeelingFrontColorTexUnit ( ) const
    inline

    Returns texture unit for occDepthPeelingFrontColor within enabled Depth Peeling.

    ◆ DiagnosticInformation()

    void OpenGl_Context::DiagnosticInformation ( NCollection_IndexedDataMap< TCollection_AsciiString, TCollection_AsciiString > & theDict,
    Graphic3d_DiagnosticInfo theFlags ) const

    Fill in the dictionary with OpenGL info. Should be called with bound context.

    ◆ DisableFeatures()

    void OpenGl_Context::DisableFeatures ( ) const

    Checks if transparency is required for the given aspect and highlight style.

    ◆ DrawBuffer()

    int OpenGl_Context::DrawBuffer ( int theIndex = 0) const
    inline

    Return active draw buffer attached to a render target referred by index (layout location).

    ◆ DumpJson()

    void OpenGl_Context::DumpJson ( Standard_OStream & theOStream,
    int theDepth = -1 ) const

    Dumps the content of me into the stream.

    ◆ DumpJsonOpenGlState()

    void OpenGl_Context::DumpJsonOpenGlState ( Standard_OStream & theOStream,
    int theDepth = -1 )

    Dumps the content of openGL state into the stream.

    ◆ EnableFeatures()

    void OpenGl_Context::EnableFeatures ( ) const

    Checks if transparency is required for the given aspect and highlight style.

    ◆ ExcludeMessage()

    bool OpenGl_Context::ExcludeMessage ( const unsigned int theSource,
    const unsigned int theId )

    Adds a filter for messages with theId and theSource (GL_DEBUG_SOURCE_).

    ◆ FaceCulling()

    Graphic3d_TypeOfBackfacingModel OpenGl_Context::FaceCulling ( ) const
    inline

    Return back face culling state.

    ◆ FetchState()

    void OpenGl_Context::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.

    ◆ FindProc()

    template<typename FuncType_t>
    bool OpenGl_Context::FindProc ( const char * theFuncName,
    FuncType_t & theFuncPtr )
    inline

    Auxiliary template to retrieve GL function pointer. Same as FindProcVerbose() but without auxiliary last function name argument.

    ◆ FindProcVerbose()

    template<typename FuncType_t>
    bool OpenGl_Context::FindProcVerbose ( const char *& theLastFailFuncName,
    const char * theFuncName,
    FuncType_t & theFuncPtr )
    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.

    Parameters
    [out]theLastFailFuncNameset to theFuncName in case of failure, unmodified on success
    [in]theFuncNamefunction name to find
    [out]theFuncPtrretrieved function pointer
    Returns
    TRUE on success

    ◆ forcedRelease()

    void OpenGl_Context::forcedRelease ( )

    Release all resources, including shared ones.

    ◆ FormatGlEnumHex()

    TCollection_AsciiString OpenGl_Context::FormatGlEnumHex ( int theGlEnum)
    static

    Format GL constant as hex value 0xABCD.

    ◆ FormatGlError()

    TCollection_AsciiString OpenGl_Context::FormatGlError ( int theGlError)
    static

    Return text description of GL error.

    ◆ FormatPointer()

    TCollection_AsciiString OpenGl_Context::FormatPointer ( const void * thePtr)
    static

    Format pointer as hex value 0xABCD.

    ◆ FormatSize()

    TCollection_AsciiString OpenGl_Context::FormatSize ( size_t theSize)
    static

    Format size value.

    ◆ FrameStats()

    const occ::handle< OpenGl_FrameStats > & OpenGl_Context::FrameStats ( ) const
    inline

    Checks if transparency is required for the given aspect and highlight style.

    ◆ Functions()

    const OpenGl_GlFunctions * OpenGl_Context::Functions ( ) const
    inline

    Access entire map of loaded OpenGL functions.

    ◆ GetBufferSubData()

    bool OpenGl_Context::GetBufferSubData ( unsigned int theTarget,
    intptr_t theOffset,
    intptr_t theSize,
    void * theData )

    Wrapper over glGetBufferSubData(), implemented as:

    • OpenGL 1.5+ (desktop) via glGetBufferSubData();
    • OpenGL ES 3.0+ via glMapBufferRange();
    • WebGL 2.0+ via gl.getBufferSubData().
      Parameters
      [in]theTargettarget buffer to map {GLenum}
      [in]theOffsetoffset to the beginning of sub-data {GLintptr}
      [in]theSizenumber of bytes to read {GLsizeiptr}
      [out]theDatadestination pointer to fill
      Returns
      FALSE if functionality is unavailable

    ◆ GetDisplay()

    Aspect_Display OpenGl_Context::GetDisplay ( ) const
    inline

    Return display / window device context (EGLDisplay | HDC | Display*).

    ◆ GetPowerOfTwo()

    int OpenGl_Context::GetPowerOfTwo ( const int theNumber,
    const int theThreshold )
    inlinestatic

    Function for getting power of to number larger or equal to input number.

    Parameters
    theNumbernumber to 'power of two'
    theThresholdupper threshold
    Returns
    power of two number

    ◆ GetResource() [1/2]

    const occ::handle< OpenGl_Resource > & OpenGl_Context::GetResource ( const TCollection_AsciiString & theKey) const

    Access shared resource by its name.

    Parameters
    theKey- unique identifier;
    Returns
    handle to shared resource or NULL.

    ◆ GetResource() [2/2]

    template<typename TheHandleType>
    bool OpenGl_Context::GetResource ( const TCollection_AsciiString & theKey,
    TheHandleType & theValue ) const
    inline

    Access shared resource by its name.

    Parameters
    theKey- unique identifier;
    theValue- handle to fill;
    Returns
    true if resource was shared.

    ◆ GraphicsLibrary()

    Aspect_GraphicsLibrary OpenGl_Context::GraphicsLibrary ( ) const
    inline

    Return active graphics library.

    ◆ HasPBR()

    bool OpenGl_Context::HasPBR ( ) const
    inline

    Returns TRUE if PBR shading model is supported. Basically, feature requires OpenGL 3.0+ / OpenGL ES 3.0+ hardware; more precisely:

    • Graphics hardware with moderate capabilities for compiling long enough GLSL program.
    • FBO (e.g. for baking environment).
    • Multi-texturing with >= 4 units (LUT and IBL textures).
    • GL_RG32F texture format (arbTexRG + arbTexFloat)
    • Cubemap texture lookup textureCubeLod()/textureLod() with LOD index within Fragment Shader, which requires GLSL OpenGL 3.0+ / OpenGL ES 3.0+ or OpenGL 2.1 + GL_EXT_gpu_shader4 extension.

    ◆ HasRayTracing()

    bool OpenGl_Context::HasRayTracing ( ) const
    inline
    Returns
    TRUE if ray tracing mode is supported

    ◆ HasRayTracingAdaptiveSampling()

    bool OpenGl_Context::HasRayTracingAdaptiveSampling ( ) const
    inline
    Returns
    TRUE if adaptive screen sampling in ray tracing mode is supported

    ◆ HasRayTracingAdaptiveSamplingAtomic()

    bool OpenGl_Context::HasRayTracingAdaptiveSamplingAtomic ( ) const
    inline
    Returns
    TRUE if atomic adaptive screen sampling in ray tracing mode is supported

    ◆ HasRayTracingTextures()

    bool OpenGl_Context::HasRayTracingTextures ( ) const
    inline
    Returns
    TRUE if textures in ray tracing mode are supported

    ◆ HasRenderScale()

    bool OpenGl_Context::HasRenderScale ( ) const
    inline

    Return TRUE if rendering scale factor is not 1.

    ◆ HasSRGB()

    bool OpenGl_Context::HasSRGB ( ) const
    inline

    Returns TRUE if sRGB rendering is supported.

    ◆ HasStereoBuffers()

    bool OpenGl_Context::HasStereoBuffers ( ) const
    inline
    Returns
    true if OpenGl context supports left and right rendering buffers.

    ◆ HasTextureBaseLevel()

    bool OpenGl_Context::HasTextureBaseLevel ( ) const
    inline
    Returns
    true if texture parameters GL_TEXTURE_BASE_LEVEL/GL_TEXTURE_MAX_LEVEL are supported.

    ◆ HasTextureMultisampling()

    bool OpenGl_Context::HasTextureMultisampling ( ) const
    inline
    Returns
    true if MSAA textures are supported.

    ◆ IncludeMessage()

    bool OpenGl_Context::IncludeMessage ( const unsigned int theSource,
    const unsigned int theId )

    Removes a filter for messages with theId and theSource (GL_DEBUG_SOURCE_).

    ◆ Init() [1/2]

    bool OpenGl_Context::Init ( const Aspect_Drawable theSurface,
    const Aspect_Display theDisplay,
    const Aspect_RenderingContext theContext,
    const bool theIsCoreProfile = false )

    Initialize class from specified surface and rendering context. Method should be called only once. The meaning of parameters is platform-specific.

    EGL:

    EGLSurface theEglSurf = eglCreateWindowSurface (theEglDisp, anEglConfig,
    (EGLNativeWindowType )theAspWin->NativeHandle(), NULL); EGLDisplay theEglDisp =
    eglGetDisplay (EGL_DEFAULT_DISPLAY); EGLContext theEglCtx = eglCreateContext ((EGLDisplay
    )theEglDisp, anEglConfig, EGL_NO_CONTEXT, anEglCtxAttribs); occ::handle<OpenGl_Context>
    aGlCtx = new OpenGl_Context(); aGlCtx->Init ((Aspect_Drawable )theEglSurf, (Aspect_Display
    )theEglDisp, (Aspect_RenderingContext )theEglCtx);
    void * Aspect_Display
    Definition Aspect_Display.hxx:25
    unsigned long Aspect_Drawable
    Definition Aspect_Drawable.hxx:28
    void * Aspect_RenderingContext
    Definition Aspect_RenderingContext.hxx:46
    OpenGl_Context(const occ::handle< OpenGl_Caps > &theCaps=nullptr)
    Empty constructor. You should call Init() to perform initialization with bound GL context.
    opencascade::handle< T > handle
    Intrusive smart pointer template for Standard_Transient descendants. This is an alias to opencascade:...
    Definition Standard_Handle.hxx:421

    Windows (Win32):

    HWND theWindow = (HWND )theAspWin->NativeHandle();
    HDC theDevCtx = GetDC(theWindow);
    HGLRC theGContext = wglCreateContext (theDevCtx);
    aGlCtx->Init ((Aspect_Drawable )theWindow, (Aspect_Display )theDevCtx,
    (Aspect_RenderingContext )theGContext);

    Linux (Xlib):

    Window theXWindow = (Window )theAspWin->NativeHandle();
    Display* theXDisp = (Display* )theAspWin->DisplayConnection()->GetDisplayAspect();
    GLXContext theGlxCtx = glXCreateContext (theXDisp, aVis.get(), NULL, GL_TRUE);
    aGlCtx->Init ((Aspect_Drawable )theXWindow, (Aspect_Display )theXDisp,
    #define GL_TRUE
    Definition OpenGl_GlTypes.hxx:81
    Aspect_Drawable Window() const
    Return window handle currently bound to this OpenGL context (EGLSurface | HWND | GLXDrawable).
    Definition OpenGl_Context.hxx:265
    Parameters
    [in]theSurfacesurface / window (EGLSurface | HWND | GLXDrawable/Window)
    [in]theDisplaydisplay or device context (EGLDisplay | HDC | Display*)
    [in]theContextrendering context (EGLContext | HGLRC | GLXContext | EAGLContext* | NSOpenGLContext*)
    [in]theIsCoreProfileflag indicating that passed GL rendering context has been created with Core Profile
    Returns
    false if OpenGL context can not be bound to specified surface

    ◆ Init() [2/2]

    bool OpenGl_Context::Init ( const bool theIsCoreProfile = false)

    Initialize class from currently bound OpenGL context. Method should be called only once.

    Returns
    false if no GL context is bound to the current thread

    ◆ IsCurrent()

    bool OpenGl_Context::IsCurrent ( ) const

    This method uses system-dependent API to retrieve information about GL context bound to the current thread.

    Returns
    true if current thread is bound to this GL context

    ◆ IsDebugContext()

    bool OpenGl_Context::IsDebugContext ( ) const
    inline

    Return debug context initialization state.

    ◆ IsFeedback()

    bool OpenGl_Context::IsFeedback ( ) const

    Return true if active mode is GL_FEEDBACK (cached state).

    ◆ IsFrameBufferSRGB()

    bool OpenGl_Context::IsFrameBufferSRGB ( ) const
    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.

    ◆ IsGlGreaterEqual()

    bool OpenGl_Context::IsGlGreaterEqual ( const int theVerMajor,
    const int theVerMinor ) const
    inline
    Returns
    true if detected GL version is greater or equal to requested one.

    ◆ IsGlNormalizeEnabled()

    bool OpenGl_Context::IsGlNormalizeEnabled ( ) const
    inline
    Returns
    cached state of GL_NORMALIZE.

    ◆ IsPolygonHatchEnabled()

    bool OpenGl_Context::IsPolygonHatchEnabled ( ) const
    inline
    Returns
    cached enabled state of polygon hatching rasterization.

    ◆ IsRender()

    bool OpenGl_Context::IsRender ( ) const

    Return true if active mode is GL_RENDER (cached state).

    ◆ IsValid()

    bool OpenGl_Context::IsValid ( ) const
    inline
    Returns
    true if this context is valid (has been initialized)

    ◆ IsWindowDeepColor()

    bool OpenGl_Context::IsWindowDeepColor ( ) const
    inline

    Returns TRUE if window/surface buffer has deep color (10bit per component / 30bit RGB) or better precision.

    ◆ IsWindowSRGB()

    bool OpenGl_Context::IsWindowSRGB ( ) const
    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).

    ◆ LineFeather()

    float OpenGl_Context::LineFeather ( ) const
    inline

    Return line feater width in pixels.

    ◆ LineWidthScale()

    float OpenGl_Context::LineWidthScale ( ) const
    inline

    Return scale factor for line width.

    ◆ MakeCurrent()

    bool OpenGl_Context::MakeCurrent ( )

    Activates current context. Class should be initialized with appropriate info.

    ◆ MaxClipPlanes()

    int OpenGl_Context::MaxClipPlanes ( ) const
    inline

    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).

    Returns
    value for GL_MAX_CLIP_PLANES

    ◆ MaxColorAttachments()

    int OpenGl_Context::MaxColorAttachments ( ) const
    inline
    Returns
    value for GL_MAX_COLOR_ATTACHMENTS

    ◆ MaxCombinedTextureUnits()

    int OpenGl_Context::MaxCombinedTextureUnits ( ) const
    inline
    Returns
    value for GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS

    ◆ MaxDegreeOfAnisotropy()

    int OpenGl_Context::MaxDegreeOfAnisotropy ( ) const
    inline
    Returns
    maximum degree of anisotropy texture filter

    ◆ MaxDrawBuffers()

    int OpenGl_Context::MaxDrawBuffers ( ) const
    inline
    Returns
    value for GL_MAX_DRAW_BUFFERS

    ◆ MaxDumpSizeX()

    int OpenGl_Context::MaxDumpSizeX ( ) const
    inline
    Returns
    maximum FBO width for image dump

    ◆ MaxDumpSizeY()

    int OpenGl_Context::MaxDumpSizeY ( ) const
    inline
    Returns
    maximum FBO height for image dump

    ◆ MaxMsaaSamples()

    int OpenGl_Context::MaxMsaaSamples ( ) const
    inline
    Returns
    value for GL_MAX_SAMPLES

    ◆ MaxTextureSize()

    int OpenGl_Context::MaxTextureSize ( ) const
    inline
    Returns
    value for GL_MAX_TEXTURE_SIZE

    ◆ MaxTextureUnitsFFP()

    int OpenGl_Context::MaxTextureUnitsFFP ( ) const
    inline

    This method returns the multi-texture limit for obsolete fixed-function pipeline. Use MaxCombinedTextureUnits() instead for limits for using programmable pipeline.

    Returns
    value for GL_MAX_TEXTURE_UNITS

    ◆ MemoryInfo() [1/2]

    TCollection_AsciiString OpenGl_Context::MemoryInfo ( ) const

    This function retrieves information from GL about GPU memory and contains more vendor-specific values than AvailableMemory().

    ◆ MemoryInfo() [2/2]

    void OpenGl_Context::MemoryInfo ( NCollection_IndexedDataMap< TCollection_AsciiString, TCollection_AsciiString > & theDict) const

    This function retrieves information from GL about GPU memory.

    ◆ Messenger()

    const occ::handle< Message_Messenger > & OpenGl_Context::Messenger ( ) const
    inline
    Returns
    messenger instance

    ◆ PBRDiffIBLMapSHTexUnit()

    Graphic3d_TextureUnit OpenGl_Context::PBRDiffIBLMapSHTexUnit ( ) const
    inline

    Returns texture unit where Diffuse (irradiance) IBL map's spherical harmonics coefficients is expected to be bound, or 0 if PBR is unavailable.

    ◆ PBREnvLUTTexUnit()

    Graphic3d_TextureUnit OpenGl_Context::PBREnvLUTTexUnit ( ) const
    inline

    Returns texture unit where Environment Lookup Table is expected to be bound, or 0 if PBR is unavailable.

    ◆ PBRSpecIBLMapTexUnit()

    Graphic3d_TextureUnit OpenGl_Context::PBRSpecIBLMapTexUnit ( ) const
    inline

    Returns texture unit where Specular IBL map is expected to be bound, or 0 if PBR is unavailable.

    ◆ PolygonHatchStyle()

    int OpenGl_Context::PolygonHatchStyle ( ) const
    inline
    Returns
    cached state of polygon hatch type.

    ◆ PolygonMode()

    int OpenGl_Context::PolygonMode ( ) const
    inline
    Returns
    cached state of polygon rasterization mode (glPolygonMode()).

    ◆ PolygonOffset()

    const Graphic3d_PolygonOffset & OpenGl_Context::PolygonOffset ( ) const
    inline

    Returns currently applied polygon offset parameters.

    ◆ PushMessage()

    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.

    Parameters
    theSourcemessage source within GL_DEBUG_SOURCE_ enumeration
    theTypemessage type within GL_DEBUG_TYPE_ enumeration
    theIdmessage ID within source
    theSeveritymessage severity within GL_DEBUG_SEVERITY_ enumeration
    theMessagethe message itself

    ◆ ReadBuffer()

    int OpenGl_Context::ReadBuffer ( )
    inline

    Return active read buffer.

    ◆ ReadGlVersion()

    void OpenGl_Context::ReadGlVersion ( int & theGlVerMajor,
    int & theGlVerMinor )
    static

    Read OpenGL version information from active context.

    ◆ ReleaseDelayed()

    void OpenGl_Context::ReleaseDelayed ( )

    Clean up the delayed release queue.

    ◆ ReleaseResource()

    void OpenGl_Context::ReleaseResource ( const TCollection_AsciiString & theKey,
    const bool theToDelay = 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.

    Parameters
    theKeyunique identifier
    theToDelaypostpone release until next redraw call

    ◆ RenderingContext()

    Aspect_RenderingContext OpenGl_Context::RenderingContext ( ) const
    inline

    Return rendering context (EGLContext | HGLRC | GLXContext | EAGLContext* | NSOpenGLContext*).

    ◆ RenderScale()

    float OpenGl_Context::RenderScale ( ) const
    inline

    Rendering scale factor (rendering viewport height to real window buffer height).

    ◆ RenderScaleInv()

    float OpenGl_Context::RenderScaleInv ( ) const
    inline

    Rendering scale factor (inverted value).

    ◆ ResetErrors()

    bool OpenGl_Context::ResetErrors ( const bool theToPrintErrors = false)

    Clean up errors stack for this GL context (glGetError() in loop).

    Returns
    true if some error has been cleared

    ◆ ResizeViewport()

    void OpenGl_Context::ResizeViewport ( const int theRect[4])

    Resize the viewport (alias for glViewport).

    Parameters
    theRectviewport definition (x, y, width, height)

    ◆ Resolution()

    unsigned int OpenGl_Context::Resolution ( ) const
    inline

    Return resolution for rendering text.

    ◆ ResolutionRatio()

    float OpenGl_Context::ResolutionRatio ( ) const
    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).

    ◆ SampleAlphaToCoverage()

    bool OpenGl_Context::SampleAlphaToCoverage ( ) const
    inline

    Return GL_SAMPLE_ALPHA_TO_COVERAGE state.

    ◆ SetAllowSampleAlphaToCoverage()

    void OpenGl_Context::SetAllowSampleAlphaToCoverage ( bool theToEnable)
    inline

    Allow GL_SAMPLE_ALPHA_TO_COVERAGE usage.

    ◆ SetCamera()

    void OpenGl_Context::SetCamera ( const occ::handle< Graphic3d_Camera > & theCamera)

    Sets camera object to the context and update matrices.

    ◆ SetColor4fv() [1/2]

    void OpenGl_Context::SetColor4fv ( const NCollection_Vec4< float > & theColor)

    Setup current color.

    ◆ SetColor4fv() [2/2]

    void OpenGl_Context::SetColor4fv ( const NCollection_Vec4< float > & theFrontColor,
    const NCollection_Vec4< float > & theBackColor )

    Setup current front and back colors.

    ◆ SetColorMask()

    bool OpenGl_Context::SetColorMask ( bool theToWriteColor)

    Enable/disable writing into color buffer (wrapper for glColorMask). Alpha component writes will be disabled unconditionally in case of caps->buffersOpaqueAlpha.

    ◆ SetColorMaskRGBA()

    void OpenGl_Context::SetColorMaskRGBA ( const NCollection_Vec4< bool > & theToWriteColor)

    Enable/disable writing into color buffer (wrapper for glColorMask).

    ◆ SetCullBackFaces()

    void OpenGl_Context::SetCullBackFaces ( bool theToEnable)
    inline

    Enable or disable back face culling (glCullFace() + glEnable(GL_CULL_FACE)).

    ◆ SetDefaultFrameBuffer()

    occ::handle< OpenGl_FrameBuffer > OpenGl_Context::SetDefaultFrameBuffer ( const occ::handle< OpenGl_FrameBuffer > & theFbo)

    Setup new Default Frame Buffer Object and return previously set. This call doesn't change Active FBO!

    ◆ SetDrawBuffer()

    void OpenGl_Context::SetDrawBuffer ( const int theDrawBuffer)

    Switch draw buffer, wrapper for ::glDrawBuffer().

    ◆ SetDrawBuffers()

    void OpenGl_Context::SetDrawBuffers ( const int theNb,
    const int * theDrawBuffers )

    Switch draw buffer, wrapper for ::glDrawBuffers (GLsizei, const GLenum*).

    ◆ SetFaceCulling()

    void OpenGl_Context::SetFaceCulling ( Graphic3d_TypeOfBackfacingModel theMode)

    Enable or disable back face culling (glEnable (GL_CULL_FACE)).

    ◆ SetFrameBufferSRGB()

    void OpenGl_Context::SetFrameBufferSRGB ( bool theIsFbo,
    bool theIsFboSRgb = true )

    Enables/disables GL_FRAMEBUFFER_SRGB flag. This flag can be set to:

    • TRUE when writing into offscreen FBO (always expected to be in sRGB or RGBF formats).
    • TRUE when writing into sRGB-ready window buffer (might require choosing proper pixel format on window creation).
    • FALSE if sRGB rendering is not supported or sRGB-not-ready window buffer is used for drawing.
      Parameters
      [in]theIsFboflag indicating writing into offscreen FBO (always expected sRGB-ready when sRGB FBO is supported) or into window buffer (FALSE, sRGB-readiness might vary).
      [in]theIsFboSRgbflag indicating off-screen FBO is sRGB-ready

    ◆ SetFrameStats()

    void OpenGl_Context::SetFrameStats ( const occ::handle< OpenGl_FrameStats > & theStats)
    inline

    Set structure holding frame statistics. This call makes sense only if application defines OpenGl_FrameStats sub-class.

    ◆ SetGlNormalizeEnabled()

    bool OpenGl_Context::SetGlNormalizeEnabled ( bool isEnabled)

    Sets GL_NORMALIZE enabled or disabled.

    Returns
    old value of the flag

    ◆ SetLineFeather()

    void OpenGl_Context::SetLineFeather ( float theValue)
    inline

    Set line feater width.

    ◆ SetLineStipple() [1/2]

    void OpenGl_Context::SetLineStipple ( const float theFactor,
    const uint16_t thePattern )

    Setup type of line; wrapper for glLineStipple().

    ◆ SetLineStipple() [2/2]

    void OpenGl_Context::SetLineStipple ( const uint16_t thePattern)
    inline

    Setup stipple line pattern with 1.0f factor; wrapper for glLineStipple().

    ◆ SetLineWidth()

    void OpenGl_Context::SetLineWidth ( const float theWidth)

    Setup width of line.

    ◆ SetPointSize()

    void OpenGl_Context::SetPointSize ( const float theSize)

    Setup point size.

    ◆ SetPointSpriteOrigin()

    void OpenGl_Context::SetPointSpriteOrigin ( )

    Setup point sprite origin using GL_POINT_SPRITE_COORD_ORIGIN state:

    • GL_UPPER_LEFT when GLSL program is active; flipping should be handled in GLSL program for compatibility with OpenGL ES
    • GL_LOWER_LEFT for FFP

    ◆ SetPolygonHatchEnabled()

    bool OpenGl_Context::SetPolygonHatchEnabled ( const bool theIsEnabled)

    Sets enabled state of polygon hatching rasterization without affecting currently selected hatching pattern.

    Returns
    previous state of polygon hatching mode.

    ◆ SetPolygonHatchStyle()

    int OpenGl_Context::SetPolygonHatchStyle ( const occ::handle< Graphic3d_HatchStyle > & theStyle)

    Sets polygon hatch pattern. Zero-index value is a default alias for solid filling.

    Parameters
    theStyletype of hatch supported by base implementation of OpenGl_LineAttributes (Aspect_HatchStyle) or the type supported by custom implementation derived from OpenGl_LineAttributes class.
    Returns
    old type of hatch.

    ◆ SetPolygonMode()

    int OpenGl_Context::SetPolygonMode ( const int theMode)

    Sets polygon rasterization mode (glPolygonMode() function).

    Returns
    old value of the rasterization mode.

    ◆ SetPolygonOffset()

    void OpenGl_Context::SetPolygonOffset ( const Graphic3d_PolygonOffset & theOffset)

    Sets and applies current polygon offset.

    ◆ SetReadBuffer()

    void OpenGl_Context::SetReadBuffer ( const int theReadBuffer)

    Switch read buffer, wrapper for ::glReadBuffer().

    ◆ SetReadDrawBuffer()

    void OpenGl_Context::SetReadDrawBuffer ( const int theBuffer)
    inline

    Switch read/draw buffers.

    ◆ SetResolution()

    void OpenGl_Context::SetResolution ( unsigned int theResolution,
    float theRatio,
    float theScale )
    inline

    Set resolution ratio. Note that this method rounds @theRatio to nearest integer.

    ◆ SetResolutionRatio()

    void OpenGl_Context::SetResolutionRatio ( const float theRatio)
    inline

    Set resolution ratio. Note that this method rounds @theRatio to nearest integer.

    ◆ SetSampleAlphaToCoverage()

    bool OpenGl_Context::SetSampleAlphaToCoverage ( bool theToEnable)

    Enable/disable GL_SAMPLE_ALPHA_TO_COVERAGE.

    ◆ SetShadeModel()

    void OpenGl_Context::SetShadeModel ( Graphic3d_TypeOfShadingModel theModel)

    Set GL_SHADE_MODEL value.

    ◆ SetShadingMaterial()

    void OpenGl_Context::SetShadingMaterial ( const OpenGl_Aspects * theAspect,
    const occ::handle< Graphic3d_PresentationAttributes > & theHighlight )

    Setup current shading material.

    ◆ SetSwapInterval()

    bool OpenGl_Context::SetSwapInterval ( const int theInterval)

    Setup swap interval (VSync).

    ◆ SetTextureMatrix()

    void OpenGl_Context::SetTextureMatrix ( const occ::handle< Graphic3d_TextureParams > & theParams,
    const bool theIsTopDown )

    Setup texture matrix to active GLSL program or to FFP global state using glMatrixMode (GL_TEXTURE).

    Parameters
    [in]theParamstexture parameters
    [in]theIsTopDowntexture top-down flag

    ◆ SetTypeOfLine()

    void OpenGl_Context::SetTypeOfLine ( const Aspect_TypeOfLine theType,
    const float theFactor = 1.0f )

    Setup type of line.

    ◆ SetWindowSRGB()

    void OpenGl_Context::SetWindowSRGB ( bool theIsSRgb)
    inline

    Overrides if window/surface buffer is sRGB-ready or not (initialized with the context).

    ◆ ShaderManager()

    const occ::handle< OpenGl_ShaderManager > & OpenGl_Context::ShaderManager ( ) const
    inline
    Returns
    tool for management of shader programs within this context.

    ◆ ShadowMapTexUnit()

    Graphic3d_TextureUnit OpenGl_Context::ShadowMapTexUnit ( ) const
    inline

    Returns texture unit where shadow map is expected to be bound, or 0 if unavailable.

    ◆ Share()

    void OpenGl_Context::Share ( const occ::handle< OpenGl_Context > & theShareCtx)

    Share GL context resources. theShareCtx - handle to context to retrieve handles to shared resources.

    ◆ SharedResources()

    const OpenGl_ResourcesMap & OpenGl_Context::SharedResources ( ) const
    inline

    Return map of shared resources.

    ◆ ShareResource()

    bool OpenGl_Context::ShareResource ( const TCollection_AsciiString & theKey,
    const occ::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.

    Parameters
    theKey- unique identifier, shouldn't be empty;
    theResource- new resource to register, shouldn't be NULL.

    ◆ SpriteTextureUnit()

    Graphic3d_TextureUnit OpenGl_Context::SpriteTextureUnit ( ) const
    inline

    Return texture unit to be used for sprites (Graphic3d_TextureUnit_PointSprite by default).

    ◆ SupportedTextureFormats()

    const occ::handle< Image_SupportedFormats > & OpenGl_Context::SupportedTextureFormats ( ) const
    inline

    Return map of supported texture formats.

    ◆ SwapBuffers()

    void OpenGl_Context::SwapBuffers ( )

    Swap front/back buffers for this GL context (should be activated before!).

    ◆ TextureWrapClamp()

    int OpenGl_Context::TextureWrapClamp ( ) const
    inline

    Either GL_CLAMP_TO_EDGE (1.2+) or GL_CLAMP (1.1).

    ◆ ToCullBackFaces()

    bool OpenGl_Context::ToCullBackFaces ( ) const
    inline

    Return back face culling state.

    ◆ ToRenderSRGB()

    bool OpenGl_Context::ToRenderSRGB ( ) const
    inline

    Returns TRUE if sRGB rendering is supported and permitted.

    ◆ ToUseVbo()

    bool OpenGl_Context::ToUseVbo ( ) const
    inline

    Returns true if VBO is supported and permitted.

    ◆ Vec4FromQuantityColor()

    NCollection_Vec4< float > OpenGl_Context::Vec4FromQuantityColor ( const NCollection_Vec4< float > & theColor) const
    inline

    Convert Quantity_ColorRGBA into vec4 with conversion or no conversion into non-linear sRGB basing on ToRenderSRGB() flag.

    ◆ Vec4LinearFromQuantityColor()

    const NCollection_Vec4< float > & OpenGl_Context::Vec4LinearFromQuantityColor ( const NCollection_Vec4< float > & theColor) const
    inline

    Convert Quantity_ColorRGBA into vec4. Quantity_Color is expected to be linear RGB, hence conversion is NOT required.

    ◆ Vec4sRGBFromQuantityColor()

    NCollection_Vec4< float > OpenGl_Context::Vec4sRGBFromQuantityColor ( const NCollection_Vec4< float > & theColor) const
    inline

    Convert Quantity_ColorRGBA (linear RGB) into non-linear sRGB vec4.

    ◆ Vendor()

    const TCollection_AsciiString & OpenGl_Context::Vendor ( ) const
    inline

    Return Graphics Driver's vendor.

    ◆ VersionMajor()

    int OpenGl_Context::VersionMajor ( ) const
    inline

    Return cached GL version major number.

    ◆ VersionMinor()

    int OpenGl_Context::VersionMinor ( ) const
    inline

    Return cached GL version minor number.

    ◆ Viewport()

    const int * OpenGl_Context::Viewport ( ) const
    inline

    Return cached viewport definition (x, y, width, height).

    ◆ VirtualViewport()

    const int * OpenGl_Context::VirtualViewport ( ) const
    inline

    Return virtual viewport definition (x, y, width, height).

    ◆ Window()

    Aspect_Drawable OpenGl_Context::Window ( ) const
    inline

    Return window handle currently bound to this OpenGL context (EGLSurface | HWND | GLXDrawable).

    ◆ WindowBufferBits()

    void OpenGl_Context::WindowBufferBits ( NCollection_Vec4< int > & theColorBits,
    NCollection_Vec2< int > & theDepthStencilBits ) const

    Fetches information about window buffer pixel format.

    Field Documentation

    ◆ arbClipControl

    bool OpenGl_Context::arbClipControl

    GL_ARB_clip_control, in core since 4.5.

    ◆ arbDbg

    OpenGl_ArbDbg* OpenGl_Context::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).

    ◆ arbDepthClamp

    bool 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).

    ◆ arbDrawBuffers

    bool OpenGl_Context::arbDrawBuffers

    GL_ARB_draw_buffers.

    ◆ arbFBO

    OpenGl_ArbFBO* OpenGl_Context::arbFBO

    GL_ARB_framebuffer_object.

    ◆ arbFBOBlit

    OpenGl_ArbFBOBlit* OpenGl_Context::arbFBOBlit

    glBlitFramebuffer function, moved out from OpenGl_ArbFBO structure for compatibility with OpenGL ES 2.0

    ◆ arbIns

    OpenGl_ArbIns* OpenGl_Context::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).

    ◆ arbNPTW

    bool OpenGl_Context::arbNPTW

    GL_ARB_texture_non_power_of_two.

    ◆ arbSamplerObject

    OpenGl_ArbSamplerObject* OpenGl_Context::arbSamplerObject

    GL_ARB_sampler_objects (on desktop OpenGL - since 3.3 or as extension GL_ARB_sampler_objects; on OpenGL ES - since 3.0).

    ◆ arbSampleShading

    bool OpenGl_Context::arbSampleShading

    GL_ARB_sample_shading.

    ◆ arbTBO

    OpenGl_ArbTBO* OpenGl_Context::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).

    ◆ arbTboRGB32

    bool OpenGl_Context::arbTboRGB32

    GL_ARB_texture_buffer_object_rgb32 (3-component TBO), in core since 4.0 (on OpenGL ES - since 3.2).

    ◆ arbTexBindless

    OpenGl_ArbTexBindless* OpenGl_Context::arbTexBindless

    GL_ARB_bindless_texture.

    ◆ arbTexFloat

    bool 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);.

    See also
    hasTexFloatLinear for linear filtering support

    ◆ arbTexRG

    bool OpenGl_Context::arbTexRG

    GL_ARB_texture_rg.

    ◆ atiMem

    bool OpenGl_Context::atiMem

    GL_ATI_meminfo.

    ◆ caps

    occ::handle<OpenGl_Caps> OpenGl_Context::caps

    context options

    ◆ core11ffp

    OpenGl_GlCore11* OpenGl_Context::core11ffp

    OpenGL 1.1 core functionality.

    ◆ core11fwd

    OpenGl_GlCore11Fwd* OpenGl_Context::core11fwd

    OpenGL 1.1 without deprecated entry points.

    ◆ core15

    OpenGl_GlCore15* OpenGl_Context::core15

    OpenGL 1.5 without deprecated entry points.

    ◆ core15fwd

    OpenGl_GlCore15* OpenGl_Context::core15fwd

    obsolete entry left for code portability; core15 should be used instead

    ◆ core20

    OpenGl_GlCore20* OpenGl_Context::core20

    OpenGL 2.0 without deprecated entry points.

    ◆ core20fwd

    OpenGl_GlCore20* OpenGl_Context::core20fwd

    obsolete entry left for code portability; core20 should be used instead

    ◆ core30

    OpenGl_GlCore30* OpenGl_Context::core30

    OpenGL 3.0 without deprecated entry points.

    ◆ core32

    OpenGl_GlCore32* OpenGl_Context::core32

    OpenGL 3.2 core profile.

    ◆ core33

    OpenGl_GlCore33* OpenGl_Context::core33

    OpenGL 3.3 core profile.

    ◆ core41

    OpenGl_GlCore41* OpenGl_Context::core41

    OpenGL 4.1 core profile.

    ◆ core42

    OpenGl_GlCore42* OpenGl_Context::core42

    OpenGL 4.2 core profile.

    ◆ core43

    OpenGl_GlCore43* OpenGl_Context::core43

    OpenGL 4.3 core profile.

    ◆ core44

    OpenGl_GlCore44* OpenGl_Context::core44

    OpenGL 4.4 core profile.

    ◆ core45

    OpenGl_GlCore45* OpenGl_Context::core45

    OpenGL 4.5 core profile.

    ◆ core46

    OpenGl_GlCore46* OpenGl_Context::core46

    OpenGL 4.6 core profile.

    ◆ extAnis

    bool OpenGl_Context::extAnis

    GL_EXT_texture_filter_anisotropic.

    ◆ extBgra

    bool OpenGl_Context::extBgra

    GL_EXT_bgra or GL_EXT_texture_format_BGRA8888 on OpenGL ES.

    ◆ extDrawBuffers

    bool OpenGl_Context::extDrawBuffers

    GL_EXT_draw_buffers.

    ◆ extFragDepth

    bool OpenGl_Context::extFragDepth

    GL_EXT_frag_depth on OpenGL ES 2.0 (gl_FragDepthEXT built-in variable, before OpenGL ES 3.0).

    ◆ extGS

    OpenGl_ExtGS* OpenGl_Context::extGS

    GL_EXT_geometry_shader4.

    ◆ extPDS

    bool OpenGl_Context::extPDS

    GL_EXT_packed_depth_stencil.

    ◆ extTexR16

    bool OpenGl_Context::extTexR16

    GL_EXT_texture_norm16 on OpenGL ES; always available on desktop.

    ◆ hasDrawBuffers

    OpenGl_FeatureFlag OpenGl_Context::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).

    ◆ hasFboRenderMipmap

    bool OpenGl_Context::hasFboRenderMipmap

    FBO render target could be non-zero mipmap level of texture.

    ◆ hasFboSRGB

    bool OpenGl_Context::hasFboSRGB

    sRGB FBO render targets (desktop OpenGL 2.1, OpenGL ES 3.0)

    ◆ hasFlatShading

    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).

    ◆ hasFloatBuffer

    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).

    ◆ hasGeometryStage

    OpenGl_FeatureFlag OpenGl_Context::hasGeometryStage

    Complex flag indicating support of Geometry shader (desktop OpenGL 3.2, OpenGL ES 3.2, GL_EXT_geometry_shader).

    ◆ hasGetBufferData

    bool OpenGl_Context::hasGetBufferData

    flag indicating if GetBufferSubData() is supported

    ◆ hasGlslBitwiseOps

    OpenGl_FeatureFlag OpenGl_Context::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.

    ◆ hasHalfFloatBuffer

    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).

    ◆ hasHighp

    bool OpenGl_Context::hasHighp

    highp in GLSL ES fragment shader is supported

    ◆ hasPackRowLength

    bool OpenGl_Context::hasPackRowLength

    supporting of GL_PACK_ROW_LENGTH parameters (any desktop OpenGL; OpenGL ES 3.0)

    ◆ hasSampleVariables

    OpenGl_FeatureFlag OpenGl_Context::hasSampleVariables

    Complex flag indicating support of MSAA variables in GLSL shader (desktop OpenGL 4.0, GL_ARB_sample_shading).

    ◆ hasSRGBControl

    bool OpenGl_Context::hasSRGBControl

    sRGB write control (any desktop OpenGL, OpenGL ES + GL_EXT_sRGB_write_control extension)

    ◆ hasTexFloatLinear

    bool OpenGl_Context::hasTexFloatLinear

    texture-filterable state for 32-bit floating texture formats (always on desktop, GL_OES_texture_float_linear within OpenGL ES)

    ◆ hasTexRGBA8

    bool OpenGl_Context::hasTexRGBA8

    always available on desktop; on OpenGL ES - since 3.0 or as extension GL_OES_rgb8_rgba8

    ◆ hasTexSRGB

    bool OpenGl_Context::hasTexSRGB

    sRGB texture formats (desktop OpenGL 2.1, OpenGL ES 3.0 or OpenGL ES 2.0 + GL_EXT_sRGB)

    ◆ hasUintIndex

    bool 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).

    ◆ hasUnpackRowLength

    bool OpenGl_Context::hasUnpackRowLength

    supporting of GL_UNPACK_ROW_LENGTH parameters (any desktop OpenGL; OpenGL ES 3.0)

    ◆ ModelWorldState

    OpenGl_MatrixState<float> OpenGl_Context::ModelWorldState

    state of orientation matrix

    ◆ nvxMem

    bool OpenGl_Context::nvxMem

    GL_NVX_gpu_memory_info.

    ◆ oesSampleVariables

    bool OpenGl_Context::oesSampleVariables

    GL_OES_sample_variables.

    ◆ oesStdDerivatives

    bool OpenGl_Context::oesStdDerivatives

    GL_OES_standard_derivatives.

    ◆ ProjectionState

    OpenGl_MatrixState<float> OpenGl_Context::ProjectionState

    state of projection matrix

    ◆ WorldViewState

    OpenGl_MatrixState<float> OpenGl_Context::WorldViewState

    state of orientation matrix


    The documentation for this class was generated from the following file: