//! Debug context routines
struct OpenGl_ArbDbg : protected OpenGl_GlFunctions
{
-
+#if !defined(GL_ES_VERSION_2_0)
using OpenGl_GlFunctions::glDebugMessageControlARB;
using OpenGl_GlFunctions::glDebugMessageInsertARB;
using OpenGl_GlFunctions::glDebugMessageCallbackARB;
using OpenGl_GlFunctions::glGetDebugMessageLogARB;
-
+#endif
};
#endif // _OpenGl_ArbDbg_H__
using OpenGl_GlFunctions::glDeleteFramebuffers;
using OpenGl_GlFunctions::glGenFramebuffers;
using OpenGl_GlFunctions::glCheckFramebufferStatus;
- using OpenGl_GlFunctions::glFramebufferTexture1D;
using OpenGl_GlFunctions::glFramebufferTexture2D;
- using OpenGl_GlFunctions::glFramebufferTexture3D;
using OpenGl_GlFunctions::glFramebufferRenderbuffer;
using OpenGl_GlFunctions::glGetFramebufferAttachmentParameteriv;
using OpenGl_GlFunctions::glGenerateMipmap;
+
+#if !defined(GL_ES_VERSION_2_0)
using OpenGl_GlFunctions::glBlitFramebuffer;
- using OpenGl_GlFunctions::glRenderbufferStorageMultisample;
+ using OpenGl_GlFunctions::glFramebufferTexture1D;
+ using OpenGl_GlFunctions::glFramebufferTexture3D;
using OpenGl_GlFunctions::glFramebufferTextureLayer;
+ using OpenGl_GlFunctions::glRenderbufferStorageMultisample;
+#endif
};
//! Instancing is available on OpenGL 3.0+ hardware
struct OpenGl_ArbIns : protected OpenGl_GlFunctions
{
-
+#if !defined(GL_ES_VERSION_2_0)
using OpenGl_GlFunctions::glDrawArraysInstanced;
using OpenGl_GlFunctions::glDrawElementsInstanced;
-
+#endif
};
#endif // _OpenGl_ArbIns_H__
//! TBO is available on OpenGL 3.0+ hardware
struct OpenGl_ArbTBO : protected OpenGl_GlFunctions
{
-
+#if !defined(GL_ES_VERSION_2_0)
using OpenGl_GlFunctions::glTexBuffer;
-
+#endif
};
#endif // _OpenGl_ArbTBO_H__
}
else
{
+ #if !defined(GL_ES_VERSION_2_0)
// Creating list with bitmap for using it in compatibility mode
GLuint aBitmapList = glGenLists (1);
Sprite->SetDisplayList (aContext, aBitmapList);
}
glEndList();
}
+ #endif
}
}
namespace
{
+
+#if !defined(GL_ES_VERSION_2_0)
+ static const GLint THE_FILLPRIM_FROM = GL_TRIANGLES;
+ static const GLint THE_FILLPRIM_TO = GL_POLYGON;
+#else
+ static const GLint THE_FILLPRIM_FROM = GL_TRIANGLES;
+ static const GLint THE_FILLPRIM_TO = GL_TRIANGLE_FAN;
+#endif
+
static const OpenGl_Vec4 THE_CAPPING_PLN_VERTS[12] =
{ OpenGl_Vec4 ( 0.0f, 0.0f, 0.0f, 1.0f),
OpenGl_Vec4 ( 1.0f, 0.0f, 0.0f, 0.0f),
OpenGl_Vec4 ( 0.0f, 0.0f,-1.0f, 0.0f),
OpenGl_Vec4 ( 1.0f, 0.0f, 0.0f, 0.0f) };
- static const OpenGl_Vec4 THE_CAPPING_PLN_TCOORD[12] =
+ static const OpenGl_Vec4 THE_CAPPING_PLN_TCOORD[12] =
{ OpenGl_Vec4 ( 0.0f, 0.0f, 0.0f, 1.0f),
OpenGl_Vec4 ( 1.0f, 0.0f, 0.0f, 0.0f),
OpenGl_Vec4 ( 0.0f, 1.0f, 0.0f, 0.0f),
OpenGl_Vec4 ( 0.0f, 0.0f, 0.0f, 1.0f),
OpenGl_Vec4 ( 0.0f,-1.0f, 0.0f, 0.0f),
OpenGl_Vec4 ( 1.0f, 0.0f, 0.0f, 0.0f) };
-};
+}
// =======================================================================
// function : RenderCapping
// set identity model matrix
const OpenGl_Matrix* aModelMatrix = theWorkspace->SetStructureMatrix (&OpenGl_IdentityMatrix);
-
+#if !defined(GL_ES_VERSION_2_0)
glMultMatrixf ((const GLfloat*)aPlaneRes->Orientation());
glNormal3f (0.0f, 1.0f, 0.0f);
glEnableClientState (GL_VERTEX_ARRAY);
glDrawArrays (GL_TRIANGLES, 0, 12);
glDisableClientState (GL_VERTEX_ARRAY);
glDisableClientState (GL_TEXTURE_COORD_ARRAY);
+#endif
theWorkspace->SetStructureMatrix (aModelMatrix, true);
theWorkspace->SetAspectFace (aFaceAspect);
{
const OpenGl_PrimitiveArray* aPArray = dynamic_cast<const OpenGl_PrimitiveArray*> (theElement);
return aPArray != NULL
- && aPArray->DrawMode() >= GL_TRIANGLES
- && aPArray->DrawMode() <= GL_POLYGON;
+ && aPArray->DrawMode() >= THE_FILLPRIM_FROM
+ && aPArray->DrawMode() <= THE_FILLPRIM_TO;
}
#include <OpenGl_GlCore11.hxx>
#include <OpenGl_Workspace.hxx>
+#if defined(GL_ES_VERSION_2_0)
+ // id does not matter for GLSL-based clipping, just for consistency
+ #define GL_CLIP_PLANE0 0x3000
+#endif
+
// =======================================================================
// function : OpenGl_ClippingState
// purpose :
// =======================================================================
OpenGl_Clipping::OpenGl_Clipping ()
-: myEmptyPlaneIds (new Aspect_GenId (GL_CLIP_PLANE0, GL_CLIP_PLANE5)),
+: myEmptyPlaneIds (new Aspect_GenId (GL_CLIP_PLANE0, GL_CLIP_PLANE0 + 5)),
myNbClipping (0),
myNbCapping (0)
{}
const EquationCoords& theCoordSpace,
const Handle(OpenGl_Workspace)& theWS)
{
+#if !defined(GL_ES_VERSION_2_0)
GLint aMatrixMode;
glGetIntegerv (GL_MATRIX_MODE, &aMatrixMode);
{
glMatrixMode (aMatrixMode);
}
+#else
+ Add (thePlanes, theCoordSpace);
+#endif
}
// =======================================================================
myPlanes.Append (aPlane);
myPlaneStates.Bind (aPlane, PlaneProps (theCoordSpace, anID, Standard_True));
- glEnable ((GLenum)anID);
- glClipPlane ((GLenum)anID, aPlane->GetEquation());
+ #if !defined(GL_ES_VERSION_2_0)
+ ::glEnable ((GLenum)anID);
+ ::glClipPlane ((GLenum)anID, aPlane->GetEquation());
+ #endif
if (aPlane->IsCapping())
{
++myNbCapping;
PlaneProps& aProps = myPlaneStates.ChangeFind (aPlane);
if (aProps.IsEnabled)
{
+ #if !defined(GL_ES_VERSION_2_0)
glDisable ((GLenum)anID);
+ #endif
if (aPlane->IsCapping())
{
--myNbCapping;
return;
}
+#if !defined(GL_ES_VERSION_2_0)
GLenum anID = (GLenum)aProps.ContextID;
+#endif
if (theIsEnabled)
{
+ #if !defined(GL_ES_VERSION_2_0)
glEnable (anID);
+ #endif
if (thePlane->IsCapping())
{
++myNbCapping;
}
else
{
+ #if !defined(GL_ES_VERSION_2_0)
glDisable (anID);
+ #endif
if (thePlane->IsCapping())
{
--myNbCapping;
core44 (NULL),
core44back (NULL),
caps (!theCaps.IsNull() ? theCaps : new OpenGl_Caps()),
+#if defined(GL_ES_VERSION_2_0)
+ hasHighp (Standard_False),
+ hasTexRGBA8(Standard_False),
+#else
+ hasHighp (Standard_True),
+ hasTexRGBA8(Standard_True),
+#endif
arbNPTW(Standard_False),
arbTBO (NULL),
arbIns (NULL),
myGlLibHandle (NULL),
myFuncs (new OpenGl_GlFunctions()),
myAnisoMax (1),
+ myTexClamp (GL_CLAMP_TO_EDGE),
myMaxTexDim (1024),
myMaxClipPlanes (6),
myGlVerMajor (0),
myGlVerMinor (0),
myIsInitialized (Standard_False),
myIsStereoBuffers (Standard_False),
+#if !defined(GL_ES_VERSION_2_0)
myRenderMode (GL_RENDER),
+#else
+ myRenderMode (0),
+#endif
myDrawBuffer (0)
{
#if defined(MAC_OS_X_VERSION_10_3) && !defined(MACOSX_USE_GLX)
mySharedResources.Nullify();
myDelayed.Nullify();
+#if !defined(GL_ES_VERSION_2_0)
if (arbDbg != NULL
&& caps->contextDebug
&& IsValid())
arbDbg->glDebugMessageCallbackARB (NULL, NULL);
}
}
+#endif
}
// =======================================================================
// =======================================================================
void OpenGl_Context::SetDrawBufferLeft()
{
+#if !defined(GL_ES_VERSION_2_0)
switch (myDrawBuffer)
{
case GL_BACK_RIGHT :
myDrawBuffer = GL_LEFT;
break;
}
+#endif
}
// =======================================================================
// =======================================================================
void OpenGl_Context::SetDrawBufferRight()
{
+#if !defined(GL_ES_VERSION_2_0)
switch (myDrawBuffer)
{
case GL_BACK_LEFT :
myDrawBuffer = GL_RIGHT;
break;
}
+#endif
}
// =======================================================================
// =======================================================================
void OpenGl_Context::SetDrawBufferMono()
{
+#if !defined(GL_ES_VERSION_2_0)
switch (myDrawBuffer)
{
case GL_BACK_LEFT :
myDrawBuffer = GL_FRONT_AND_BACK;
break;
}
+#endif
}
// =======================================================================
// =======================================================================
void OpenGl_Context::FetchState()
{
+#if !defined(GL_ES_VERSION_2_0)
// cache feedback mode state
glGetIntegerv (GL_RENDER_MODE, &myRenderMode);
// cache draw buffer state
glGetIntegerv (GL_DRAW_BUFFER, &myDrawBuffer);
+#endif
}
// =======================================================================
myGlVerMajor = 0;
myGlVerMinor = 0;
- // available since OpenGL 3.0
+#ifdef GL_MAJOR_VERSION
+ // available since OpenGL 3.0 and OpenGL 3.0 ES
GLint aMajor = 0, aMinor = 0;
glGetIntegerv (GL_MAJOR_VERSION, &aMajor);
glGetIntegerv (GL_MINOR_VERSION, &aMinor);
// glGetError() sometimes does not report an error here even if
// GL does not know GL_MAJOR_VERSION and GL_MINOR_VERSION constants.
- // This happens on some rendereres like e.g. Cygwin MESA.
+ // This happens on some renderers like e.g. Cygwin MESA.
// Thus checking additionally if GL has put anything to
// the output variables.
if (glGetError() == GL_NO_ERROR && aMajor != 0 && aMinor != 0)
return;
}
ResetErrors();
+#endif
// Read version string.
- // Notice that only first two numbers splitted by point '2.1 XXXXX' are significant.
+ // Notice that only first two numbers split by point '2.1 XXXXX' are significant.
// Following trash (after space) is vendor-specific.
// New drivers also returns micro version of GL like '3.3.0' which has no meaning
// and should be considered as vendor-specific too.
return;
}
+//#if defined(GL_ES_VERSION_2_0)
+ // skip "OpenGL ES-** " section
+ for (; *aVerStr != '\0'; ++aVerStr)
+ {
+ if (*aVerStr >= '0' && *aVerStr <= '9')
+ {
+ break;
+ }
+ }
+//#endif
+
// parse string for major number
char aMajorStr[32];
char aMinorStr[32];
static Standard_CString THE_DBGMSG_SEV_MEDIUM = "Medium"; // GL_DEBUG_SEVERITY_MEDIUM_ARB
static Standard_CString THE_DBGMSG_SEV_LOW = "Low"; // GL_DEBUG_SEVERITY_LOW_ARB
+#if !defined(GL_ES_VERSION_2_0)
//! Callback for GL_ARB_debug_output extension
static void APIENTRY debugCallbackWrap(unsigned int theSource,
unsigned int theType,
OpenGl_Context* aCtx = (OpenGl_Context* )theUserParam;
aCtx->PushMessage (theSource, theType, theId, theSeverity, theMessage);
}
+#endif
// =======================================================================
// function : PushMessage
aMsg += " | Severity: "; aMsg += aSev;
aMsg += " | Message:\n ";
aMsg += theMessage;
-
Messenger()->Send (aMsg, aGrav);
}
arbFBO = NULL;
extGS = NULL;
+#if defined(GL_ES_VERSION_2_0)
+
+ hasTexRGBA8 = IsGlGreaterEqual (3, 0)
+ || CheckExtension ("GL_OES_rgb8_rgba8");
+ arbNPTW = IsGlGreaterEqual (3, 0)
+ || CheckExtension ("GL_OES_texture_npot");
+ arbTexRG = IsGlGreaterEqual (3, 0)
+ || CheckExtension ("GL_EXT_texture_rg");
+ extBgra = CheckExtension ("GL_EXT_texture_format_BGRA8888");
+ extAnis = CheckExtension ("GL_EXT_texture_filter_anisotropic");
+ extPDS = CheckExtension ("GL_OES_packed_depth_stencil");
+
+ core11fwd = (OpenGl_GlCore11Fwd* )(&(*myFuncs));
+ if (IsGlGreaterEqual (2, 0))
+ {
+ // enable compatible functions
+ core20 = (OpenGl_GlCore20* )(&(*myFuncs));
+ core20fwd = (OpenGl_GlCore20Fwd* )(&(*myFuncs));
+ core15fwd = (OpenGl_GlCore15Fwd* )(&(*myFuncs));
+ arbFBO = (OpenGl_ArbFBO* )(&(*myFuncs));
+ }
+
+ hasHighp = CheckExtension ("OES_fragment_precision_high");
+ GLint aRange[2] = {0, 0};
+ GLint aPrec [2] = {0, 0};
+ ::glGetShaderPrecisionFormat (GL_FRAGMENT_SHADER, GL_HIGH_FLOAT, aRange, aPrec);
+ if (aPrec[1] != 0)
+ {
+ hasHighp = Standard_True;
+ }
+#else
+
+ myTexClamp = IsGlGreaterEqual (1, 2) ? GL_CLAMP_TO_EDGE : GL_CLAMP;
+
+ hasTexRGBA8 = Standard_True;
arbNPTW = CheckExtension ("GL_ARB_texture_non_power_of_two");
extBgra = CheckExtension ("GL_EXT_bgra");
extAnis = CheckExtension ("GL_EXT_texture_filter_anisotropic");
atiMem = CheckExtension ("GL_ATI_meminfo");
nvxMem = CheckExtension ("GL_NVX_gpu_memory_info");
- // get number of maximum clipping planes
- glGetIntegerv (GL_MAX_CLIP_PLANES, &myMaxClipPlanes);
- glGetIntegerv (GL_MAX_TEXTURE_SIZE, &myMaxTexDim);
-
- GLint aStereo;
+ GLint aStereo = GL_FALSE;
glGetIntegerv (GL_STEREO, &aStereo);
myIsStereoBuffers = aStereo == 1;
+ // get number of maximum clipping planes
+ glGetIntegerv (GL_MAX_CLIP_PLANES, &myMaxClipPlanes);
+#endif
+
+ glGetIntegerv (GL_MAX_TEXTURE_SIZE, &myMaxTexDim);
+
if (extAnis)
{
glGetIntegerv (GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &myAnisoMax);
myClippingState.Init (myMaxClipPlanes);
+#if !defined(GL_ES_VERSION_2_0)
+
bool has12 = false;
bool has13 = false;
bool has14 = false;
}
core44 = (OpenGl_GlCore44* )(&(*myFuncs));
core44back = (OpenGl_GlCore44Back* )(&(*myFuncs));
+#endif
}
// =======================================================================
// =======================================================================
Standard_Size OpenGl_Context::AvailableMemory() const
{
+#if !defined(GL_ES_VERSION_2_0)
if (atiMem)
{
// this is actually information for VBO pool
glGetIntegerv (GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &aMemInfo);
return Standard_Size(aMemInfo) * 1024;
}
+#endif
return 0;
}
TCollection_AsciiString OpenGl_Context::MemoryInfo() const
{
TCollection_AsciiString anInfo;
+#if !defined(GL_ES_VERSION_2_0)
if (atiMem)
{
GLint aValues[4];
anInfo += TCollection_AsciiString (" Total memory: ") + (aValue / 1024) + " MiB\n";
}
}
+#endif
return anInfo;
}
//! Return true if active mode is GL_RENDER (cached state)
Standard_Boolean IsRender() const
{
+ #if !defined(GL_ES_VERSION_2_0)
return myRenderMode == GL_RENDER;
+ #else
+ return Standard_True;
+ #endif
}
//! Return true if active mode is GL_FEEDBACK (cached state)
Standard_Boolean IsFeedback() const
{
+ #if !defined(GL_ES_VERSION_2_0)
return myRenderMode == GL_FEEDBACK;
+ #else
+ return Standard_False;
+ #endif
}
//! This function retrieves information from GL about free GPU memory that is:
public:
+ //! Either GL_CLAMP_TO_EDGE (1.2+) or GL_CLAMP (1.1).
+ Standard_Integer TextureWrapClamp() const { return myTexClamp; }
+
//! @return maximum degree of anisotropy texture filter
Standard_EXPORT Standard_Integer MaxDegreeOfAnisotropy() const;
//! right rendering buffers.
Standard_Boolean HasStereoBuffers() const
{
+ #if !defined(GL_ES_VERSION_2_0)
return myIsStereoBuffers;
+ #else
+ return Standard_False;
+ #endif
}
public: //! @name methods to alter or retrieve current state
public: //! @name extensions
- Standard_Boolean arbNPTW; //!< GL_ARB_texture_non_power_of_two
- Standard_Boolean arbTexRG;//!< GL_ARB_texture_rg
- OpenGl_ArbTBO* arbTBO; //!< GL_ARB_texture_buffer_object
- OpenGl_ArbIns* arbIns; //!< GL_ARB_draw_instanced
- OpenGl_ArbDbg* arbDbg; //!< GL_ARB_debug_output
- OpenGl_ArbFBO* arbFBO; //!< GL_ARB_framebuffer_object
- OpenGl_ExtGS* extGS; //!< GL_EXT_geometry_shader4
- Standard_Boolean extBgra; //!< GL_EXT_bgra
- 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 hasHighp; //!< highp in GLSL ES fragment shader is supported
+ Standard_Boolean hasTexRGBA8; //!< always available on desktop; on OpenGL ES - since 3.0 or as extension GL_OES_rgb8_rgba8
+ Standard_Boolean arbNPTW; //!< GL_ARB_texture_non_power_of_two
+ Standard_Boolean arbTexRG; //!< GL_ARB_texture_rg
+ OpenGl_ArbTBO* arbTBO; //!< GL_ARB_texture_buffer_object
+ OpenGl_ArbIns* arbIns; //!< GL_ARB_draw_instanced
+ OpenGl_ArbDbg* arbDbg; //!< GL_ARB_debug_output
+ OpenGl_ArbFBO* arbFBO; //!< GL_ARB_framebuffer_object
+ OpenGl_ExtGS* extGS; //!< GL_EXT_geometry_shader4
+ Standard_Boolean extBgra; //!< GL_EXT_bgra or GL_EXT_texture_format_BGRA8888 on OpenGL ES
+ 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
private: // system-dependent fields
NCollection_Handle<OpenGl_GlFunctions>
myFuncs; //!< mega structure for all GL functions
Standard_Integer myAnisoMax; //!< maximum level of anisotropy texture filter
+ Standard_Integer myTexClamp; //!< either GL_CLAMP_TO_EDGE (1.2+) or GL_CLAMP (1.1)
Standard_Integer myMaxTexDim; //!< value for GL_MAX_TEXTURE_SIZE
Standard_Integer myMaxClipPlanes; //!< value for GL_MAX_CLIP_PLANES
Standard_Integer myGlVerMajor; //!< cached GL version major number
//! Geometry shader as extension is available on OpenGL 2.0+
struct OpenGl_ExtGS : protected OpenGl_GlFunctions
{
+#if !defined(GL_ES_VERSION_2_0)
using OpenGl_GlFunctions::glProgramParameteriEXT;
+#endif
};
#endif // _OpenGl_ExtGS_H__
// Check if rendering is to be in immediate mode
const Standard_Boolean isImmediate = (theWorkspace->NamedStatus & OPENGL_NS_IMMEDIATE) != 0;
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
+
+#if !defined(GL_ES_VERSION_2_0)
GLint aCurrMode = GL_MODELVIEW;
glGetIntegerv (GL_MATRIX_MODE, &aCurrMode);
{
glMatrixMode (aCurrMode);
}
+#endif
}
myTileSizeX (0),
myTileSizeY (0),
myLastTileId (-1),
- myTextureFormat (GL_ALPHA8)
+ myTextureFormat (GL_ALPHA)
{
memset (&myLastTilePx, 0, sizeof(myLastTilePx));
}
}
aTexture->Bind (theCtx);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, theCtx->TextureWrapClamp());
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, theCtx->TextureWrapClamp());
aTexture->Unbind (theCtx);
return true;
}
}
aTexture->Bind (theCtx);
+#if !defined(GL_ES_VERSION_2_0)
glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE);
glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
+#endif
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
glTexSubImage2D (GL_TEXTURE_2D, 0,
theGlContext->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myGlFBufferId);
theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, myColorTexture->TextureId(), 0);
+#ifdef GL_DEPTH_STENCIL_ATTACHMENT
theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
GL_TEXTURE_2D, myDepthStencilTexture->TextureId(), 0);
+#else
+ theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ GL_TEXTURE_2D, myDepthStencilTexture->TextureId(), 0);
+ theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+ GL_TEXTURE_2D, myDepthStencilTexture->TextureId(), 0);
+#endif
if (theGlContext->arbFBO->glCheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
{
Release (theGlContext.operator->());
struct OpenGl_GlCore11 : protected OpenGl_GlFunctions
{
+#if !defined(GL_ES_VERSION_2_0)
+ inline void glRotated (GLdouble theAngleDegrees,
+ GLdouble theX, GLdouble theY, GLdouble theZ)
+ {
+ ::glRotated (theAngleDegrees, theX, theY, theZ);
+ }
+
+ inline void glScaled (GLdouble theX, GLdouble theY, GLdouble theZ)
+ {
+ ::glScaled (theX, theY, theZ);
+ }
+
+ inline void glTranslated (GLdouble theX, GLdouble theY, GLdouble theZ)
+ {
+ ::glTranslated (theX, theY, theZ);
+ }
+
public: //! @name Begin/End primitive specification (removed since 3.1)
inline void glBegin (GLenum theMode)
::glMultMatrixf (theMatrix);
}
- inline void glRotated (GLdouble theAngleDegrees,
- GLdouble theX, GLdouble theY, GLdouble theZ)
- {
- ::glRotated (theAngleDegrees, theX, theY, theZ);
- }
-
- inline void glRotatef (GLfloat theAngleDegrees,
- GLfloat theX, GLfloat theY, GLfloat theZ)
- {
- ::glRotatef (theAngleDegrees, theX, theY, theZ);
- }
-
- inline void glScaled (GLdouble theX, GLdouble theY, GLdouble theZ)
- {
- ::glScaled (theX, theY, theZ);
- }
-
- inline void glScalef (GLfloat theX, GLfloat theY, GLfloat theZ)
- {
- ::glScalef (theX, theY, theZ);
- }
-
- inline void glTranslated (GLdouble theX, GLdouble theY, GLdouble theZ)
- {
- ::glTranslated (theX, theY, theZ);
- }
-
- inline void glTranslatef (GLfloat theX, GLfloat theY, GLfloat theZ)
- {
- ::glTranslatef (theX, theY, theZ);
- }
-
public: //! @name Line and Polygon stripple (removed since 3.1)
//void glLineWidth (GLfloat theWidth) { ::glLineWidth (theWidth); }
::glEdgeFlagv (theFlag);
}
- inline void glVertexPointer (GLint theSize, GLenum theType, GLsizei theStride, const GLvoid* thePtr)
+ inline void glIndexPointer (GLenum theType, GLsizei theStride, const GLvoid* thePtr)
{
- ::glVertexPointer (theSize, theType, theStride, thePtr);
+ ::glIndexPointer (theType, theStride, thePtr);
}
- inline void glNormalPointer (GLenum theType, GLsizei theStride, const GLvoid* thePtr)
+ inline void glEdgeFlagPointer (GLsizei theStride, const GLvoid* thePtr)
{
- ::glNormalPointer (theType, theStride, thePtr);
+ ::glEdgeFlagPointer (theStride, thePtr);
}
- inline void glColorPointer (GLint theSize, GLenum theType, GLsizei theStride, const GLvoid* thePtr)
+ inline void glGetPointerv (GLenum pname, GLvoid** params)
{
- ::glColorPointer (theSize, theType, theStride, thePtr);
+ ::glGetPointerv(pname, params);
}
- inline void glIndexPointer (GLenum theType, GLsizei theStride, const GLvoid* thePtr)
+ inline void glInterleavedArrays (GLenum theFormat, GLsizei theStride, const GLvoid* thePointer)
{
- ::glIndexPointer (theType, theStride, thePtr);
+ ::glInterleavedArrays (theFormat, theStride, thePointer);
}
- inline void glTexCoordPointer (GLint theSize, GLenum theType, GLsizei theStride, const GLvoid* thePtr)
+ inline void glVertexPointer (GLint theSize, GLenum theType, GLsizei theStride, const GLvoid* thePtr)
{
- ::glTexCoordPointer (theSize, theType, theStride, thePtr);
+ ::glVertexPointer (theSize, theType, theStride, thePtr);
}
- inline void glEdgeFlagPointer (GLsizei theStride, const GLvoid* thePtr)
+ inline void glNormalPointer (GLenum theType, GLsizei theStride, const GLvoid* thePtr)
{
- ::glEdgeFlagPointer (theStride, thePtr);
+ ::glNormalPointer (theType, theStride, thePtr);
}
- inline void glGetPointerv (GLenum pname, GLvoid** params)
+ inline void glColorPointer (GLint theSize, GLenum theType, GLsizei theStride, const GLvoid* thePtr)
{
- ::glGetPointerv(pname, params);
+ ::glColorPointer (theSize, theType, theStride, thePtr);
}
- inline void glInterleavedArrays (GLenum theFormat, GLsizei theStride, const GLvoid* thePointer)
+ inline void glTexCoordPointer (GLint theSize, GLenum theType, GLsizei theStride, const GLvoid* thePtr)
{
- ::glInterleavedArrays (theFormat, theStride, thePointer);
+ ::glTexCoordPointer (theSize, theType, theStride, thePtr);
}
inline void glEnableClientState (GLenum theCap)
::glDisableClientState (theCap);
}
+#endif
+
};
#endif // _OpenGl_GlCore11_Header
public: //! @name Miscellaneous
- inline void glClearIndex (GLfloat c)
- {
- ::glClearIndex(c);
- }
-
inline void glClearColor (GLclampf theRed, GLclampf theGreen, GLclampf theBlue, GLclampf theAlpha)
{
::glClearColor (theRed, theGreen, theBlue, theAlpha);
::glClear (theMask);
}
- inline void glIndexMask (GLuint theMask)
- {
- ::glIndexMask (theMask);
- }
-
inline void glColorMask (GLboolean theRed, GLboolean theGreen, GLboolean theBlue, GLboolean theAlpha)
{
::glColorMask (theRed, theGreen, theBlue, theAlpha);
}
- inline void glAlphaFunc (GLenum theFunc, GLclampf theRef)
- {
- ::glAlphaFunc (theFunc, theRef);
- }
-
inline void glBlendFunc (GLenum sfactor, GLenum dfactor)
{
::glBlendFunc(sfactor, dfactor);
}
- inline void glLogicOp (GLenum opcode)
- {
- ::glLogicOp(opcode);
- }
-
inline void glCullFace (GLenum theMode)
{
::glCullFace (theMode);
::glFrontFace (theMode);
}
- inline void glPointSize (GLfloat theSize)
- {
- ::glPointSize (theSize);
- }
-
inline void glLineWidth (GLfloat theWidth)
{
::glLineWidth (theWidth);
}
- inline void glPolygonMode (GLenum theFace, GLenum theMode)
- {
- ::glPolygonMode (theFace, theMode);
- }
-
inline void glPolygonOffset (GLfloat theFactor, GLfloat theUnits)
{
::glPolygonOffset (theFactor, theUnits);
::glScissor (theX, theY, theWidth, theHeight);
}
- inline void glDrawBuffer (GLenum theMode)
- {
- ::glDrawBuffer (theMode);
- }
-
- inline void glReadBuffer (GLenum theMode)
- {
- ::glReadBuffer (theMode);
- }
-
inline void glEnable (GLenum theCap)
{
::glEnable (theCap);
::glGetBooleanv (theParamName, theValues);
}
- inline void glGetDoublev (GLenum theParamName, GLdouble* theValues)
- {
- ::glGetDoublev (theParamName, theValues);
- }
-
inline void glGetFloatv (GLenum theParamName, GLfloat* theValues)
{
::glGetFloatv (theParamName, theValues);
::glGetIntegerv (theParamName, theValues);
}
- inline GLint glRenderMode (GLenum theMode)
- {
- return ::glRenderMode (theMode);
- }
-
inline GLenum glGetError()
{
return ::glGetError();
inline void glClearDepth (GLclampd theDepth)
{
+ #if defined(GL_ES_VERSION_2_0)
+ ::glClearDepthf ((GLfloat )theDepth);
+ #else
::glClearDepth (theDepth);
+ #endif
+ }
+
+ inline void glClearDepthf (GLfloat theDepth)
+ {
+ #if defined(GL_ES_VERSION_2_0)
+ ::glClearDepthf (theDepth);
+ #else
+ ::glClearDepth ((GLclampd )theDepth);
+ #endif
}
inline void glDepthFunc (GLenum theFunc)
::glDepthMask (theFlag);
}
- inline void glDepthRange (GLclampd theNearValue, GLclampd theFarValue)
+ inline void glDepthRange (GLclampd theNearValue,
+ GLclampd theFarValue)
{
+ #if defined(GL_ES_VERSION_2_0)
+ ::glDepthRangef ((GLfloat )theNearValue, (GLfloat )theFarValue);
+ #else
::glDepthRange (theNearValue, theFarValue);
+ #endif
+ }
+
+ inline void glDepthRangef (GLfloat theNearValue,
+ GLfloat theFarValue)
+ {
+ #if defined(GL_ES_VERSION_2_0)
+ ::glDepthRangef (theNearValue, theFarValue);
+ #else
+ ::glDepthRange ((GLclampd )theNearValue, (GLclampd )theFarValue);
+ #endif
}
public: //! @name Transformation
public: //! @name Vertex Arrays
- inline void glArrayElement (GLint i)
- {
- ::glArrayElement (i);
- }
-
inline void glDrawArrays (GLenum theMode, GLint theFirst, GLsizei theCount)
{
::glDrawArrays (theMode, theFirst, theCount);
public: //! @name Raster functions
- inline void glPixelStoref (GLenum theParamName, GLfloat theParam)
+ inline void glPixelStorei (GLenum theParamName, GLint theParam)
{
- ::glPixelStoref (theParamName, theParam);
+ ::glPixelStorei (theParamName, theParam);
}
- inline void glPixelStorei (GLenum theParamName, GLint theParam)
+ inline void glReadPixels (GLint x, GLint y,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ GLvoid* pixels)
{
- ::glPixelStorei (theParamName, theParam);
+ ::glReadPixels (x, y, width, height, format, type, pixels);
}
- inline void glPixelTransferf (GLenum theParamName, GLfloat theParam)
+public: //! @name Stenciling
+
+ inline void glStencilFunc (GLenum func, GLint ref, GLuint mask)
{
- ::glPixelTransferf (theParamName, theParam);
+ ::glStencilFunc (func, ref, mask);
}
- inline void glPixelTransferi (GLenum theParamName, GLint theParam)
+ inline void glStencilMask (GLuint mask)
{
- ::glPixelTransferi (theParamName, theParam);
+ ::glStencilMask (mask);
}
- inline void glPixelMapfv (GLenum map, GLsizei mapsize, const GLfloat* values)
+ inline void glStencilOp (GLenum fail, GLenum zfail, GLenum zpass)
{
- ::glPixelMapfv (map, mapsize, values);
+ ::glStencilOp (fail, zfail, zpass);
}
- inline void glPixelMapuiv (GLenum map, GLsizei mapsize, const GLuint* values)
+ inline void glClearStencil (GLint s)
{
- ::glPixelMapuiv (map, mapsize, values);
+ ::glClearStencil (s);
}
- inline void glPixelMapusv (GLenum map, GLsizei mapsize, const GLushort* values)
+public: //! @name Texture mapping
+
+ inline void glTexParameterf (GLenum target, GLenum pname, GLfloat param)
{
- ::glPixelMapusv (map, mapsize, values);
+ ::glTexParameterf (target, pname, param);
}
- inline void glGetPixelMapfv (GLenum map, GLfloat* values)
+ inline void glTexParameteri (GLenum target, GLenum pname, GLint param)
{
- ::glGetPixelMapfv (map, values);
+ ::glTexParameteri (target, pname, param);
}
- inline void glGetPixelMapuiv (GLenum map, GLuint* values)
+ inline void glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params)
{
- ::glGetPixelMapuiv (map, values);
+ ::glTexParameterfv (target, pname, params);
}
- inline void glGetPixelMapusv (GLenum map, GLushort* values)
+ inline void glTexParameteriv (GLenum target, GLenum pname, const GLint* params)
{
- ::glGetPixelMapusv (map, values);
+ ::glTexParameteriv (target, pname, params);
}
- inline void glReadPixels (GLint x, GLint y,
+ inline void glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params)
+ {
+ ::glGetTexParameterfv (target, pname, params);
+ }
+
+ inline void glGetTexParameteriv (GLenum target, GLenum pname, GLint* params)
+ {
+ ::glGetTexParameteriv (target, pname, params);
+ }
+
+ inline void glTexImage2D (GLenum target, GLint level,
+ GLint internalFormat,
GLsizei width, GLsizei height,
+ GLint border, GLenum format, GLenum type,
+ const GLvoid* pixels)
+ {
+ ::glTexImage2D(target, level, internalFormat, width, height, border, format, type, pixels);
+ }
+
+ inline void glGenTextures (GLsizei n, GLuint* textures)
+ {
+ ::glGenTextures(n, textures);
+ }
+
+ inline void glDeleteTextures (GLsizei n, const GLuint* textures)
+ {
+ ::glDeleteTextures(n, textures);
+ }
+
+ inline void glBindTexture (GLenum target, GLuint texture)
+ {
+ ::glBindTexture(target, texture);
+ }
+
+ inline GLboolean glIsTexture (GLuint texture)
+ {
+ return ::glIsTexture (texture);
+ }
+
+ inline void glTexSubImage2D (GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const GLvoid* pixels)
+ {
+ ::glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
+ }
+
+ inline void glCopyTexImage2D (GLenum target, GLint level,
+ GLenum internalformat,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height,
+ GLint border)
+ {
+ ::glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
+ }
+
+ inline void glCopyTexSubImage2D (GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height)
+ {
+ ::glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
+ }
+
+#if !defined(GL_ES_VERSION_2_0)
+ inline void glTexImage1D (GLenum target, GLint level,
+ GLint internalFormat,
+ GLsizei width, GLint border,
GLenum format, GLenum type,
- GLvoid* pixels)
+ const GLvoid* pixels)
{
- ::glReadPixels (x, y, width, height, format, type, pixels);
+ ::glTexImage1D(target, level, internalFormat, width, border, format, type, pixels);
}
-public: //! @name Stenciling
+ inline void glTexSubImage1D (GLenum target, GLint level,
+ GLint xoffset,
+ GLsizei width, GLenum format,
+ GLenum type, const GLvoid* pixels)
+ {
+ ::glTexSubImage1D(target, level, xoffset, width, format, type, pixels);
+ }
- inline void glStencilFunc (GLenum func, GLint ref, GLuint mask)
+ inline void glCopyTexImage1D (GLenum target, GLint level,
+ GLenum internalformat,
+ GLint x, GLint y,
+ GLsizei width, GLint border)
{
- ::glStencilFunc (func, ref, mask);
+ ::glCopyTexImage1D(target, level, internalformat, x, y, width, border);
}
- inline void glStencilMask (GLuint mask)
+ inline void glCopyTexSubImage1D (GLenum target, GLint level,
+ GLint xoffset, GLint x, GLint y,
+ GLsizei width)
{
- ::glStencilMask (mask);
+ ::glCopyTexSubImage1D(target, level, xoffset, x, y, width);
}
+#endif
- inline void glStencilOp (GLenum fail, GLenum zfail, GLenum zpass)
+#if !defined(GL_ES_VERSION_2_0)
+
+ inline void glAlphaFunc (GLenum theFunc, GLclampf theRef)
{
- ::glStencilOp (fail, zfail, zpass);
+ ::glAlphaFunc (theFunc, theRef);
}
- inline void glClearStencil (GLint s)
+ inline void glPointSize (GLfloat theSize)
{
- ::glClearStencil (s);
+ ::glPointSize (theSize);
}
-public: //! @name Texture mapping
+#endif
+
+/*#if !defined(GL_ES_VERSION_2_0)
inline void glTexEnvf (GLenum target, GLenum pname, GLfloat param)
{
::glGetTexEnviv (target, pname, params);
}
- inline void glTexParameterf (GLenum target, GLenum pname, GLfloat param)
+ inline void glGetTexImage (GLenum target, GLint level,
+ GLenum format, GLenum type,
+ GLvoid* pixels)
{
- ::glTexParameterf (target, pname, param);
+ ::glGetTexImage(target, level, format, type, pixels);
}
- inline void glTexParameteri (GLenum target, GLenum pname, GLint param)
+ inline void glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat* params)
{
- ::glTexParameteri (target, pname, param);
+ ::glGetTexLevelParameterfv (target, level, pname, params);
}
- inline void glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params)
+ inline void glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint* params)
{
- ::glTexParameterfv (target, pname, params);
+ ::glGetTexLevelParameteriv (target, level, pname, params);
}
- inline void glTexParameteriv (GLenum target, GLenum pname, const GLint* params)
+ inline void glClearIndex (GLfloat c)
{
- ::glTexParameteriv (target, pname, params);
+ ::glClearIndex(c);
}
- inline void glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params)
+ inline void glIndexMask (GLuint theMask)
{
- ::glGetTexParameterfv (target, pname, params);
+ ::glIndexMask (theMask);
}
- inline void glGetTexParameteriv (GLenum target, GLenum pname, GLint* params)
+ inline void glLogicOp (GLenum opcode)
{
- ::glGetTexParameteriv (target, pname, params);
+ ::glLogicOp(opcode);
}
- inline void glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat* params)
+ inline void glPolygonMode (GLenum theFace, GLenum theMode)
{
- ::glGetTexLevelParameterfv (target, level, pname, params);
+ ::glPolygonMode (theFace, theMode);
}
- inline void glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint* params)
+ inline void glDrawBuffer (GLenum theMode)
{
- ::glGetTexLevelParameteriv (target, level, pname, params);
+ ::glDrawBuffer (theMode);
}
- inline void glTexImage1D (GLenum target, GLint level,
- GLint internalFormat,
- GLsizei width, GLint border,
- GLenum format, GLenum type,
- const GLvoid* pixels)
+ inline void glReadBuffer (GLenum theMode)
{
- ::glTexImage1D(target, level, internalFormat, width, border, format, type, pixels);
+ ::glReadBuffer (theMode);
}
- inline void glTexImage2D (GLenum target, GLint level,
- GLint internalFormat,
- GLsizei width, GLsizei height,
- GLint border, GLenum format, GLenum type,
- const GLvoid* pixels)
+ inline void glGetDoublev (GLenum theParamName, GLdouble* theValues)
{
- ::glTexImage2D(target, level, internalFormat, width, height, border, format, type, pixels);
+ ::glGetDoublev (theParamName, theValues);
}
- inline void glGetTexImage (GLenum target, GLint level,
- GLenum format, GLenum type,
- GLvoid* pixels)
+ inline GLint glRenderMode (GLenum theMode)
{
- ::glGetTexImage(target, level, format, type, pixels);
+ return ::glRenderMode (theMode);
}
- inline void glGenTextures (GLsizei n, GLuint* textures)
+ inline void glArrayElement (GLint i)
{
- ::glGenTextures(n, textures);
+ ::glArrayElement (i);
}
- inline void glDeleteTextures (GLsizei n, const GLuint* textures)
+ inline void glPixelStoref (GLenum theParamName, GLfloat theParam)
{
- ::glDeleteTextures(n, textures);
+ ::glPixelStoref (theParamName, theParam);
}
- inline void glBindTexture (GLenum target, GLuint texture)
+ inline void glPixelTransferf (GLenum theParamName, GLfloat theParam)
{
- ::glBindTexture(target, texture);
+ ::glPixelTransferf (theParamName, theParam);
}
- inline GLboolean glIsTexture (GLuint texture)
+ inline void glPixelTransferi (GLenum theParamName, GLint theParam)
{
- return ::glIsTexture (texture);
+ ::glPixelTransferi (theParamName, theParam);
}
- inline void glTexSubImage1D (GLenum target, GLint level,
- GLint xoffset,
- GLsizei width, GLenum format,
- GLenum type, const GLvoid* pixels)
+ inline void glPixelMapfv (GLenum map, GLsizei mapsize, const GLfloat* values)
{
- ::glTexSubImage1D(target, level, xoffset, width, format, type, pixels);
+ ::glPixelMapfv (map, mapsize, values);
}
- inline void glTexSubImage2D (GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid* pixels)
+ inline void glPixelMapuiv (GLenum map, GLsizei mapsize, const GLuint* values)
{
- ::glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
+ ::glPixelMapuiv (map, mapsize, values);
}
- inline void glCopyTexImage1D (GLenum target, GLint level,
- GLenum internalformat,
- GLint x, GLint y,
- GLsizei width, GLint border)
+ inline void glPixelMapusv (GLenum map, GLsizei mapsize, const GLushort* values)
{
- ::glCopyTexImage1D(target, level, internalformat, x, y, width, border);
+ ::glPixelMapusv (map, mapsize, values);
}
- inline void glCopyTexImage2D (GLenum target, GLint level,
- GLenum internalformat,
- GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLint border)
+ inline void glGetPixelMapfv (GLenum map, GLfloat* values)
{
- ::glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
+ ::glGetPixelMapfv (map, values);
}
- inline void glCopyTexSubImage1D (GLenum target, GLint level,
- GLint xoffset, GLint x, GLint y,
- GLsizei width)
+ inline void glGetPixelMapuiv (GLenum map, GLuint* values)
{
- ::glCopyTexSubImage1D(target, level, xoffset, x, y, width);
+ ::glGetPixelMapuiv (map, values);
}
- inline void glCopyTexSubImage2D (GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint x, GLint y,
- GLsizei width, GLsizei height)
+ inline void glGetPixelMapusv (GLenum map, GLushort* values)
{
- ::glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
+ ::glGetPixelMapusv (map, values);
}
+#endif*/
};
using theBaseClass_t::glBlendColor;
using theBaseClass_t::glBlendEquation;
+
+#if !defined(GL_ES_VERSION_2_0)
using theBaseClass_t::glDrawRangeElements;
using theBaseClass_t::glTexImage3D;
using theBaseClass_t::glTexSubImage3D;
using theBaseClass_t::glCopyTexSubImage3D;
+#endif
};
public: //! @name OpenGL 1.3 additives to 1.2
- using OpenGl_GlFunctions::glActiveTexture;
- using OpenGl_GlFunctions::glSampleCoverage;
+#if !defined(GL_ES_VERSION_2_0)
using OpenGl_GlFunctions::glCompressedTexImage3D;
- using OpenGl_GlFunctions::glCompressedTexImage2D;
using OpenGl_GlFunctions::glCompressedTexImage1D;
using OpenGl_GlFunctions::glCompressedTexSubImage3D;
- using OpenGl_GlFunctions::glCompressedTexSubImage2D;
using OpenGl_GlFunctions::glCompressedTexSubImage1D;
using OpenGl_GlFunctions::glGetCompressedTexImage;
+#endif
+
+ using OpenGl_GlFunctions::glActiveTexture;
+ using OpenGl_GlFunctions::glSampleCoverage;
+ using OpenGl_GlFunctions::glCompressedTexImage2D;
+ using OpenGl_GlFunctions::glCompressedTexSubImage2D;
};
public: //! @name OpenGL 1.3 additives to 1.2
- using OpenGl_GlFunctions::glActiveTexture;
- using OpenGl_GlFunctions::glSampleCoverage;
+#if !defined(GL_ES_VERSION_2_0)
using OpenGl_GlFunctions::glCompressedTexImage3D;
- using OpenGl_GlFunctions::glCompressedTexImage2D;
using OpenGl_GlFunctions::glCompressedTexImage1D;
using OpenGl_GlFunctions::glCompressedTexSubImage3D;
- using OpenGl_GlFunctions::glCompressedTexSubImage2D;
using OpenGl_GlFunctions::glCompressedTexSubImage1D;
using OpenGl_GlFunctions::glGetCompressedTexImage;
+#endif
+
+ using OpenGl_GlFunctions::glActiveTexture;
+ using OpenGl_GlFunctions::glSampleCoverage;
+ using OpenGl_GlFunctions::glCompressedTexImage2D;
+ using OpenGl_GlFunctions::glCompressedTexSubImage2D;
+
+#if !defined(GL_ES_VERSION_2_0)
public: //! @name Begin/End primitive specification (removed since 3.1)
using OpenGl_GlFunctions::glMultTransposeMatrixf;
using OpenGl_GlFunctions::glMultTransposeMatrixd;
+#endif
+
};
#endif // _OpenGl_GlCore13_Header
public: //! @name OpenGL 1.4 additives to 1.3
+ using theBaseClass_t::glMultiDrawElements;
using theBaseClass_t::glBlendFuncSeparate;
+
+#if !defined(GL_ES_VERSION_2_0)
using theBaseClass_t::glMultiDrawArrays;
- using theBaseClass_t::glMultiDrawElements;
using theBaseClass_t::glPointParameterf;
using theBaseClass_t::glPointParameterfv;
using theBaseClass_t::glPointParameteri;
using theBaseClass_t::glPointParameteriv;
+#endif
};
public: //! @name OpenGL 1.5 additives to 1.4
+#if !defined(GL_ES_VERSION_2_0)
using theBaseClass_t::glGenQueries;
using theBaseClass_t::glDeleteQueries;
using theBaseClass_t::glIsQuery;
using theBaseClass_t::glGetQueryiv;
using theBaseClass_t::glGetQueryObjectiv;
using theBaseClass_t::glGetQueryObjectuiv;
+
+ using theBaseClass_t::glMapBuffer;
+ using theBaseClass_t::glUnmapBuffer;
+ using theBaseClass_t::glGetBufferSubData;
+ using theBaseClass_t::glGetBufferPointerv;
+#endif
+
using theBaseClass_t::glBindBuffer;
using theBaseClass_t::glDeleteBuffers;
using theBaseClass_t::glGenBuffers;
using theBaseClass_t::glIsBuffer;
using theBaseClass_t::glBufferData;
using theBaseClass_t::glBufferSubData;
- using theBaseClass_t::glGetBufferSubData;
- using theBaseClass_t::glMapBuffer;
- using theBaseClass_t::glUnmapBuffer;
using theBaseClass_t::glGetBufferParameteriv;
- using theBaseClass_t::glGetBufferPointerv;
};
public: //! @name OpenGL 2.0 additives to 1.5
using theBaseClass_t::glBlendEquationSeparate;
- using theBaseClass_t::glDrawBuffers;
using theBaseClass_t::glStencilOpSeparate;
using theBaseClass_t::glStencilFuncSeparate;
using theBaseClass_t::glStencilMaskSeparate;
using theBaseClass_t::glGetUniformLocation;
using theBaseClass_t::glGetUniformfv;
using theBaseClass_t::glGetUniformiv;
- using theBaseClass_t::glGetVertexAttribdv;
using theBaseClass_t::glGetVertexAttribfv;
using theBaseClass_t::glGetVertexAttribiv;
using theBaseClass_t::glGetVertexAttribPointerv;
using theBaseClass_t::glUniformMatrix3fv;
using theBaseClass_t::glUniformMatrix4fv;
using theBaseClass_t::glValidateProgram;
- using theBaseClass_t::glVertexAttrib1d;
- using theBaseClass_t::glVertexAttrib1dv;
using theBaseClass_t::glVertexAttrib1f;
using theBaseClass_t::glVertexAttrib1fv;
- using theBaseClass_t::glVertexAttrib1s;
- using theBaseClass_t::glVertexAttrib1sv;
- using theBaseClass_t::glVertexAttrib2d;
- using theBaseClass_t::glVertexAttrib2dv;
using theBaseClass_t::glVertexAttrib2f;
using theBaseClass_t::glVertexAttrib2fv;
- using theBaseClass_t::glVertexAttrib2s;
- using theBaseClass_t::glVertexAttrib2sv;
- using theBaseClass_t::glVertexAttrib3d;
- using theBaseClass_t::glVertexAttrib3dv;
using theBaseClass_t::glVertexAttrib3f;
using theBaseClass_t::glVertexAttrib3fv;
+ using theBaseClass_t::glVertexAttrib4f;
+ using theBaseClass_t::glVertexAttrib4fv;
+ using theBaseClass_t::glVertexAttribPointer;
+
+#if !defined(GL_ES_VERSION_2_0)
+ using theBaseClass_t::glDrawBuffers;
+ using theBaseClass_t::glGetVertexAttribdv;
+ using theBaseClass_t::glVertexAttrib1d;
+ using theBaseClass_t::glVertexAttrib1dv;
+ using theBaseClass_t::glVertexAttrib2d;
+ using theBaseClass_t::glVertexAttrib2dv;
+ using theBaseClass_t::glVertexAttrib3d;
+ using theBaseClass_t::glVertexAttrib3dv;
+ using theBaseClass_t::glVertexAttrib4d;
+ using theBaseClass_t::glVertexAttrib4dv;
+ using theBaseClass_t::glVertexAttrib1s;
+ using theBaseClass_t::glVertexAttrib1sv;
+ using theBaseClass_t::glVertexAttrib2s;
+ using theBaseClass_t::glVertexAttrib2sv;
using theBaseClass_t::glVertexAttrib3s;
using theBaseClass_t::glVertexAttrib3sv;
+ using theBaseClass_t::glVertexAttrib4s;
+ using theBaseClass_t::glVertexAttrib4sv;
+ using theBaseClass_t::glVertexAttrib4iv;
using theBaseClass_t::glVertexAttrib4Nbv;
using theBaseClass_t::glVertexAttrib4Niv;
using theBaseClass_t::glVertexAttrib4Nsv;
using theBaseClass_t::glVertexAttrib4Nuiv;
using theBaseClass_t::glVertexAttrib4Nusv;
using theBaseClass_t::glVertexAttrib4bv;
- using theBaseClass_t::glVertexAttrib4d;
- using theBaseClass_t::glVertexAttrib4dv;
- using theBaseClass_t::glVertexAttrib4f;
- using theBaseClass_t::glVertexAttrib4fv;
- using theBaseClass_t::glVertexAttrib4iv;
- using theBaseClass_t::glVertexAttrib4s;
- using theBaseClass_t::glVertexAttrib4sv;
using theBaseClass_t::glVertexAttrib4ubv;
using theBaseClass_t::glVertexAttrib4uiv;
using theBaseClass_t::glVertexAttrib4usv;
- using theBaseClass_t::glVertexAttribPointer;
+#endif
};
public: //! @name OpenGL 2.1 additives to 2.0
+#if !defined(GL_ES_VERSION_2_0)
+
using theBaseClass_t::glUniformMatrix2x3fv;
using theBaseClass_t::glUniformMatrix3x2fv;
using theBaseClass_t::glUniformMatrix2x4fv;
using theBaseClass_t::glUniformMatrix3x4fv;
using theBaseClass_t::glUniformMatrix4x3fv;
+#endif
+
};
//! OpenGL 2.1 core based on 2.0 version.
public: //! @name GL_ARB_framebuffer_object (added to OpenGL 3.0 core)
+#if !defined(GL_ES_VERSION_2_0)
+
using theBaseClass_t::glIsRenderbuffer;
using theBaseClass_t::glBindRenderbuffer;
using theBaseClass_t::glDeleteRenderbuffers;
using theBaseClass_t::glClearBufferfi;
using theBaseClass_t::glGetStringi;
+#endif
+
};
//! OpenGL 3.0 core based on 2.1 version.
struct OpenGl_TmplCore31 : public theBaseClass_t
{
+#if !defined(GL_ES_VERSION_2_0)
+
public: //! @name GL_ARB_uniform_buffer_object (added to OpenGL 3.1 core)
using theBaseClass_t::glGetUniformIndices;
using theBaseClass_t::glTexBuffer;
using theBaseClass_t::glPrimitiveRestartIndex;
+#endif
+
};
//! OpenGL 3.1 compatibility profile.
struct OpenGl_TmplCore32 : public theBaseClass_t
{
+#if !defined(GL_ES_VERSION_2_0)
+
public: //! @name GL_ARB_draw_elements_base_vertex (added to OpenGL 3.2 core)
using theBaseClass_t::glDrawElementsBaseVertex;
using theBaseClass_t::glGetBufferParameteri64v;
using theBaseClass_t::glFramebufferTexture;
+#endif
+
};
//! OpenGL 3.2 compatibility profile.
struct OpenGl_TmplCore33 : public theBaseClass_t
{
+#if !defined(GL_ES_VERSION_2_0)
+
public: //! @name GL_ARB_blend_func_extended (added to OpenGL 3.3 core)
using theBaseClass_t::glBindFragDataLocationIndexed;
using theBaseClass_t::glVertexAttribDivisor;
+#endif
+
};
//! OpenGL 3.3 compatibility profile.
struct OpenGl_TmplCore40 : public theBaseClass_t
{
+#if !defined(GL_ES_VERSION_2_0)
+
public: //! @name GL_ARB_draw_indirect (added to OpenGL 4.0 core)
using theBaseClass_t::glDrawArraysIndirect;
using theBaseClass_t::glBlendFunci;
using theBaseClass_t::glBlendFuncSeparatei;
+#endif
+
};
//! OpenGL 4.0 compatibility profile.
struct OpenGl_TmplCore41 : public theBaseClass_t
{
+#if !defined(GL_ES_VERSION_2_0)
+
public: //! @name GL_ARB_ES2_compatibility (added to OpenGL 4.1 core)
using theBaseClass_t::glReleaseShaderCompiler;
public: //! @name OpenGL 4.1 additives to 4.0
+#endif
+
};
//! OpenGL 4.1 compatibility profile.
struct OpenGl_TmplCore42 : public theBaseClass_t
{
+#if !defined(GL_ES_VERSION_2_0)
+
public: //! @name GL_ARB_base_instance (added to OpenGL 4.2 core)
using theBaseClass_t::glDrawArraysInstancedBaseInstance;
using theBaseClass_t::glTextureStorage2DEXT;
using theBaseClass_t::glTextureStorage3DEXT;
+#endif
+
};
//! OpenGL 4.2 compatibility profile.
public: //! @name OpenGL 4.3 additives to 4.2
+#if !defined(GL_ES_VERSION_2_0)
+
using theBaseClass_t::glClearBufferData;
using theBaseClass_t::glClearBufferSubData;
using theBaseClass_t::glDispatchCompute;
using theBaseClass_t::glObjectPtrLabel;
using theBaseClass_t::glGetObjectPtrLabel;
+#endif
+
};
//! OpenGL 4.3 compatibility profile.
public: //! @name OpenGL 4.4 additives to 4.3
+#if !defined(GL_ES_VERSION_2_0)
+
using theBaseClass_t::glBufferStorage;
using theBaseClass_t::glClearTexImage;
using theBaseClass_t::glClearTexSubImage;
using theBaseClass_t::glBindImageTextures;
using theBaseClass_t::glBindVertexBuffers;
+#endif
+
};
//! OpenGL 4.4 compatibility profile.
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#define __X_GL_H // prevent chaotic gl.h inclusions to avoid compile errors
+#elif defined(HAVE_GLES2) || defined(__ANDROID__)
+ #include <GLES2/gl2.h>
+ //#include <GLES3/gl3.h>
+
+ typedef double GLdouble;
+ typedef double GLclampd;
+ #define GL_NONE 0
+
+ // OpenGL ES 3.0+ or GL_OES_element_index_uint extension
+ #define GL_UNSIGNED_INT 0x1405
+
+ // in core since OpenGL ES 3.0, extension GL_EXT_texture_rg
+ #define GL_RED 0x1903
+ #define GL_R8 0x8229
+ // in core since OpenGL ES 3.0, extension GL_OES_rgb8_rgba8
+ #define GL_RGB8 0x8051
+ #define GL_RGBA8 0x8058
+ // GL_EXT_texture_format_BGRA8888
+ #define GL_BGRA_EXT 0x80E1 // same as GL_BGRA on desktop
+
+ #define GL_R16 0x822A
+ #define GL_R16F 0x822D
+ #define GL_R32F 0x822E
+ #define GL_RGB16F 0x881B
+ #define GL_RGBA32F 0x8814
+ #define GL_RGB32F 0x8815
+ #define GL_RGBA16F 0x881A
+ #define GL_RGB16F 0x881B
+ #define GL_RGB4 0x804F
+ #define GL_RGB5 0x8050
+ #define GL_RGB8 0x8051
+ #define GL_RGB10 0x8052
+ #define GL_RGB12 0x8053
+ #define GL_RGB16 0x8054
+ #define GL_RGBA8 0x8058
+ #define GL_RGB10_A2 0x8059
+ #define GL_RGBA12 0x805A
+ #define GL_RGBA16 0x805B
+ #define GL_ALPHA8 0x803C
+ #define GL_ALPHA16 0x803E
+
+ #define GL_RG 0x8227
+ #define GL_RG8 0x822B
+ #define GL_RG16 0x822C
+ #define GL_RG16F 0x822F
+ #define GL_RG32F 0x8230
+
+ // GL_OES_packed_depth_stencil
+ #define GL_DEPTH_STENCIL 0x84F9
+ #define GL_UNSIGNED_INT_24_8 0x84FA
+ #define GL_DEPTH24_STENCIL8 0x88F0
+
+ // GL_EXT_texture_filter_anisotropic
+ #define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
+ #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
+
+ // debug ARB extension
+ #define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242
+ #define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243
+ #define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244
+ #define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245
+ #define GL_DEBUG_SOURCE_API_ARB 0x8246
+ #define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247
+ #define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248
+ #define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249
+ #define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A
+ #define GL_DEBUG_SOURCE_OTHER_ARB 0x824B
+ #define GL_DEBUG_TYPE_ERROR_ARB 0x824C
+ #define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D
+ #define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E
+ #define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F
+ #define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250
+ #define GL_DEBUG_TYPE_OTHER_ARB 0x8251
+ #define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143
+ #define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144
+ #define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145
+ #define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146
+ #define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147
+ #define GL_DEBUG_SEVERITY_LOW_ARB 0x9148
+
+ // GL_EXT_texture_buffer for OpenGL ES 3.1+
+ #define GL_TEXTURE_BUFFER_ARB 0x8C2A
#else
#include <GL/gl.h>
#include <GL/glu.h>
#include <InterfaceGraphic_telem.hxx>
// GL version can be defined by system gl.h header
-#undef GL_VERSION_1_2
-#undef GL_VERSION_1_3
-#undef GL_VERSION_1_4
-#undef GL_VERSION_1_5
-#undef GL_VERSION_2_0
-#undef GL_VERSION_2_1
-#undef GL_VERSION_3_0
-#undef GL_VERSION_3_1
-#undef GL_VERSION_3_2
-#undef GL_VERSION_3_3
-#undef GL_VERSION_4_0
-#undef GL_VERSION_4_1
-#undef GL_VERSION_4_2
-#undef GL_VERSION_4_3
-#undef GL_VERSION_4_4
-
-// include glext.h provided by Khronos group
-#include <glext.h>
+#if !defined(GL_ES_VERSION_2_0)
+ #undef GL_VERSION_1_2
+ #undef GL_VERSION_1_3
+ #undef GL_VERSION_1_4
+ #undef GL_VERSION_1_5
+ #undef GL_VERSION_2_0
+ #undef GL_VERSION_2_1
+ #undef GL_VERSION_3_0
+ #undef GL_VERSION_3_1
+ #undef GL_VERSION_3_2
+ #undef GL_VERSION_3_3
+ #undef GL_VERSION_4_0
+ #undef GL_VERSION_4_1
+ #undef GL_VERSION_4_2
+ #undef GL_VERSION_4_3
+ #undef GL_VERSION_4_4
+
+ // include glext.h provided by Khronos group
+ #include <glext.h>
+#endif
//! Mega structure defines the complete list of OpenGL functions.
struct OpenGl_GlFunctions
{
+public: //! @name OpenGL ES 1.1
+
+#if defined(GL_ES_VERSION_2_0)
+
+ inline void glActiveTexture (GLenum texture)
+ {
+ ::glActiveTexture (texture);
+ }
+
+ inline void glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
+ {
+ ::glCompressedTexImage2D (target, level, internalformat, width, height, border, imageSize, data);
+ }
+
+ inline void glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
+ {
+ ::glCompressedTexSubImage2D (target, level, xoffset, yoffset, width, height, format, imageSize, data);
+ }
+
+ inline void glBindBuffer (GLenum target, GLuint buffer)
+ {
+ ::glBindBuffer (target, buffer);
+ }
+
+ inline void glBufferData (GLenum target, GLsizeiptr size, const void* data, GLenum usage)
+ {
+ ::glBufferData (target, size, data, usage);
+ }
+
+ inline void glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void* data)
+ {
+ ::glBufferSubData (target, offset, size, data);
+ }
+
+ inline void glDeleteBuffers (GLsizei n, const GLuint *buffers)
+ {
+ ::glDeleteBuffers (n, buffers);
+ }
+
+ inline void glDeleteTextures (GLsizei n, const GLuint *textures)
+ {
+ ::glDeleteTextures (n, textures);
+ }
+
+ inline void glDepthFunc (GLenum func)
+ {
+ ::glDepthFunc (func);
+ }
+
+ inline void glDepthMask (GLboolean flag)
+ {
+ ::glDepthMask (flag);
+ }
+
+ inline void glDepthRangef (GLfloat n, GLfloat f)
+ {
+ ::glDepthRangef (n, f);
+ }
+
+ inline void glGenBuffers (GLsizei n, GLuint *buffers)
+ {
+ ::glGenBuffers (n, buffers);
+ }
+
+ inline void glGenTextures (GLsizei n, GLuint *textures)
+ {
+ ::glGenTextures (n, textures);
+ }
+
+ inline void glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params)
+ {
+ ::glGetBufferParameteriv (target, pname, params);
+ }
+
+ inline GLboolean glIsBuffer (GLuint buffer)
+ {
+ return ::glIsBuffer (buffer);
+ }
+
+ inline void glSampleCoverage (GLfloat value, GLboolean invert)
+ {
+ ::glSampleCoverage (value, invert);
+ }
+
+ inline void glMultiDrawElements (GLenum theMode, const GLsizei* theCount, GLenum theType, const void* const* theIndices, GLsizei theDrawCount)
+ {
+ if (theCount == NULL
+ || theIndices == NULL)
+ {
+ return;
+ }
+
+ for (GLsizei aBatchIter = 0; aBatchIter < theDrawCount; ++aBatchIter)
+ {
+ ::glDrawElements (theMode, theCount[aBatchIter], theType, theIndices[aBatchIter]);
+ }
+ }
+
+#endif
+
+public: //! @name OpenGL ES 2.0
+
+#if defined(GL_ES_VERSION_2_0)
+ inline void glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+ {
+ ::glBlendColor (red, green, blue, alpha);
+ }
+
+ inline void glBlendEquation (GLenum mode)
+ {
+ ::glBlendEquation (mode);
+ }
+
+ inline void glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
+ {
+ ::glBlendFuncSeparate (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
+ }
+
+ inline void glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha)
+ {
+ ::glBlendEquationSeparate (modeRGB, modeAlpha);
+ }
+
+ inline void glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
+ {
+ ::glStencilOpSeparate (face, sfail, dpfail, dppass);
+ }
+
+ inline void glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask)
+ {
+ ::glStencilFuncSeparate (face, func, ref, mask);
+ }
+
+ inline void glStencilMaskSeparate (GLenum face, GLuint mask)
+ {
+ ::glStencilMaskSeparate (face, mask);
+ }
+
+ inline void glAttachShader (GLuint program, GLuint shader)
+ {
+ ::glAttachShader (program, shader);
+ }
+
+ inline void glBindAttribLocation (GLuint program, GLuint index, const GLchar *name)
+ {
+ ::glBindAttribLocation (program, index, name);
+ }
+
+ inline void glBindFramebuffer (GLenum target, GLuint framebuffer)
+ {
+ ::glBindFramebuffer (target, framebuffer);
+ }
+
+ inline void glBindRenderbuffer (GLenum target, GLuint renderbuffer)
+ {
+ ::glBindRenderbuffer (target, renderbuffer);
+ }
+
+ inline GLenum glCheckFramebufferStatus (GLenum target)
+ {
+ return ::glCheckFramebufferStatus (target);
+ }
+
+ inline void glCompileShader (GLuint shader)
+ {
+ ::glCompileShader (shader);
+ }
+
+ inline GLuint glCreateProgram()
+ {
+ return ::glCreateProgram();
+ }
+
+ inline GLuint glCreateShader (GLenum type)
+ {
+ return ::glCreateShader (type);
+ }
+
+ inline void glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers)
+ {
+ ::glDeleteFramebuffers (n, framebuffers);
+ }
+
+ inline void glDeleteProgram (GLuint program)
+ {
+ ::glDeleteProgram (program);
+ }
+
+ inline void glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers)
+ {
+ ::glDeleteRenderbuffers (n, renderbuffers);
+ }
+
+ inline void glDeleteShader (GLuint shader)
+ {
+ ::glDeleteShader (shader);
+ }
+
+ inline void glDetachShader (GLuint program, GLuint shader)
+ {
+ ::glDetachShader (program, shader);
+ }
+
+ inline void glDisableVertexAttribArray (GLuint index)
+ {
+ ::glDisableVertexAttribArray (index);
+ }
+
+ inline void glEnableVertexAttribArray (GLuint index)
+ {
+ ::glEnableVertexAttribArray (index);
+ }
+
+ inline void glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+ {
+ ::glFramebufferRenderbuffer (target, attachment, renderbuffertarget, renderbuffer);
+ }
+
+ inline void glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+ {
+ ::glFramebufferTexture2D (target, attachment, textarget, texture, level);
+ }
+
+ inline void glGenerateMipmap (GLenum target)
+ {
+ ::glGenerateMipmap (target);
+ }
+
+ inline void glGenFramebuffers (GLsizei n, GLuint *framebuffers)
+ {
+ ::glGenFramebuffers (n, framebuffers);
+ }
+
+ inline void glGenRenderbuffers (GLsizei n, GLuint *renderbuffers)
+ {
+ ::glGenRenderbuffers (n, renderbuffers);
+ }
+
+ inline void glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint* size, GLenum *type, GLchar *name)
+ {
+ ::glGetActiveAttrib (program, index, bufSize, length, size, type, name);
+ }
+
+ inline void glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint* size, GLenum *type, GLchar *name)
+ {
+ ::glGetActiveUniform (program, index, bufSize, length, size, type, name);
+ }
+
+ inline void glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders)
+ {
+ ::glGetAttachedShaders (program, maxCount, count, shaders);
+ }
+
+ inline GLint glGetAttribLocation (GLuint program, const GLchar *name)
+ {
+ return ::glGetAttribLocation (program, name);
+ }
+
+ inline void glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params)
+ {
+ ::glGetFramebufferAttachmentParameteriv (target, attachment, pname, params);
+ }
+
+ inline void glGetProgramiv (GLuint program, GLenum pname, GLint* params)
+ {
+ ::glGetProgramiv (program, pname, params);
+ }
+
+ inline void glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
+ {
+ ::glGetProgramInfoLog (program, bufSize, length, infoLog);
+ }
+
+ inline void glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params)
+ {
+ ::glGetRenderbufferParameteriv (target, pname, params);
+ }
+
+ inline void glGetShaderiv (GLuint shader, GLenum pname, GLint* params)
+ {
+ ::glGetShaderiv (shader, pname, params);
+ }
+
+ inline void glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
+ {
+ ::glGetShaderInfoLog (shader, bufSize, length, infoLog);
+ }
+
+ inline void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
+ {
+ ::glGetShaderPrecisionFormat (shadertype, precisiontype, range, precision);
+ }
+
+ inline void glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
+ {
+ ::glGetShaderSource (shader, bufSize, length, source);
+ }
+
+ inline void glGetUniformfv (GLuint program, GLint location, GLfloat* params)
+ {
+ ::glGetUniformfv (program, location, params);
+ }
+
+ inline void glGetUniformiv (GLuint program, GLint location, GLint* params)
+ {
+ ::glGetUniformiv (program, location, params);
+ }
+
+ GLint glGetUniformLocation (GLuint program, const GLchar *name)
+ {
+ return ::glGetUniformLocation (program, name);
+ }
+
+ inline void glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params)
+ {
+ ::glGetVertexAttribfv (index, pname, params);
+ }
+
+ inline void glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params)
+ {
+ ::glGetVertexAttribiv (index, pname, params);
+ }
+
+ inline void glGetVertexAttribPointerv (GLuint index, GLenum pname, void* *pointer)
+ {
+ ::glGetVertexAttribPointerv (index, pname, pointer);
+ }
+
+ inline GLboolean glIsFramebuffer (GLuint framebuffer)
+ {
+ return ::glIsFramebuffer (framebuffer);
+ }
+
+ inline GLboolean glIsProgram (GLuint program)
+ {
+ return ::glIsProgram (program);
+ }
+
+ inline GLboolean glIsRenderbuffer (GLuint renderbuffer)
+ {
+ return ::glIsRenderbuffer (renderbuffer);
+ }
+
+ inline GLboolean glIsShader (GLuint shader)
+ {
+ return ::glIsShader (shader);
+ }
+
+ inline void glLinkProgram (GLuint program)
+ {
+ ::glLinkProgram (program);
+ }
+
+ inline void glReleaseShaderCompiler()
+ {
+ ::glReleaseShaderCompiler();
+ }
+
+ inline void glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+ {
+ ::glRenderbufferStorage (target, internalformat, width, height);
+ }
+
+ inline void glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void* binary, GLsizei length)
+ {
+ ::glShaderBinary (count, shaders, binaryformat, binary, length);
+ }
+
+ inline void glShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length)
+ {
+ ::glShaderSource (shader, count, string, length);
+ }
+
+ inline void glUniform1f (GLint location, GLfloat v0)
+ {
+ ::glUniform1f (location, v0);
+ }
+
+ inline void glUniform1fv (GLint location, GLsizei count, const GLfloat* value)
+ {
+ ::glUniform1fv (location, count, value);
+ }
+
+ inline void glUniform1i (GLint location, GLint v0)
+ {
+ ::glUniform1i (location, v0);
+ }
+
+ inline void glUniform1iv (GLint location, GLsizei count, const GLint* value)
+ {
+ ::glUniform1iv (location, count, value);
+ }
+
+ inline void glUniform2f (GLint location, GLfloat v0, GLfloat v1)
+ {
+ ::glUniform2f (location, v0, v1);
+ }
+
+ inline void glUniform2fv (GLint location, GLsizei count, const GLfloat* value)
+ {
+ ::glUniform2fv (location, count, value);
+ }
+
+ inline void glUniform2i (GLint location, GLint v0, GLint v1)
+ {
+ ::glUniform2i (location, v0, v1);
+ }
+
+ inline void glUniform2iv (GLint location, GLsizei count, const GLint* value)
+ {
+ ::glUniform2iv (location, count, value);
+ }
+
+ inline void glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
+ {
+ ::glUniform3f (location, v0, v1, v2);
+ }
+
+ inline void glUniform3fv (GLint location, GLsizei count, const GLfloat* value)
+ {
+ ::glUniform3fv (location, count, value);
+ }
+
+ inline void glUniform3i (GLint location, GLint v0, GLint v1, GLint v2)
+ {
+ ::glUniform3i (location, v0, v1, v2);
+ }
+
+ inline void glUniform3iv (GLint location, GLsizei count, const GLint* value)
+ {
+ ::glUniform3iv (location, count, value);
+ }
+
+ inline void glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
+ {
+ ::glUniform4f (location, v0, v1, v2, v3);
+ }
+
+ inline void glUniform4fv (GLint location, GLsizei count, const GLfloat* value)
+ {
+ ::glUniform4fv (location, count, value);
+ }
+
+ inline void glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
+ {
+ ::glUniform4i (location, v0, v1, v2, v3);
+ }
+
+ inline void glUniform4iv (GLint location, GLsizei count, const GLint* value)
+ {
+ ::glUniform4iv (location, count, value);
+ }
+
+ inline void glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+ ::glUniformMatrix2fv (location, count, transpose, value);
+ }
+
+ inline void glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+ ::glUniformMatrix3fv (location, count, transpose, value);
+ }
+
+ inline void glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+ ::glUniformMatrix4fv (location, count, transpose, value);
+ }
+
+ inline void glUseProgram (GLuint program)
+ {
+ ::glUseProgram (program);
+ }
+
+ inline void glValidateProgram (GLuint program)
+ {
+ ::glValidateProgram (program);
+ }
+
+ inline void glVertexAttrib1f (GLuint index, GLfloat x)
+ {
+ ::glVertexAttrib1f (index, x);
+ }
+
+ inline void glVertexAttrib1fv (GLuint index, const GLfloat* v)
+ {
+ ::glVertexAttrib1fv (index, v);
+ }
+
+ inline void glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y)
+ {
+ ::glVertexAttrib2f (index, x, y);
+ }
+
+ inline void glVertexAttrib2fv (GLuint index, const GLfloat* v)
+ {
+ ::glVertexAttrib2fv (index, v);
+ }
+
+ inline void glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z)
+ {
+ ::glVertexAttrib3f (index, x, y, z);
+ }
+
+ inline void glVertexAttrib3fv (GLuint index, const GLfloat* v)
+ {
+ ::glVertexAttrib3fv (index, v);
+ }
+
+ inline void glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+ {
+ ::glVertexAttrib4f (index, x, y, z, w);
+ }
+
+ inline void glVertexAttrib4fv (GLuint index, const GLfloat* v)
+ {
+ ::glVertexAttrib4fv (index, v);
+ }
+
+ inline void glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer)
+ {
+ ::glVertexAttribPointer (index, size, type, normalized, stride, pointer);
+ }
+
+#else // OpenGL ES vs. desktop
+
public: //! @name OpenGL 1.2
PFNGLBLENDCOLORPROC glBlendColor;
glXSwapIntervalSGI_t glXSwapIntervalSGI;
#endif
+#endif // OpenGL ES vs. desktop
+
};
#endif // _OpenGl_GlFunctions_Header
/* Normal of the view (not normalized!) */
static float getNormal(float* normal)
{
+#if !defined(GL_ES_VERSION_2_0)
GLint viewport[4];
GLdouble model_matrix[16], proj_matrix[16];
/* Distance corresponding to 1 pixel */
const float width = (float) sqrt(dx2 * dx2 + dy2 * dy2 + dz2 * dz2);
return width / (float) viewport[2];
+#else
+ return 1.0f;
+#endif
}
static float getDistance2Corner(float* normal, float* center, float x, float y, float z)
float x2, float y2, float z2,
float xn, float yn, float zn)
{
+#if !defined(GL_ES_VERSION_2_0)
float h, r;
float xa, ya, za;
float x0, y0, z0;
glVertex3f(xa2, ya2, za2);
glVertex3f(x2, y2, z2);
glEnd();
+#endif
}
// =======================================================================
//call_graduatedtrihedron_redraw
void OpenGl_GraduatedTrihedron::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
{
+#if !defined(GL_ES_VERSION_2_0)
const OpenGl_AspectLine *oldAspectLine = theWorkspace->SetAspectLine(&myDefaultAspectLine);
theWorkspace->AspectLine(Standard_True);
glEnable(GL_LIGHTING);
theWorkspace->SetAspectLine(oldAspectLine);
+#endif
}
//call_graduatedtrihedron_minmaxvalues
aCView->WS->Resize (theCView.DefWindow);
}
-void OpenGl_GraphicDriver::Redraw (const Graphic3d_CView& ACView,
- const Aspect_CLayer2d& ACUnderLayer,
- const Aspect_CLayer2d& ACOverLayer,
- const Standard_Integer /*x*/,
- const Standard_Integer /*y*/,
- const Standard_Integer /*width*/,
+void OpenGl_GraphicDriver::Redraw (const Graphic3d_CView& ACView,
+ const Aspect_CLayer2d& ACUnderLayer,
+ const Aspect_CLayer2d& ACOverLayer,
+ const Standard_Integer /*x*/,
+ const Standard_Integer /*y*/,
+ const Standard_Integer /*width*/,
const Standard_Integer /*height*/)
{
if (ACView.RenderParams.Method == Graphic3d_RM_RAYTRACING
theDataType = GL_UNSIGNED_BYTE;
switch (theData.Format())
{
+ #if !defined(GL_ES_VERSION_2_0)
case Image_PixMap::ImgGray:
thePixelFormat = GL_DEPTH_COMPONENT;
theDataType = GL_UNSIGNED_BYTE;
return true;
- case Image_PixMap::ImgRGB:
- thePixelFormat = GL_RGB;
- theDataType = GL_UNSIGNED_BYTE;
+ case Image_PixMap::ImgGrayF:
+ thePixelFormat = GL_DEPTH_COMPONENT;
+ theDataType = GL_FLOAT;
return true;
case Image_PixMap::ImgBGR:
thePixelFormat = GL_BGR;
theDataType = GL_UNSIGNED_BYTE;
return true;
- case Image_PixMap::ImgRGBA:
- case Image_PixMap::ImgRGB32:
- thePixelFormat = GL_RGBA;
- theDataType = GL_UNSIGNED_BYTE;
- return true;
case Image_PixMap::ImgBGRA:
case Image_PixMap::ImgBGR32:
thePixelFormat = GL_BGRA;
theDataType = GL_UNSIGNED_BYTE;
return true;
- case Image_PixMap::ImgGrayF:
- thePixelFormat = GL_DEPTH_COMPONENT;
+ case Image_PixMap::ImgBGRF:
+ thePixelFormat = GL_BGR;
theDataType = GL_FLOAT;
return true;
- case Image_PixMap::ImgRGBF:
- thePixelFormat = GL_RGB;
+ case Image_PixMap::ImgBGRAF:
+ thePixelFormat = GL_BGRA;
theDataType = GL_FLOAT;
return true;
- case Image_PixMap::ImgBGRF:
- thePixelFormat = GL_BGR;
- theDataType = GL_FLOAT;
+ #endif
+ case Image_PixMap::ImgRGB:
+ thePixelFormat = GL_RGB;
+ theDataType = GL_UNSIGNED_BYTE;
return true;
- case Image_PixMap::ImgRGBAF:
+ case Image_PixMap::ImgRGBA:
+ case Image_PixMap::ImgRGB32:
thePixelFormat = GL_RGBA;
+ theDataType = GL_UNSIGNED_BYTE;
+ return true;
+ case Image_PixMap::ImgRGBF:
+ thePixelFormat = GL_RGB;
theDataType = GL_FLOAT;
return true;
- case Image_PixMap::ImgBGRAF:
- thePixelFormat = GL_BGRA;
+ case Image_PixMap::ImgRGBAF:
+ thePixelFormat = GL_RGBA;
theDataType = GL_FLOAT;
return true;
default:
GLenum aFormat, aType;
if (theImage.IsEmpty()
|| !getDataFormat (theImage, aFormat, aType)
- || ((theBufferType == Graphic3d_BT_Depth) && (aFormat != GL_DEPTH_COMPONENT))
|| !Activate())
{
return Standard_False;
}
+#if !defined(GL_ES_VERSION_2_0)
+ GLint aReadBufferPrev = GL_BACK;
+ if (theBufferType == Graphic3d_BT_Depth
+ && aFormat != GL_DEPTH_COMPONENT)
+ {
+ return Standard_False;
+ }
+#endif
// bind FBO if used
- GLint aReadBufferPrev = GL_BACK;
if (theFBOPtr != NULL && theFBOPtr->IsValid())
{
theFBOPtr->BindBuffer (GetGlContext());
}
else
{
+ #if !defined(GL_ES_VERSION_2_0)
glGetIntegerv (GL_READ_BUFFER, &aReadBufferPrev);
GLint aDrawBufferPrev = GL_BACK;
glGetIntegerv (GL_DRAW_BUFFER, &aDrawBufferPrev);
glReadBuffer (aDrawBufferPrev);
+ #endif
}
// setup alignment
- const GLint anExtraBytes = (GLint )theImage.RowExtraBytes();
const GLint anAligment = Min (GLint(theImage.MaxRowAligmentBytes()), 8); // limit to 8 bytes for OpenGL
glPixelStorei (GL_PACK_ALIGNMENT, anAligment);
+#if !defined(GL_ES_VERSION_2_0)
+ const GLint anExtraBytes = (GLint )theImage.RowExtraBytes();
const GLint aPixelsWidth = GLint(theImage.SizeRowBytes() / theImage.SizePixelBytes());
glPixelStorei (GL_PACK_ROW_LENGTH, (anExtraBytes >= anAligment) ? aPixelsWidth : 0);
+#endif
if (theImage.IsTopDown())
{
}
glPixelStorei (GL_PACK_ALIGNMENT, 1);
+#if !defined(GL_ES_VERSION_2_0)
glPixelStorei (GL_PACK_ROW_LENGTH, 0);
+#endif
if (theFBOPtr != NULL && theFBOPtr->IsValid())
{
}
else
{
+ #if !defined(GL_ES_VERSION_2_0)
glReadBuffer (aReadBufferPrev);
+ #endif
}
return Standard_True;
}
void OpenGl_GraphicDriver::Layer (Aspect_CLayer2d& ACLayer)
{
ACLayer.ptrLayer = new CALL_DEF_PTRLAYER();
+#if !defined(GL_ES_VERSION_2_0)
ACLayer.ptrLayer->listIndex = glGenLists(1);
+#endif
}
/*----------------------------------------------------------------------*/
if (!ACLayer.ptrLayer->listIndex) return;
if (TheLayerProp.ListId == ACLayer.ptrLayer->listIndex)
EndLayer();
+
+#if !defined(GL_ES_VERSION_2_0)
glDeleteLists (ACLayer.ptrLayer->listIndex, 1);
+#endif
ACLayer.ptrLayer->listIndex = 0;
//szvgl: memory leak here?
//free ( ACLayer.ptrLayer );
InitLayerProp (ptrLayer->listIndex);
if (!TheLayerProp.ListId) return;
+#if !defined(GL_ES_VERSION_2_0)
glNewList (TheLayerProp.ListId, GL_COMPILE);
+#endif
TheLayerIsOpen = Standard_True;
}
{
if (!TheLayerProp.ListId) return;
TheLayerProp.NbPoints = 0;
+#if !defined(GL_ES_VERSION_2_0)
glBegin (GL_POLYGON);
+#endif
}
void OpenGl_GraphicDriver::BeginPolyline2d ()
{
if (!TheLayerProp.ListId) return;
TheLayerProp.NbPoints = 0;
+#if !defined(GL_ES_VERSION_2_0)
glBegin (GL_LINE_STRIP);
+#endif
}
void OpenGl_GraphicDriver::ClearLayer (const Aspect_CLayer2d& ACLayer)
InitLayerProp (ACLayer.ptrLayer->listIndex);
if (!TheLayerProp.ListId) return;
+#if !defined(GL_ES_VERSION_2_0)
glNewList (TheLayerProp.ListId, GL_COMPILE);
glEndList ();
+#endif
}
void OpenGl_GraphicDriver::Draw (const Standard_ShortReal X, const Standard_ShortReal Y)
{
if (!TheLayerProp.ListId) return;
TheLayerProp.NbPoints++;
+#if !defined(GL_ES_VERSION_2_0)
glVertex3f (X, Y, 0.F);
+#endif
}
void OpenGl_GraphicDriver::Edge (const Standard_ShortReal X, const Standard_ShortReal Y)
{
if (!TheLayerProp.ListId) return;
TheLayerProp.NbPoints++;
+#if !defined(GL_ES_VERSION_2_0)
glVertex3f (X, Y, 0.F);
+#endif
}
void OpenGl_GraphicDriver::EndLayer ()
if (!TheLayerProp.ListId) return;
if (TheLayerIsOpen)
{
+ #if !defined(GL_ES_VERSION_2_0)
glEndList();
+ #endif
TheLayerIsOpen = Standard_False;
}
TheLayerProp.ListId = 0;
void OpenGl_GraphicDriver::EndPolygon2d ()
{
if (!TheLayerProp.ListId) return;
+#if !defined(GL_ES_VERSION_2_0)
glEnd ();
+#endif
}
void OpenGl_GraphicDriver::EndPolyline2d ()
{
if (!TheLayerProp.ListId) return;
+#if !defined(GL_ES_VERSION_2_0)
glEnd ();
+#endif
}
void OpenGl_GraphicDriver::Move (const Standard_ShortReal X, const Standard_ShortReal Y)
if (!TheLayerProp.ListId) return;
if (TheLayerProp.NbPoints)
{
+ #if !defined(GL_ES_VERSION_2_0)
glEnd ();
- TheLayerProp.NbPoints = 0;
glBegin (GL_LINE_STRIP);
+ #endif
+ TheLayerProp.NbPoints = 0;
}
TheLayerProp.NbPoints++;
+#if !defined(GL_ES_VERSION_2_0)
glVertex3f (X, Y, 0.F);
+#endif
}
void OpenGl_GraphicDriver::Rectangle (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Width, const Standard_ShortReal Height)
{
if (!TheLayerProp.ListId) return;
+#if !defined(GL_ES_VERSION_2_0)
glRectf (X, Y, X + Width, Y + Height);
+#endif
}
void OpenGl_GraphicDriver::SetColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B)
TheLayerProp.Color.rgb[0] = R;
TheLayerProp.Color.rgb[1] = G;
TheLayerProp.Color.rgb[2] = B;
+#if !defined(GL_ES_VERSION_2_0)
glColor3fv (TheLayerProp.Color.rgb);
+#endif
}
void OpenGl_GraphicDriver::SetTransparency (const Standard_ShortReal ATransparency)
{
if (!TheLayerProp.ListId) return;
TheLayerProp.Color.rgb[3] = ATransparency;
+#if !defined(GL_ES_VERSION_2_0)
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4fv (TheLayerProp.Color.rgb);
+#endif
}
void OpenGl_GraphicDriver::UnsetTransparency ()
{
if (!TheLayerProp.ListId) return;
TheLayerProp.Color.rgb[3] = 1.F;
+#if !defined(GL_ES_VERSION_2_0)
glDisable (GL_BLEND);
+#endif
}
void OpenGl_GraphicDriver::SetLineAttributes (const Standard_Integer theType,
{
if (theGlCtx->IsValid())
{
+ #if !defined(GL_ES_VERSION_2_0)
glDeleteLists ((GLuint )myLinestyleBase, 5);
+ #endif
}
myLinestyleBase = 0;
}
{
if (theGlCtx->IsValid())
{
+ #if !defined(GL_ES_VERSION_2_0)
glDeleteLists ((GLuint )myPatternBase, TEL_HS_USER_DEF_START);
+ #endif
}
myPatternBase = 0;
}
return;
}
+#if !defined(GL_ES_VERSION_2_0)
myLinestyleBase = theGlCtx->core11->glGenLists (5);
// Line
glPolygonStipple ((const GLubyte* )myInteriors[i < nbi ? i : 0]);
glEndList();
}
+#endif
}
// =======================================================================
// =======================================================================
void OpenGl_LineAttributes::SetTypeOfLine (const Aspect_TypeOfLine theType) const
{
+#if !defined(GL_ES_VERSION_2_0)
if (theType != Aspect_TOL_SOLID)
{
glCallList ((GLuint )myLinestyleBase + (GLuint )theType);
gl2psDisable (GL2PS_LINE_STIPPLE);
#endif
}
+#endif
}
// =======================================================================
// =======================================================================
void OpenGl_LineAttributes::SetTypeOfHatch (const int theType) const
{
+#if !defined(GL_ES_VERSION_2_0)
if (theType != 0)
{
glCallList ((GLuint )myPatternBase + (GLuint )theType);
}
else
glDisable (GL_POLYGON_STIPPLE);
+#endif
}
if (theGlCtx->IsValid())
{
+ #if !defined(GL_ES_VERSION_2_0)
glDeleteLists (myBitmapList, 1);
+ #endif
}
myBitmapList = 0;
}
{
if (myBitmapList != 0)
{
+ #if !defined(GL_ES_VERSION_2_0)
glCallList (myBitmapList);
+ #endif
}
}
bool hasVColors = false;
if (myVboAttribs.IsNull())
{
+ #if !defined(GL_ES_VERSION_2_0)
if (myDrawMode == GL_POINTS)
{
// extreme compatibility mode - without sprites but with markers
drawMarkers (theWorkspace);
}
+ #endif
return;
}
for (Standard_Integer aGroupIter = 0; aGroupIter < myBounds->NbBounds; ++aGroupIter)
{
const GLint aNbElemsInGroup = myBounds->Bounds[aGroupIter];
+ #if !defined(GL_ES_VERSION_2_0)
if (theFaceColors != NULL) glColor3fv (theFaceColors[aGroupIter].GetData());
+ #endif
glDrawElements (myDrawMode, aNbElemsInGroup, myVboIndices->GetDataType(), anOffset);
anOffset += aStride * aNbElemsInGroup;
}
for (Standard_Integer aGroupIter = 0; aGroupIter < myBounds->NbBounds; ++aGroupIter)
{
const GLint aNbElemsInGroup = myBounds->Bounds[aGroupIter];
+ #if !defined(GL_ES_VERSION_2_0)
if (theFaceColors != NULL) glColor3fv (theFaceColors[aGroupIter].GetData());
+ #endif
glDrawArrays (myDrawMode, aFirstElem, aNbElemsInGroup);
aFirstElem += aNbElemsInGroup;
}
return;
}
+#if !defined(GL_ES_VERSION_2_0)
glDisable (GL_LIGHTING);
+#endif
const Handle(OpenGl_Context)& aGlContext = theWorkspace->GetGlContext();
const OpenGl_AspectLine* anAspectLineOld = NULL;
anAspectLineOld = theWorkspace->SetAspectLine (theWorkspace->AspectFace (Standard_True)->AspectEdge());
const OpenGl_AspectLine* anAspect = theWorkspace->AspectLine (Standard_True);
+#if !defined(GL_ES_VERSION_2_0)
glPushAttrib (GL_POLYGON_BIT);
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
+#endif
if (aGlContext->IsGlGreaterEqual (2, 0))
{
/// 2) draw elements from vertex array, when bounds defines count of primitive's vertices.
/// 3) draw primitive's edges by vertexes if no edges and bounds array is specified
myVboAttribs->BindPositionAttribute (aGlContext);
+#if !defined(GL_ES_VERSION_2_0)
glColor3fv (theEdgeColour->rgb);
+#endif
if (!myVboIndices.IsNull())
{
myVboIndices->Bind (aGlContext);
{
// Restore line context
theWorkspace->SetAspectLine (anAspectLineOld);
+ #if !defined(GL_ES_VERSION_2_0)
glPopAttrib();
+ #endif
}
}
&& !aSpriteNorm.IsNull() && !aSpriteNorm->IsDisplayList())
{
// Textured markers will be drawn with the point sprites
+ #if !defined(GL_ES_VERSION_2_0)
glPointSize (anAspectMarker->MarkerSize());
+ #endif
Handle(OpenGl_Texture) aTextureBack;
if (anAspectMarker->Type() != Aspect_TOM_POINT)
: aSpriteNorm;
aTextureBack = theWorkspace->EnableTexture (aSprite);
+ #if !defined(GL_ES_VERSION_2_0)
glEnable (GL_ALPHA_TEST);
glAlphaFunc (GL_GEQUAL, 0.1f);
+ #endif
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDrawArrays (myDrawMode, 0, !myVboAttribs.IsNull() ? myVboAttribs->GetElemsNb() : myAttribs->NbElements);
glDisable (GL_BLEND);
+ #if !defined(GL_ES_VERSION_2_0)
glDisable (GL_ALPHA_TEST);
+ #endif
if (anAspectMarker->Type() != Aspect_TOM_POINT)
{
theWorkspace->EnableTexture (aTextureBack);
}
+ #if !defined(GL_ES_VERSION_2_0)
glPointSize (1.0f);
+ #endif
return;
}
const GLfloat aPntSize = anAspectMarker->Type() == Aspect_TOM_POINT
? anAspectMarker->MarkerSize()
: 0.0f;
+ #if !defined(GL_ES_VERSION_2_0)
if (aPntSize > 0.0f)
{
glPointSize (aPntSize);
}
+ #endif
glDrawArrays (myDrawMode, 0, !myVboAttribs.IsNull() ? myVboAttribs->GetElemsNb() : myAttribs->NbElements);
+ #if !defined(GL_ES_VERSION_2_0)
if (aPntSize > 0.0f)
{
glPointSize (1.0f);
}
+ #endif
}
+#if !defined(GL_ES_VERSION_2_0)
if (anAspectMarker->Type() != Aspect_TOM_POINT
&& !aSpriteNorm.IsNull())
{
}
}
}
+#endif
}
// =======================================================================
case Graphic3d_TOPA_SEGMENTS:
myDrawMode = GL_LINES;
break;
- case Graphic3d_TOPA_POLYGONS:
- myDrawMode = GL_POLYGON;
- break;
case Graphic3d_TOPA_TRIANGLES:
myDrawMode = GL_TRIANGLES;
break;
- case Graphic3d_TOPA_QUADRANGLES:
- myDrawMode = GL_QUADS;
- break;
case Graphic3d_TOPA_TRIANGLESTRIPS:
myDrawMode = GL_TRIANGLE_STRIP;
break;
- case Graphic3d_TOPA_QUADRANGLESTRIPS:
- myDrawMode = GL_QUAD_STRIP;
- break;
case Graphic3d_TOPA_TRIANGLEFANS:
myDrawMode = GL_TRIANGLE_FAN;
break;
+ #if !defined(GL_ES_VERSION_2_0)
+ case Graphic3d_TOPA_POLYGONS:
+ myDrawMode = GL_POLYGON;
+ break;
+ case Graphic3d_TOPA_QUADRANGLES:
+ myDrawMode = GL_QUADS;
+ break;
+ case Graphic3d_TOPA_QUADRANGLESTRIPS:
+ myDrawMode = GL_QUAD_STRIP;
+ break;
+ #else
+ case Graphic3d_TOPA_POLYGONS:
+ case Graphic3d_TOPA_QUADRANGLES:
+ case Graphic3d_TOPA_QUADRANGLESTRIPS:
+ #endif
case Graphic3d_TOPA_UNDEFINED:
break;
}
aFrontLightingModel = 0;
}
+#if !defined(GL_ES_VERSION_2_0)
// Temporarily disable environment mapping
if (myDrawMode <= GL_LINE_STRIP)
{
{
glEnable (GL_LIGHTING);
}
+#endif
bindProgram (theWorkspace,
anAspectFace, anAspectLine, anAspectMarker,
const Graphic3d_Vec4* aFaceColors = !myBounds.IsNull() && !toHilight && anAspectFace->InteriorStyle() != Aspect_IS_HIDDENLINE
? myBounds->Colors
: NULL;
+ #if !defined(GL_ES_VERSION_2_0)
glColor3fv (myDrawMode <= GL_LINE_STRIP ? aLineColor->rgb : anInteriorColor->rgb);
+ #endif
drawArray (theWorkspace, aFaceColors);
}
}
}
+#if !defined(GL_ES_VERSION_2_0)
if (myDrawMode <= GL_LINE_STRIP)
{
glPopAttrib();
}
+#endif
aCtx->BindProgram (NULL);
}
myScaleY (1.0f),
myLayerViewportX (0),
myLayerViewportY (0)
-
+
{
// identity projection matrix
Standard_Real anInitValue = 0.0;
// =======================================================================
void OpenGl_PrinterContext::LoadProjTransformation()
{
+#if !defined(GL_ES_VERSION_2_0)
glLoadMatrixf ((GLfloat* )myProjMatrixGl);
+#endif
}
// =======================================================================
//! Render presentation
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const
{
+ #if !defined(GL_ES_VERSION_2_0)
// Apply line aspect
const OpenGl_AspectLine* anAspectLine = theWorkspace->AspectLine (Standard_True);
const Handle(OpenGl_Texture) aPrevTexture = theWorkspace->DisableTexture();
}
// Use highlight colors
- glColor3fv ((theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) ? theWorkspace->HighlightColor->rgb : anAspectLine->Color().rgb);
+ theWorkspace->GetGlContext()->core11->glColor3fv ((theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) ? theWorkspace->HighlightColor->rgb : anAspectLine->Color().rgb);
glEnableClientState (GL_VERTEX_ARRAY);
glVertexPointer (3, GL_FLOAT, 0, (GLfloat* )&myVerts);
{
theWorkspace->EnableTexture (aPrevTexture);
}
+ #endif
}
//! Release graphical resources
const OpenGl_Matrix *local_trsf = NULL;
if (myTransformation)
{
+ #if !defined(GL_ES_VERSION_2_0)
if (isImmediate)
{
Tmatrix3 aModelWorld;
call_util_transpose_mat (*aModelWorld, myTransformation->mat);
+
glGetIntegerv (GL_MATRIX_MODE, &matrix_mode);
if (!aCtx->ShaderManager()->IsEmpty())
local_trsf = AWorkspace->SetStructureMatrix (myTransformation);
}
+ #endif
}
// Apply transform persistence
// Restore local transformation
if (myTransformation)
{
+ #if !defined(GL_ES_VERSION_2_0)
if (isImmediate)
{
glPopMatrix ();
glMatrixMode (GL_MODELVIEW);
glPopMatrix();
}
+ #endif
}
// Apply highlight box
char aPsFont[64];
getGL2PSFontName (theAspect.FontName().ToCString(), aPsFont);
+ #if !defined(GL_ES_VERSION_2_0)
if (theIs2d)
{
glRasterPos2f (0.0f, 0.0f);
GLubyte aZero = 0;
glBitmap (1, 1, 0, 0, 0, 0, &aZero);
+ #endif
// Standard GL2PS's alignment isn't used, because it doesn't work correctly
// for all formats, therefore alignment is calculated manually relative
// purpose :
// =======================================================================
void OpenGl_Text::setupMatrix (const Handle(OpenGl_PrinterContext)& thePrintCtx,
- const Handle(OpenGl_Context)& /*theCtx*/,
+ const Handle(OpenGl_Context)& theCtx,
const OpenGl_AspectText& theTextAspect,
const OpenGl_Vec3 theDVec) const
{
// setup matrix
+#if !defined(GL_ES_VERSION_2_0)
if (myIs2d)
{
glLoadIdentity();
&anObjX, &anObjY, &anObjZ);
glLoadIdentity();
- glTranslated (anObjX, anObjY, anObjZ);
- glRotated (theTextAspect.Angle(), 0.0, 0.0, 1.0);
+ theCtx->core11->glTranslated (anObjX, anObjY, anObjZ);
+ theCtx->core11->glRotated (theTextAspect.Angle(), 0.0, 0.0, 1.0);
if (!theTextAspect.IsZoomable())
{
#ifdef _WIN32
// text should be scaled in all directions with same
// factor to save its proportions, so use height (y) scaling
// as it is better for keeping text/3d graphics proportions
- glScalef (aTextScaley, aTextScaley, aTextScaley);
+ theCtx->core11->glScaled ((GLfloat )aTextScaley, (GLfloat )aTextScaley, (GLfloat )aTextScaley);
}
#endif
- glScaled (myScaleHeight, myScaleHeight, myScaleHeight);
+ theCtx->core11->glScaled (myScaleHeight, myScaleHeight, myScaleHeight);
}
}
+#endif
}
// =======================================================================
}
Handle(OpenGl_Context) aCtx = theCtx;
+ #if !defined(GL_ES_VERSION_2_0)
glPushAttrib (GL_TEXTURE_BIT);
+ #endif
aFont = new OpenGl_Font (aFontFt, theKey);
if (!aFont->Init (aCtx))
{
//glPopAttrib();
//return aFont; // out of resources?
}
+ #if !defined(GL_ES_VERSION_2_0)
glPopAttrib(); // texture bit
+ #endif
aCtx->ShareResource (theKey, aFont);
}
myExportHeight = 1.0f;
myScaleHeight = 1.0f;
+#if !defined(GL_ES_VERSION_2_0)
glMatrixMode (GL_MODELVIEW);
glPushMatrix();
if (!myIs2d)
glDisable (GL_DEPTH_TEST);
}
+
// setup alpha test
GLint aTexEnvParam = GL_REPLACE;
glGetTexEnviv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &aTexEnvParam);
}
case Aspect_TODT_SUBTITLE:
{
- glColor3fv (theColorSubs.rgb);
+ theCtx->core11->glColor3fv (theColorSubs.rgb);
setupMatrix (thePrintCtx, theCtx, theTextAspect, OpenGl_Vec3 (0.0f, 0.0f, 0.00001f));
glBindTexture (GL_TEXTURE_2D, 0);
}
case Aspect_TODT_DEKALE:
{
- glColor3fv (theColorSubs.rgb);
+ theCtx->core11->glColor3fv (theColorSubs.rgb);
setupMatrix (thePrintCtx, theCtx, theTextAspect, OpenGl_Vec3 (+1.0f, +1.0f, 0.00001f));
drawText (thePrintCtx, theCtx, theTextAspect);
setupMatrix (thePrintCtx, theCtx, theTextAspect, OpenGl_Vec3 (-1.0f, -1.0f, 0.00001f));
}
// main draw call
- glColor3fv (theColorText.rgb);
+ theCtx->core11->glColor3fv (theColorText.rgb);
setupMatrix (thePrintCtx, theCtx, theTextAspect, OpenGl_Vec3 (0.0f, 0.0f, 0.0f));
drawText (thePrintCtx, theCtx, theTextAspect);
// revert OpenGL state
glPopAttrib(); // enable bit
glPopMatrix(); // model view matrix was modified
+#endif
}
void Reset()
{
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
+ #if !defined(GL_ES_VERSION_2_0)
glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
+ #endif
}
~OpenGl_UnpackAlignmentSentry()
{
return false;
}
- theTextFormat = GL_RGBA8; // GL_RGBA32F
- thePixelFormat = GL_BGRA; // equals to GL_BGRA_EXT
+ theTextFormat = GL_RGBA8; // GL_RGBA32F
+ thePixelFormat = GL_BGRA_EXT; // equals to GL_BGRA
theDataType = GL_FLOAT;
return true;
}
}
case Image_PixMap::ImgBGRF:
{
- theTextFormat = GL_RGB8; // GL_RGB32F
+ #if !defined(GL_ES_VERSION_2_0)
+ theTextFormat = GL_RGB8; // GL_RGB32F
thePixelFormat = GL_BGR; // equals to GL_BGR_EXT
theDataType = GL_FLOAT;
return true;
+ #else
+ return false;
+ #endif
}
case Image_PixMap::ImgRGBA:
{
{
return false;
}
- theTextFormat = GL_RGBA8;
- thePixelFormat = GL_BGRA; // equals to GL_BGRA_EXT
+ theTextFormat = GL_RGBA8;
+ thePixelFormat = GL_BGRA_EXT; // equals to GL_BGRA
theDataType = GL_UNSIGNED_BYTE;
return true;
}
{
return false;
}
- theTextFormat = GL_RGB8;
- thePixelFormat = GL_BGRA; // equals to GL_BGRA_EXT
+ theTextFormat = GL_RGB8;
+ thePixelFormat = GL_BGRA_EXT; // equals to GL_BGRA
theDataType = GL_UNSIGNED_BYTE;
return true;
}
}
case Image_PixMap::ImgBGR:
{
+ #if !defined(GL_ES_VERSION_2_0)
if (!theCtx->IsGlGreaterEqual (1, 2) && !theCtx->extBgra)
{
return false;
thePixelFormat = GL_BGR; // equals to GL_BGR_EXT
theDataType = GL_UNSIGNED_BYTE;
return true;
+ #else
+ return false;
+ #endif
}
case Image_PixMap::ImgGray:
{
const GLsizei aWidthOut = toForceP2 ? OpenGl_Context::GetPowerOfTwo (aWidth, aMaxSize) : Min (aWidth, aMaxSize);
const GLsizei aHeightOut = toForceP2 ? OpenGl_Context::GetPowerOfTwo (aHeight, aMaxSize) : Min (aHeight, aMaxSize);
+#if !defined(GL_ES_VERSION_2_0)
GLint aTestWidth = 0;
GLint aTestHeight = 0;
+#endif
GLvoid* aDataPtr = (theImage != NULL) ? (GLvoid* )theImage->Data() : NULL;
// setup the alignment
const GLint anAligment = Min ((GLint )theImage->MaxRowAligmentBytes(), 8); // OpenGL supports alignment upto 8 bytes
glPixelStorei (GL_UNPACK_ALIGNMENT, anAligment);
+ #if !defined(GL_ES_VERSION_2_0)
// notice that GL_UNPACK_ROW_LENGTH is not available on OpenGL ES 2.0 without GL_EXT_unpack_subimage extension
const GLint anExtraBytes = GLint(theImage->RowExtraBytes());
const GLint aPixelsWidth = GLint(theImage->SizeRowBytes() / theImage->SizePixelBytes());
glPixelStorei (GL_UNPACK_ROW_LENGTH, (anExtraBytes >= anAligment) ? aPixelsWidth : 0);
+ #endif
}
switch (theType)
{
case Graphic3d_TOT_1D:
{
+ #if !defined(GL_ES_VERSION_2_0)
myTarget = GL_TEXTURE_1D;
Bind (theCtx);
glTexParameteri (GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
Unbind (theCtx);
return true;
+ #else
+ return false;
+ #endif
}
case Graphic3d_TOT_2D:
{
{
if (aWidth != aWidthOut || aHeight != aHeightOut)
{
+ #if !defined(GL_ES_VERSION_2_0)
// scale texture
glPixelStorei (GL_PACK_ALIGNMENT, 1);
glPixelStorei (GL_PACK_ROW_LENGTH, 0);
aDataPtr = (GLvoid* )aCopy.Data();
anUnpackSentry.Reset();
+ #else
+ Unbind (theCtx);
+ Release (theCtx.operator->());
+ return false;
+ #endif
}
}
+ #if !defined(GL_ES_VERSION_2_0)
// use proxy to check texture could be created or not
glTexImage2D (GL_PROXY_TEXTURE_2D, 0, myTextFormat,
aWidthOut, aHeightOut, 0,
Release (theCtx.operator->());
return false;
}
+ #endif
glTexImage2D (GL_TEXTURE_2D, 0, myTextFormat,
aWidthOut, aHeightOut, 0,
if (theCtx->arbFBO != NULL
&& aWidth == aWidthOut && aHeight == aHeightOut)
{
+ #if !defined(GL_ES_VERSION_2_0)
// use proxy to check texture could be created or not
glTexImage2D (GL_PROXY_TEXTURE_2D, 0, myTextFormat,
aWidthOut, aHeightOut, 0,
Release (theCtx.operator->());
return false;
}
+ #endif
// upload main picture
glTexImage2D (GL_TEXTURE_2D, 0, myTextFormat,
}
else
{
+ #if !defined(GL_ES_VERSION_2_0)
bool isCreated = gluBuild2DMipmaps (GL_TEXTURE_2D, myTextFormat,
aWidth, aHeight,
thePixelFormat, theDataType, theImage->Data()) == 0;
Unbind (theCtx);
return isCreated;
+ #else
+ Unbind (theCtx);
+ return false;
+ #endif
}
}
default:
{
return false;
}
-
+
+#if !defined(GL_ES_VERSION_2_0)
myTarget = GL_TEXTURE_RECTANGLE;
const GLsizei aSizeX = Min (theCtx->MaxTextureSize(), theSizeX);
const GLsizei aSizeY = Min (theCtx->MaxTextureSize(), theSizeY);
-
+
Bind (theCtx);
if (myParams->Filter() == Graphic3d_TOTF_NEAREST)
Unbind (theCtx);
return true;
+#else
+ return false;
+#endif
}
const GLsizei theElemsNb,
const GLfloat* theData)
{
+#if !defined(GL_ES_VERSION_2_0)
if (theComponentsNb != 1
&& theComponentsNb != 2
&& theComponentsNb != 4)
UnbindTexture (theGlCtx);
Unbind (theGlCtx);
return true;
+#else
+ return false;
+#endif
}
// =======================================================================
const GLsizei theElemsNb,
const GLuint* theData)
{
+#if !defined(GL_ES_VERSION_2_0)
if (theComponentsNb != 1
&& theComponentsNb != 2
&& theComponentsNb != 3
UnbindTexture (theGlCtx);
Unbind (theGlCtx);
return true;
+#else
+ return false;
+#endif
}
// =======================================================================
//call_triedron_redraw
void OpenGl_Trihedron::redraw (const Handle(OpenGl_Workspace)& theWorkspace) const
{
+#if !defined(GL_ES_VERSION_2_0)
const Standard_Real U = theWorkspace->ActiveView()->Height();
const Standard_Real V = theWorkspace->ActiveView()->Width();
glPopMatrix ();
glMatrixMode (GL_MODELVIEW);
glPopMatrix ();
+#endif
}
//call_zbuffer_triedron_redraw
void OpenGl_Trihedron::redrawZBuffer (const Handle(OpenGl_Workspace)& theWorkspace) const
{
+#if !defined(GL_ES_VERSION_2_0)
const Standard_Real U = theWorkspace->ActiveView()->Height();
const Standard_Real V = theWorkspace->ActiveView()->Width();
glMatrixMode (GL_MODELVIEW);
glPopMatrix ();
}
+#endif
}
*/
if (!theWorkspace->UseGLLight())
{
+ #if !defined(GL_ES_VERSION_2_0)
glDisable (GL_LIGHTING);
+ #endif
}
const Handle(OpenGl_Texture) aPrevTexture = theWorkspace->DisableTexture();
case GL_UNSIGNED_BYTE: return sizeof(GLubyte);
case GL_SHORT:
case GL_UNSIGNED_SHORT: return sizeof(GLushort);
+ #ifdef GL_INT
case GL_INT:
+ #endif
case GL_UNSIGNED_INT: return sizeof(GLuint);
case GL_FLOAT: return sizeof(GLfloat);
+ #ifdef GL_DOUBLE
case GL_DOUBLE: return sizeof(GLdouble);
+ #endif
default: return 0;
}
}
const Graphic3d_TypeOfAttribute theMode);
private:
-
+#if !defined(GL_ES_VERSION_2_0)
//! Setup FFP array pointer.
static void bindFixed (const Handle(OpenGl_Context)& theGlCtx,
const Graphic3d_TypeOfAttribute theMode,
//! Disable FFP array pointer.
static void unbindFixed (const Handle(OpenGl_Context)& theGlCtx,
const Graphic3d_TypeOfAttribute theMode);
-
+#endif
public: //! @name methods for interleaved attributes array
//! @return true if buffer contains per-vertex color attribute
{
if (theCtx->ActiveProgram().IsNull())
{
+ #if !defined(GL_ES_VERSION_2_0)
bindFixed (theCtx, theAttribute, theNbComp, theDataType, theStride, theOffset);
+ #endif
return;
}
theCtx->core20fwd->glVertexAttribPointer (theAttribute, theNbComp, theDataType, GL_FALSE, theStride, theOffset);
}
+#if !defined(GL_ES_VERSION_2_0)
// =======================================================================
// function : bindFixed
// purpose :
}
}
}
+#endif
// =======================================================================
// function : unbindAttribute
{
if (theCtx->ActiveProgram().IsNull())
{
+ #if !defined(GL_ES_VERSION_2_0)
unbindFixed (theCtx, theAttribute);
+ #endif
return;
}
theCtx->core20fwd->glDisableVertexAttribArray (theAttribute);
}
+#if !defined(GL_ES_VERSION_2_0)
// =======================================================================
// function : unbindAttribute
// purpose :
}
}
}
+#endif
{
if (myIsTransPers)
{
+ #if !defined(GL_ES_VERSION_2_0)
// restore matrix
glMatrixMode (GL_PROJECTION);
glPopMatrix();
// Set OCCT state uniform variables
theCtx->ShaderManager()->RevertWorldViewStateTo (&aResultWorldView);
theCtx->ShaderManager()->RevertProjectionStateTo (&aResultProjection);
+ #endif
}
}
return aTransPersPrev;
}
+#if !defined(GL_ES_VERSION_2_0)
GLint aViewport[4];
GLdouble aModelMatrix[4][4];
GLdouble aProjMatrix[4][4];
glGetIntegerv (GL_VIEWPORT, aViewport);
glGetDoublev (GL_MODELVIEW_MATRIX, (GLdouble* )aModelMatrix);
glGetDoublev (GL_PROJECTION_MATRIX, (GLdouble *)aProjMatrix);
+
const GLdouble aViewportW = (GLdouble )aViewport[2];
const GLdouble aViewportH = (GLdouble )aViewport[3];
gluUnProject (-0.5 * aViewportW, -0.5 * aViewportH, 0.0,
(GLdouble* )THE_IDENTITY_MATRIX, (GLdouble* )aProjMatrix, aViewport,
&aW2, &aH2, &aDummy);
+
GLdouble aMoveX = 0.5 * (aW1 - aW2 - theTransPers->pointZ);
GLdouble aMoveY = 0.5 * (aH1 - aH2 - theTransPers->pointZ);
aMoveX = (theTransPers->pointX > 0.0) ? aMoveX : -aMoveX;
aMoveY = (theTransPers->pointY > 0.0) ? aMoveY : -aMoveY;
- glTranslated (aMoveX, aMoveY, 0.0);
+ theCtx->core11->glTranslated (aMoveX, aMoveY, 0.0);
}
}
else if ((theTransPers->mode & TPF_PAN) != TPF_PAN)
&aMoveX, &aMoveY, &aMoveZ);
glMatrixMode (GL_MODELVIEW);
- glTranslated (aMoveX, aMoveY, aMoveZ);
+ theCtx->core11->glTranslated (aMoveX, aMoveY, aMoveZ);
}
// Note: the approach of accessing OpenGl matrices is used now since the matrix
// Set OCCT state uniform variables
theCtx->ShaderManager()->UpdateWorldViewStateTo (&aResultWorldView);
theCtx->ShaderManager()->UpdateProjectionStateTo (&aResultProjection);
-
+#endif
return aTransPersPrev;
}
* Fonctions privees
*/
+#if !defined(GL_ES_VERSION_2_0)
/*-----------------------------------------------------------------*/
/*
* Set des lumieres
glEnable (theLightGlId++);
}
+#endif
/*----------------------------------------------------------------------*/
void OpenGl_View::DrawBackground (OpenGl_Workspace& theWorkspace)
{
+#if !defined(GL_ES_VERSION_2_0)
if ( (theWorkspace.NamedStatus & OPENGL_NS_WHITEBACK) == 0 &&
( myBgTexture.TexId != 0 || myBgGradient.type != Aspect_GFM_NONE ) )
{
glEnable (GL_DEPTH_TEST);
}
}
+#endif
}
/*----------------------------------------------------------------------*/
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
+#if !defined(GL_ES_VERSION_2_0)
// Store and disable current clipping planes
Standard_Integer aMaxPlanes = aContext->MaxClipPlanes();
aPtrPlane->isEnabled = GL_FALSE;
}
}
+#endif
Standard_Boolean isProjectionMatUpdateNeeded = Standard_False;
Standard_Boolean isOrientationMatUpdateNeeded = Standard_False;
DrawBackground (*theWorkspace);
}
+#if !defined(GL_ES_VERSION_2_0)
// Switch off lighting by default
glDisable(GL_LIGHTING);
+#endif
// =================================
// Step 3: Draw underlayer
glDisable( GL_CULL_FACE );
}
+#if !defined(GL_ES_VERSION_2_0)
// if the view is scaled normal vectors are scaled to unit
// length for correct displaying of shaded objects
const gp_Pnt anAxialScale = myCamera->AxialScale();
{
myFog.Front = (Standard_ShortReal )(aFogFrontConverted - myCamera->Distance());
myFog.Back = (Standard_ShortReal )(aFogBackConverted - myCamera->Distance());
- }
+ }
glFogi(GL_FOG_MODE, GL_LINEAR);
glFogf(GL_FOG_START, (Standard_ShortReal )aFogFrontConverted);
// Apply InteriorShadingMethod
glShadeModel( myIntShadingMethod == TEL_SM_FLAT ? GL_FLAT : GL_SMOOTH );
+#endif
// Apply AntiAliasing
if (myAntiAliasing)
}
// safely switch to right Eye buffer
aContext->SetDrawBufferRight();
-
+
// redraw right Eye
RedrawScene (thePrintContext, theWorkspace, aRProj, aOrient);
// ===============================
// Restore clipping planes
+#if !defined(GL_ES_VERSION_2_0)
aClipPlaneId = GL_CLIP_PLANE0;
aPtrPlane = aOldPlanes;
}
delete[] aOldPlanes;
+#endif
// ==============================================================
// Step 8: Keep shader manager informed about last View
if ( myZLayers.NbStructures() <= 0 )
return;
+#if !defined(GL_ES_VERSION_2_0)
glPushAttrib ( GL_DEPTH_BUFFER_BIT );
+#endif
//TsmPushAttri(); /* save previous graphics context */
if ( (AWorkspace->NamedStatus & OPENGL_NS_2NDPASSNEED) == 0 )
{
+ #if !defined(GL_ES_VERSION_2_0)
const int antiAliasingMode = AWorkspace->AntiAliasingMode();
+ #endif
if ( !myAntiAliasing )
{
+ #if !defined(GL_ES_VERSION_2_0)
glDisable(GL_POINT_SMOOTH);
glDisable(GL_LINE_SMOOTH);
if( antiAliasingMode & 2 ) glDisable(GL_POLYGON_SMOOTH);
+ #endif
glBlendFunc (GL_ONE, GL_ZERO);
glDisable (GL_BLEND);
}
else
{
+ #if !defined(GL_ES_VERSION_2_0)
glEnable(GL_POINT_SMOOTH);
glEnable(GL_LINE_SMOOTH);
if( antiAliasingMode & 2 ) glEnable(GL_POLYGON_SMOOTH);
+ #endif
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable (GL_BLEND);
}
myZLayers.Render (AWorkspace);
+#if !defined(GL_ES_VERSION_2_0)
//TsmPopAttri(); /* restore previous graphics context; before update lights */
glPopAttrib();
+#endif
}
/*----------------------------------------------------------------------*/
const Graphic3d_CView& ACView,
const Aspect_CLayer2d& ACLayer)
{
+#if !defined(GL_ES_VERSION_2_0)
if (&ACLayer == NULL
|| ACLayer.ptrLayer == NULL
|| ACLayer.ptrLayer->listIndex == 0) return;
glViewport (0, 0, (GLsizei) ACView.DefWindow.dx, (GLsizei) ACView.DefWindow.dy);
glFlush ();
+#endif
}
/*----------------------------------------------------------------------*/
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
const GLenum aDataFormat = (anImage.Format() == Image_PixMap::ImgRGB) ? GL_RGB : GL_RGBA;
+
+#if !defined(GL_ES_VERSION_2_0)
gluBuild2DMipmaps (GL_TEXTURE_2D, 3/*4*/,
GLint(anImage.SizeX()), GLint(anImage.SizeY()),
aDataFormat, GL_UNSIGNED_BYTE, anImage.Data());
+#endif
myBgTexture.TexId = aTextureId;
myBgTexture.Width = (Standard_Integer )anImage.SizeX();
}
}
+#if !defined(GL_ES_VERSION_2_0)
// Setup view projection
glMatrixMode (GL_PROJECTION);
aContext->ShaderManager()->UpdateProjectionStateTo (&aResultProjection);
// force shader uniform restore on next frame
- myProjectionState = 0;
+ myProjectionState = 0;
}
+#endif
// Setup view orientation
theWorkspace->SetViewMatrix (theOrientation);
+#if !defined(GL_ES_VERSION_2_0)
// Apply Lights
{
// setup lights
glDisable (aLightGlId);
}
}
+#endif
// Clear status bitfields
theWorkspace->NamedStatus &= ~(OPENGL_NS_2NDPASSNEED | OPENGL_NS_2NDPASSDO);
theWorkspace->EnableTexture (myTextureEnv);
// Remember OpenGl properties
- GLint aSaveBlendDst, aSaveBlendSrc;
+ GLint aSaveBlendDst = GL_ONE_MINUS_SRC_ALPHA, aSaveBlendSrc = GL_SRC_ALPHA;
GLint aSaveZbuffFunc;
GLboolean aSaveZbuffWrite;
glGetBooleanv (GL_DEPTH_WRITEMASK, &aSaveZbuffWrite);
glGetIntegerv (GL_DEPTH_FUNC, &aSaveZbuffFunc);
+ #if !defined(GL_ES_VERSION_2_0)
glGetIntegerv (GL_BLEND_DST, &aSaveBlendDst);
glGetIntegerv (GL_BLEND_SRC, &aSaveBlendSrc);
+ #endif
GLboolean wasZbuffEnabled = glIsEnabled (GL_DEPTH_TEST);
GLboolean wasBlendEnabled = glIsEnabled (GL_BLEND);
if (theDepths == NULL || !Activate())
return;
+#if !defined(GL_ES_VERSION_2_0)
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
gluOrtho2D (0.0, (GLdouble )myWidth, 0.0, (GLdouble )myHeight);
DisableFeatures();
glReadPixels (theX, theY, theWidth, theHeight, GL_DEPTH_COMPONENT, GL_FLOAT, theDepths);
EnableFeatures();
+#endif
}
// =======================================================================
myHeight = aNewHeight;
#endif
+ glDisable (GL_SCISSOR_TEST);
+#if !defined(GL_ES_VERSION_2_0)
glMatrixMode (GL_MODELVIEW);
glViewport (0, 0, myWidth, myHeight);
-
- glDisable (GL_SCISSOR_TEST);
glDrawBuffer (GL_BACK);
+#endif
}
#endif // !__APPLE__
// =======================================================================
void OpenGl_Window::DisableFeatures() const
{
+#if !defined(GL_ES_VERSION_2_0)
glPixelTransferi (GL_MAP_COLOR, GL_FALSE);
+#endif
/*
* Disable stuff that's likely to slow down glDrawPixels.
* (Omit as much of this as possible, when you know in advance
* that the OpenGL state will already be set correctly.)
*/
- glDisable(GL_ALPHA_TEST);
glDisable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
- glDisable(GL_FOG);
- glDisable(GL_LIGHTING);
+ glDisable(GL_TEXTURE_2D);
+ glDisable(GL_STENCIL_TEST);
+#if !defined(GL_ES_VERSION_2_0)
+ glDisable(GL_LIGHTING);
+ glDisable(GL_ALPHA_TEST);
+ glDisable(GL_FOG);
glDisable(GL_LOGIC_OP);
- glDisable(GL_STENCIL_TEST);
glDisable(GL_TEXTURE_1D);
- glDisable(GL_TEXTURE_2D);
+
glPixelTransferi(GL_MAP_COLOR, GL_FALSE);
glPixelTransferi(GL_RED_SCALE, 1);
glPixelTransferi(GL_RED_BIAS, 0);
glDisable(GL_TEXTURE_3D_EXT);
#endif
}
+#endif
}
// =======================================================================
// =======================================================================
void OpenGl_Window::MakeFrontBufCurrent() const
{
+#if !defined(GL_ES_VERSION_2_0)
glDrawBuffer (GL_FRONT);
+#endif
}
// =======================================================================
// =======================================================================
void OpenGl_Window::MakeBackBufCurrent() const
{
+#if !defined(GL_ES_VERSION_2_0)
glDrawBuffer (GL_BACK);
+#endif
}
// General initialization of the context
+#if !defined(GL_ES_VERSION_2_0)
// Eviter d'avoir les faces mal orientees en noir.
// Pourrait etre utiliser pour detecter les problemes d'orientation
glLightModeli ((GLenum )GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
glHint (GL_POINT_SMOOTH_HINT, GL_FASTEST);
glHint (GL_LINE_SMOOTH_HINT, GL_FASTEST);
glHint (GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
+#endif
// AA mode
const char* anAaEnv = ::getenv ("CALL_OPENGL_ANTIALIASING_MODE");
return myTextureBound;
}
+#if !defined(GL_ES_VERSION_2_0)
// reset texture matrix because some code may expect it is identity
GLint aMatrixMode = GL_TEXTURE;
glGetIntegerv (GL_MATRIX_MODE, &aMatrixMode);
glMatrixMode (GL_TEXTURE);
glLoadIdentity();
glMatrixMode (aMatrixMode);
+#endif
myTextureBound->Unbind (myGlContext);
switch (myTextureBound->GetTarget())
{
+ #if !defined(GL_ES_VERSION_2_0)
case GL_TEXTURE_1D:
{
+
if (myTextureBound->GetParams()->GenMode() != GL_NONE)
{
glDisable (GL_TEXTURE_GEN_S);
glDisable (GL_TEXTURE_1D);
break;
}
+ #endif
case GL_TEXTURE_2D:
{
+ #if !defined(GL_ES_VERSION_2_0)
if (myTextureBound->GetParams()->GenMode() != GL_NONE)
{
glDisable (GL_TEXTURE_GEN_S);
glDisable (GL_POINT_SPRITE);
}
}
+ #endif
glDisable (GL_TEXTURE_2D);
break;
}
return;
}
+#if !defined(GL_ES_VERSION_2_0)
GLint aMatrixMode = GL_TEXTURE;
glGetIntegerv (GL_MATRIX_MODE, &aMatrixMode);
{
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, aParams->IsModulate() ? GL_MODULATE : GL_DECAL);
}
+#endif
// setup texture filtering and wrapping
//if (theTexture->GetParams() != theParams)
const GLenum aFilter = (aParams->Filter() == Graphic3d_TOTF_NEAREST) ? GL_NEAREST : GL_LINEAR;
- const GLenum aWrapMode = aParams->IsRepeat() ? GL_REPEAT : GL_CLAMP;
+ const GLenum aWrapMode = aParams->IsRepeat() ? GL_REPEAT : myGlContext->TextureWrapClamp();
switch (theTexture->GetTarget())
{
+ #if !defined(GL_ES_VERSION_2_0)
case GL_TEXTURE_1D:
{
glTexParameteri (GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, aFilter);
glTexParameteri (GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, aWrapMode);
break;
}
+ #endif
case GL_TEXTURE_2D:
{
GLenum aFilterMin = aFilter;
switch (theTexture->GetTarget())
{
+ #if !defined(GL_ES_VERSION_2_0)
case GL_TEXTURE_1D:
{
if (aParams->GenMode() != Graphic3d_TOTM_MANUAL)
glEnable (GL_TEXTURE_1D);
break;
}
+ #endif
case GL_TEXTURE_2D:
{
+ #if !defined(GL_ES_VERSION_2_0)
if (aParams->GenMode() != Graphic3d_TOTM_MANUAL)
{
glEnable (GL_TEXTURE_GEN_S);
glEnable (GL_TEXTURE_GEN_T);
}
+ #endif
glEnable (GL_TEXTURE_2D);
break;
}
default: break;
}
+#if !defined(GL_ES_VERSION_2_0)
glMatrixMode (aMatrixMode); // turn back active matrix
+#endif
theTexture->SetParams (aParams);
}
glDisable (GL_DEPTH_TEST);
}
+ #if !defined(GL_ES_VERSION_2_0)
glClearDepth (1.0);
+ #else
+ glClearDepthf (1.0f);
+ #endif
toClear |= GL_DEPTH_BUFFER_BIT;
}
else
// =======================================================================
void OpenGl_Workspace::copyBackToFront()
{
+#if !defined(GL_ES_VERSION_2_0)
glMatrixMode (GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluOrtho2D (0.0, (GLdouble )myWidth, 0.0, (GLdouble )myHeight);
+
glMatrixMode (GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glDrawBuffer (GL_BACK);
+#endif
myIsImmediateDrawn = Standard_False;
}
}
GLboolean isDoubleBuffer = GL_FALSE;
+#if !defined(GL_ES_VERSION_2_0)
glGetBooleanv (GL_DOUBLEBUFFER, &isDoubleBuffer);
+#endif
if (myView->ImmediateStructures().IsEmpty())
{
if (theToForce
glDisable (GL_POLYGON_OFFSET_FILL);
}
+#if !defined(GL_ES_VERSION_2_0)
if ((theOffsetData.mode & Aspect_POM_Line) == Aspect_POM_Line)
{
glEnable (GL_POLYGON_OFFSET_LINE);
{
glDisable (GL_POLYGON_OFFSET_POINT);
}
+#endif
glPolygonOffset (theOffsetData.factor, theOffsetData.units);
}
// reset material
if (NamedStatus & OPENGL_NS_RESMAT)
{
+ #if !defined(GL_ES_VERSION_2_0)
glMaterialfv (aFace, GL_AMBIENT, myMatTmp.Ambient.GetData());
glMaterialfv (aFace, GL_DIFFUSE, myMatTmp.Diffuse.GetData());
glMaterialfv (aFace, GL_SPECULAR, myMatTmp.Specular.GetData());
glMaterialfv (aFace, GL_EMISSION, myMatTmp.Emission.GetData());
glMaterialf (aFace, GL_SHININESS, myMatTmp.Shine());
+ #endif
if (theFlag == TEL_FRONT_MATERIAL)
{
OpenGl_Material& anOld = (theFlag == TEL_FRONT_MATERIAL)
? myMatFront
: myMatBack;
-
+#if !defined(GL_ES_VERSION_2_0)
if (myMatTmp.Ambient.r() != anOld.Ambient.r()
|| myMatTmp.Ambient.g() != anOld.Ambient.g()
|| myMatTmp.Ambient.b() != anOld.Ambient.b())
{
glMaterialf (aFace, GL_SHININESS, myMatTmp.Shine());
}
+#endif
anOld = myMatTmp;
if (aFace == GL_FRONT_AND_BACK)
{
{
OpenGl_Matrix aStructureMatT;
OpenGl_Transposemat3( &aStructureMatT, StructureMatrix_applied);
-
- glMatrixMode (GL_MODELVIEW);
OpenGl_Multiplymat3 (&myModelViewMatrix, &aStructureMatT, ViewMatrix_applied);
+#if !defined(GL_ES_VERSION_2_0)
+ glMatrixMode (GL_MODELVIEW);
glLoadMatrixf ((const GLfloat* )&myModelViewMatrix.mat);
+#endif
}
/*----------------------------------------------------------------------*/
{
if ( WithApply && (AspectLine_set != AspectLine_applied) )
{
- glColor3fv(AspectLine_set->Color().rgb);
+ const GLfloat* anRgb = AspectLine_set->Color().rgb;
+ #if !defined(GL_ES_VERSION_2_0)
+ glColor3fv(anRgb);
+ #endif
if ( !AspectLine_applied || (AspectLine_set->Type() != AspectLine_applied->Type() ) )
{
return AspectFace_set;
}
+#if !defined(GL_ES_VERSION_2_0)
const Aspect_InteriorStyle anIntstyle = AspectFace_set->InteriorStyle();
if (AspectFace_applied == NULL || AspectFace_applied->InteriorStyle() != anIntstyle)
{
myLineAttribs->SetTypeOfHatch (hatchstyle);
}
}
+#endif
// Aspect_POM_None means: do not change current settings
if ((AspectFace_set->PolygonOffset().mode & Aspect_POM_None) != Aspect_POM_None)
{
if (!AspectMarker_applied || (AspectMarker_set->Scale() != AspectMarker_applied->Scale()))
{
+ #if !defined(GL_ES_VERSION_2_0)
glPointSize (AspectMarker_set->Scale());
#ifdef HAVE_GL2PS
gl2psPointSize (AspectMarker_set->Scale());
#endif
+ #endif
}
AspectMarker_applied = AspectMarker_set;
}
const Handle(Graphic3d_Buffer)& anAttribs = theArray->Attributes();
const Handle(Graphic3d_BoundBuffer)& aBounds = theArray->Bounds();
if (theArray->DrawMode() < GL_TRIANGLES
+ #if !defined(GL_ES_VERSION_2_0)
|| theArray->DrawMode() > GL_POLYGON
+ #else
+ || theArray->DrawMode() > GL_TRIANGLE_FAN
+ #endif
|| anAttribs.IsNull())
{
return NULL;
#ifdef RAY_TRACE_PRINT_INFO
switch (theArray->DrawMode())
{
- case GL_POLYGON: std::cout << "\tAdding GL_POLYGON\n"; break;
case GL_TRIANGLES: std::cout << "\tAdding GL_TRIANGLES\n"; break;
- case GL_QUADS: std::cout << "\tAdding GL_QUADS\n"; break;
case GL_TRIANGLE_FAN: std::cout << "\tAdding GL_TRIANGLE_FAN\n"; break;
case GL_TRIANGLE_STRIP: std::cout << "\tAdding GL_TRIANGLE_STRIP\n"; break;
+ #if !defined(GL_ES_VERSION_2_0)
+ case GL_QUADS: std::cout << "\tAdding GL_QUADS\n"; break;
case GL_QUAD_STRIP: std::cout << "\tAdding GL_QUAD_STRIP\n"; break;
+ case GL_POLYGON: std::cout << "\tAdding GL_POLYGON\n"; break;
+ #endif
}
#endif
switch (theArray.DrawMode())
{
case GL_TRIANGLES: return AddRaytraceTriangleArray (theSet, theArray.Indices(), theOffset, theCount, theMatID);
- case GL_QUADS: return AddRaytraceQuadrangleArray (theSet, theArray.Indices(), theOffset, theCount, theMatID);
case GL_TRIANGLE_FAN: return AddRaytraceTriangleFanArray (theSet, theArray.Indices(), theOffset, theCount, theMatID);
case GL_TRIANGLE_STRIP: return AddRaytraceTriangleStripArray (theSet, theArray.Indices(), theOffset, theCount, theMatID);
+ #if !defined(GL_ES_VERSION_2_0)
+ case GL_QUADS: return AddRaytraceQuadrangleArray (theSet, theArray.Indices(), theOffset, theCount, theMatID);
case GL_QUAD_STRIP: return AddRaytraceQuadrangleStripArray (theSet, theArray.Indices(), theOffset, theCount, theMatID);
case GL_POLYGON: return AddRaytracePolygonArray (theSet, theArray.Indices(), theOffset, theCount, theMatID);
+ #endif
}
return Standard_False;
}
myRaytraceScreenQuad.Init (myGlContext, 3, 6, aVertices);
myComputeInitStatus = OpenGl_RT_INIT; // initialized in normal way
-
+
return Standard_True;
}
myView->RedrawLayer2d (myPrintContext, theCView, theCUnderLayer);
+#if !defined(GL_ES_VERSION_2_0)
// Generate ray-traced image
glMatrixMode (GL_PROJECTION);
glPushMatrix();
glMatrixMode (GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
+#endif
glEnable (GL_BLEND);
glBlendFunc (GL_ONE, GL_SRC_ALPHA);
if (wasDepthTestEnabled)
glEnable (GL_DEPTH_TEST);
+#if !defined(GL_ES_VERSION_2_0)
glMatrixMode (GL_PROJECTION);
glPopMatrix();
glMatrixMode (GL_MODELVIEW);
glPopMatrix();
+#endif
// Redraw trihedron
myView->RedrawTrihedron (this);