1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00
occt/src/OpenGl/OpenGl_GraphicDriver_2.cxx
kgv 5f8b738ea5 0023022: This is desirable to access OpenGl extensions and core API (1.2+) in one place
Extend OpenGl_Context to provide GL2.0 core functionality

Added 'glext.h' header provided by Khronos group with definitions
and GL functions' types.
Added OpenGl_GlCoreXX structures with function list
to appropriate GL core functionality.
Fixed memory leak in OpenGl_Context destructor.
Eliminate inclusions of gl.h header
Use OpenGl_GlCore11.hxx instead.
Removed obsolote M_PI redefinitions.
Slightly cleaned up included headers.
Reuse definitions from glext.h
OpenGl_ArbVBO and OpenGl_ExtFBO originally provide own definitions
for OpenGL extensions.
2012-03-15 13:58:13 +04:00

48 lines
1.2 KiB
C++
Executable File

// File: OpenGl_GraphicDriver_2.cxx
// Created: 20 October 2011
// Author: Sergey ZERCHANINOV
// Copyright: OPEN CASCADE 2011
#include <OpenGl_GlCore11.hxx>
#include <OpenGl_GraphicDriver.hxx>
#include <OpenGl_Display.hxx>
#include <OpenGl_CView.hxx>
Standard_Integer OpenGl_GraphicDriver::InquireLightLimit ()
{
return (openglDisplay.IsNull()? 0 : openglDisplay->Facilities().MaxLights);
}
void OpenGl_GraphicDriver::InquireMat (const Graphic3d_CView& ACView, TColStd_Array2OfReal& AMatO, TColStd_Array2OfReal& AMatM)
{
const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
if (aCView)
aCView->View->GetMatrices(AMatO,AMatM,ACView.Orientation.IsCustomMatrix);
}
Standard_Integer OpenGl_GraphicDriver::InquireViewLimit ()
{
return (openglDisplay.IsNull()? 0 : openglDisplay->Facilities().MaxViews);
}
Standard_Boolean OpenGl_GraphicDriver::InquireTextureAvailable ()
{
return Standard_True;
}
Standard_Integer OpenGl_GraphicDriver::InquirePlaneLimit ()
{
GLint aMaxPlanes = 0;
if (GET_GL_CONTEXT())
{
glGetIntegerv (GL_MAX_CLIP_PLANES, &aMaxPlanes);
aMaxPlanes -= 2; // NOTE the 2 first planes are reserved for ZClipping
if (aMaxPlanes < 0)
aMaxPlanes = 0;
}
return aMaxPlanes;
}