// purpose :
// =======================================================================
OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
-: core11 (NULL),
+: core11ffp (NULL),
core11fwd (NULL),
core15 (NULL),
- core15fwd (NULL),
core20 (NULL),
- core20fwd (NULL),
core30 (NULL),
- core30fwd (NULL),
core32 (NULL),
- core32back (NULL),
core33 (NULL),
- core33back (NULL),
core41 (NULL),
- core41back (NULL),
core42 (NULL),
- core42back (NULL),
core43 (NULL),
- core43back (NULL),
core44 (NULL),
- core44back (NULL),
core45 (NULL),
- core45back (NULL),
core46 (NULL),
- core46back (NULL),
+ core15fwd (NULL),
+ core20fwd (NULL),
caps (!theCaps.IsNull() ? theCaps : new OpenGl_Caps()),
hasGetBufferData (Standard_False),
#if defined(GL_ES_VERSION_2_0)
{
#if !defined(GL_ES_VERSION_2_0)
// cache feedback mode state
- if (core11 != NULL)
+ if (core11ffp != NULL)
{
::glGetIntegerv (GL_RENDER_MODE, &myRenderMode);
::glGetIntegerv (GL_SHADE_MODEL, &myShadeModel);
#if defined(GL_ES_VERSION_2_0)
myShaderManager->SetUseRedAlpha (false);
#else
- myShaderManager->SetUseRedAlpha (core11 == NULL);
+ myShaderManager->SetUseRedAlpha (core11ffp == NULL);
#endif
#define checkGlslExtensionShort(theName) myShaderManager->EnableGlslExtension (Graphic3d_GlslExtension_ ## theName, CheckExtension (#theName))
#if defined(GL_ES_VERSION_2_0)
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &myMaxTexDim);
#if !defined(GL_ES_VERSION_2_0)
- if (IsGlGreaterEqual (1, 3) && core11 != NULL)
+ if (IsGlGreaterEqual (1, 3) && core11ffp != NULL)
{
// this is a maximum of texture units for FFP functionality,
// usually smaller than combined texture units available for GLSL
::glGetIntegerv (GL_MAX_SAMPLES, &myMaxMsaaSamples);
}
#else
- if (core30fwd != NULL)
+ if (core30 != NULL)
{
// MSAA RenderBuffers have been defined in OpenGL 3.0,
// but MSAA Textures - only in OpenGL 3.2+
continue;
}
- // release resource if no one requiested it more than 2 redraw calls
+ // release resource if no one requested it more than 2 redraw calls
aRes->Release (this);
mySharedResources->UnBind (aKey);
aDeadList.Append (aKey);
}
}
#if !defined(GL_ES_VERSION_2_0)
- if (core11 != NULL)
+ if (core11ffp != NULL)
{
OpenGl_Sampler::applyGlobalTextureParams (aThisCtx, *aTextureNew, aTextureNew->Sampler()->Parameters());
}
{
aTextureOld->Unbind (aThisCtx, aTexUnit);
#if !defined(GL_ES_VERSION_2_0)
- if (core11 != NULL)
+ if (core11ffp != NULL)
{
OpenGl_Sampler::resetGlobalTextureParams (aThisCtx, *aTextureOld, aTextureOld->Sampler()->Parameters());
}
}
}
#if !defined(GL_ES_VERSION_2_0)
- else if (core11 != NULL)
+ else if (core11ffp != NULL)
{
- core11->glColor4fv (theColor.GetData());
+ core11ffp->glColor4fv (theColor.GetData());
}
#endif
}
#if !defined(GL_ES_VERSION_2_0)
if (thePattern != 0xFFFF)
{
- if (core11 != NULL)
+ if (core11ffp != NULL)
{
core11fwd->glEnable (GL_LINE_STIPPLE);
- core11->glLineStipple (static_cast<GLint> (theFactor),
- static_cast<GLushort> (thePattern));
+ core11ffp->glLineStipple (static_cast<GLint> (theFactor),
+ static_cast<GLushort> (thePattern));
}
}
else
{
- if (core11 != NULL)
+ if (core11ffp != NULL)
{
core11fwd->glDisable (GL_LINE_STIPPLE);
}
void OpenGl_Context::SetLineWidth (const Standard_ShortReal theWidth)
{
#if !defined(GL_ES_VERSION_2_0)
- if (core11 != NULL)
+ if (core11ffp != NULL)
#endif
{
// glLineWidth() is still defined within Core Profile, but has no effect with values != 1.0f
}
#if !defined(GL_ES_VERSION_2_0)
- if (core11 != NULL)
+ if (core11ffp != NULL)
{
GLint aMatrixMode = GL_TEXTURE;
::glGetIntegerv (GL_MATRIX_MODE, &aMatrixMode);
- core11->glMatrixMode (GL_TEXTURE);
+ core11ffp->glMatrixMode (GL_TEXTURE);
OpenGl_Mat4 aTextureMat;
if (caps->isTopDownTextureUV != theIsTopDown)
{
Graphic3d_TransformUtils::Translate (aTextureMat, -aTrans.x(), -aTrans.y(), 0.0f);
}
Graphic3d_TransformUtils::Rotate (aTextureMat, -theParams->Rotation(), 0.0f, 0.0f, 1.0f);
- core11->glLoadMatrixf (aTextureMat);
- core11->glMatrixMode (aMatrixMode);
+ core11ffp->glLoadMatrixf (aTextureMat);
+ core11ffp->glMatrixMode (aMatrixMode);
}
#endif
}
}
Standard_Boolean anOldGlNormalize = myIsGlNormalizeEnabled;
-
myIsGlNormalizeEnabled = isEnabled;
-
#if !defined(GL_ES_VERSION_2_0)
- if (core11 != NULL)
+ if (core11ffp != NULL)
{
if (isEnabled)
{
- ::glEnable (GL_NORMALIZE);
+ core11fwd->glEnable (GL_NORMALIZE);
}
else
{
- ::glDisable (GL_NORMALIZE);
+ core11fwd->glDisable (GL_NORMALIZE);
}
}
#endif
void OpenGl_Context::SetShadeModel (Graphic3d_TypeOfShadingModel theModel)
{
#if !defined(GL_ES_VERSION_2_0)
- if (core11 != NULL)
+ if (core11ffp != NULL)
{
const Standard_Integer aModel = theModel == Graphic3d_TOSM_FACET
|| theModel == Graphic3d_TOSM_PBR_FACET ? GL_FLAT : GL_SMOOTH;
return;
}
myShadeModel = aModel;
- core11->glShadeModel (aModel);
+ core11ffp->glShadeModel (aModel);
}
#else
(void )theModel;
// =======================================================================
bool OpenGl_Context::SetPolygonHatchEnabled (const bool theIsEnabled)
{
- if (core11 == NULL)
+ if (core11ffp == NULL)
{
return false;
}
{
const Standard_Integer aNewStyle = !theStyle.IsNull() ? theStyle->HatchType() : Aspect_HS_SOLID;
if (myActiveHatchType == aNewStyle
- || core11 == NULL)
+ || core11ffp == NULL)
{
return myActiveHatchType;
}
{
if (toFillNew)
{
- glEnable (GL_POLYGON_OFFSET_FILL);
+ core11fwd->glEnable (GL_POLYGON_OFFSET_FILL);
}
else
{
- glDisable (GL_POLYGON_OFFSET_FILL);
+ core11fwd->glDisable (GL_POLYGON_OFFSET_FILL);
}
}
{
if (toLineNew)
{
- glEnable (GL_POLYGON_OFFSET_LINE);
+ core11fwd->glEnable (GL_POLYGON_OFFSET_LINE);
}
else
{
- glDisable (GL_POLYGON_OFFSET_LINE);
+ core11fwd->glDisable (GL_POLYGON_OFFSET_LINE);
}
}
{
if (toPointNew)
{
- glEnable (GL_POLYGON_OFFSET_POINT);
+ core11fwd->glEnable (GL_POLYGON_OFFSET_POINT);
}
else
{
- glDisable (GL_POLYGON_OFFSET_POINT);
+ core11fwd->glDisable (GL_POLYGON_OFFSET_POINT);
}
}
#endif
if (myPolygonOffset.Factor != theOffset.Factor
|| myPolygonOffset.Units != theOffset.Units)
{
- glPolygonOffset (theOffset.Factor, theOffset.Units);
+ core11fwd->glPolygonOffset (theOffset.Factor, theOffset.Units);
}
myPolygonOffset = theOffset;
}
void OpenGl_Context::DisableFeatures() const
{
// Disable stuff that's likely to slow down glDrawPixels.
- glDisable(GL_DITHER);
- glDisable(GL_BLEND);
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_STENCIL_TEST);
+ core11fwd->glDisable(GL_DITHER);
+ core11fwd->glDisable(GL_BLEND);
+ core11fwd->glDisable(GL_DEPTH_TEST);
+ core11fwd->glDisable(GL_STENCIL_TEST);
#if !defined(GL_ES_VERSION_2_0)
- if (core11 == NULL)
+ if (core11ffp == NULL)
{
return;
}
- glDisable(GL_TEXTURE_1D);
- glDisable(GL_TEXTURE_2D);
+ core11fwd->glDisable(GL_TEXTURE_1D);
+ core11fwd->glDisable(GL_TEXTURE_2D);
- glDisable(GL_LIGHTING);
- glDisable(GL_ALPHA_TEST);
- glDisable(GL_FOG);
- glDisable(GL_LOGIC_OP);
+ core11fwd->glDisable(GL_LIGHTING);
+ core11fwd->glDisable(GL_ALPHA_TEST);
+ core11fwd->glDisable(GL_FOG);
+ core11fwd->glDisable(GL_LOGIC_OP);
glPixelTransferi(GL_MAP_COLOR, GL_FALSE);
glPixelTransferi(GL_RED_SCALE, 1);
if ((myGlVerMajor >= 1) && (myGlVerMinor >= 2))
{
if (CheckExtension ("GL_CONVOLUTION_1D_EXT"))
- glDisable(GL_CONVOLUTION_1D_EXT);
+ core11fwd->glDisable(GL_CONVOLUTION_1D_EXT);
if (CheckExtension ("GL_CONVOLUTION_2D_EXT"))
- glDisable(GL_CONVOLUTION_2D_EXT);
+ core11fwd->glDisable(GL_CONVOLUTION_2D_EXT);
if (CheckExtension ("GL_SEPARABLE_2D_EXT"))
- glDisable(GL_SEPARABLE_2D_EXT);
+ core11fwd->glDisable(GL_SEPARABLE_2D_EXT);
if (CheckExtension ("GL_SEPARABLE_2D_EXT"))
- glDisable(GL_HISTOGRAM_EXT);
+ core11fwd->glDisable(GL_HISTOGRAM_EXT);
if (CheckExtension ("GL_MINMAX_EXT"))
- glDisable(GL_MINMAX_EXT);
+ core11fwd->glDisable(GL_MINMAX_EXT);
if (CheckExtension ("GL_TEXTURE_3D_EXT"))
- glDisable(GL_TEXTURE_3D_EXT);
+ core11fwd->glDisable(GL_TEXTURE_3D_EXT);
}
#endif
}
// =======================================================================
void OpenGl_Context::SetColorMaskRGBA (const NCollection_Vec4<bool>& theVal)
{
- glColorMask (theVal.r() ? GL_TRUE : GL_FALSE,
+ core11fwd->glColorMask (theVal.r() ? GL_TRUE : GL_FALSE,
theVal.g() ? GL_TRUE : GL_FALSE,
theVal.b() ? GL_TRUE : GL_FALSE,
theVal.a() ? GL_TRUE : GL_FALSE);
const bool anOldValue = myColorMask.r();
myColorMask.SetValues (theToWriteColor, theToWriteColor, theToWriteColor, caps->buffersOpaqueAlpha ? false : theToWriteColor);
const GLboolean toWrite = theToWriteColor ? GL_TRUE : GL_FALSE;
- glColorMask (toWrite, toWrite, toWrite, myColorMask.a() ? GL_TRUE : GL_FALSE);
+ core11fwd->glColorMask (toWrite, toWrite, toWrite, myColorMask.a() ? GL_TRUE : GL_FALSE);
return anOldValue;
}
}, theTarget, theOffset, theData, theSize);
return true;
#elif defined(GL_ES_VERSION_2_0)
- if (void* aData = core30fwd->glMapBufferRange (theTarget, theOffset, theSize, GL_MAP_READ_BIT))
+ if (void* aData = core30->glMapBufferRange (theTarget, theOffset, theSize, GL_MAP_READ_BIT))
{
memcpy (theData, aData, theSize);
- core30fwd->glUnmapBuffer (theTarget);
+ core30->glUnmapBuffer (theTarget);
return true;
}
return false;