mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0023022: This is desirable to access OpenGl extensions and core API (1.2+) in one place
Extend OpenGl_Context to provide GL2.0 core functionality Added 'glext.h' header provided by Khronos group with definitions and GL functions' types. Added OpenGl_GlCoreXX structures with function list to appropriate GL core functionality. Fixed memory leak in OpenGl_Context destructor. Eliminate inclusions of gl.h header Use OpenGl_GlCore11.hxx instead. Removed obsolote M_PI redefinitions. Slightly cleaned up included headers. Reuse definitions from glext.h OpenGl_ArbVBO and OpenGl_ExtFBO originally provide own definitions for OpenGL extensions.
This commit is contained in:
parent
13b4230bdb
commit
5f8b738ea5
@ -94,7 +94,6 @@ OpenGl_AVIWriter.cxx
|
||||
OpenGl_tsm.hxx
|
||||
OpenGl_telem_view.cxx
|
||||
OpenGl_telem_view.hxx
|
||||
OpenGl_tgl_all.hxx
|
||||
OpenGl_FrameBuffer.hxx
|
||||
OpenGl_FrameBuffer.cxx
|
||||
OpenGl_TextureBox.cxx
|
||||
@ -115,12 +114,17 @@ OpenGl_transform_persistence.hxx
|
||||
OpenGl_FontMgr.hxx
|
||||
OpenGl_FontMgr.cxx
|
||||
OpenGl_tgl_funcs.hxx
|
||||
OpenGl_togl_texture.cxx
|
||||
OpenGl_togl_inquireplane.cxx
|
||||
Handle_OpenGl_Context.hxx
|
||||
OpenGl_Context.hxx
|
||||
OpenGl_Context.cxx
|
||||
OpenGl_ArbVBO.hxx
|
||||
OpenGl_ExtFBO.hxx
|
||||
glext.h
|
||||
OpenGl_GlCore11.hxx
|
||||
OpenGl_GlCore12.hxx
|
||||
OpenGl_GlCore13.hxx
|
||||
OpenGl_GlCore14.hxx
|
||||
OpenGl_GlCore15.hxx
|
||||
OpenGl_GlCore20.hxx
|
||||
OpenGl_LayerList.cxx
|
||||
OpenGl_LayerList.hxx
|
||||
OpenGl_LayerList.hxx
|
||||
|
@ -6,39 +6,16 @@
|
||||
#ifndef _OpenGl_ArbVBO_H__
|
||||
#define _OpenGl_ArbVBO_H__
|
||||
|
||||
#if (defined(_WIN32) || defined(__WIN32__))
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <GL/gl.h>
|
||||
|
||||
typedef ptrdiff_t GLsizeiptr;
|
||||
#include <OpenGl_GlCore12.hxx>
|
||||
|
||||
//! VBO is part of OpenGL since 1.5
|
||||
struct OpenGl_ArbVBO
|
||||
{
|
||||
#ifndef GL_ARRAY_BUFFER_ARB
|
||||
#define GL_ARRAY_BUFFER_ARB 0x8892
|
||||
#endif
|
||||
#ifndef GL_STATIC_DRAW_ARB
|
||||
#define GL_STATIC_DRAW_ARB 0x88E4
|
||||
#endif
|
||||
#ifndef GL_ELEMENTS_ARRAY_BUFFER_ARB
|
||||
#define GL_ELEMENTS_ARRAY_BUFFER_ARB 0x8893
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
typedef void (APIENTRY *glBindBuffer_t) (GLenum target, GLuint buffer);
|
||||
typedef void (APIENTRY *glDeleteBuffers_t) (GLsizei n, const GLuint* buffers);
|
||||
typedef void (APIENTRY *glGenBuffers_t) (GLsizei n, GLuint* buffers);
|
||||
typedef void (APIENTRY *glBufferData_t) (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
|
||||
|
||||
public:
|
||||
|
||||
glGenBuffers_t glGenBuffersARB;
|
||||
glBindBuffer_t glBindBufferARB;
|
||||
glBufferData_t glBufferDataARB;
|
||||
glDeleteBuffers_t glDeleteBuffersARB;
|
||||
PFNGLGENBUFFERSARBPROC glGenBuffersARB;
|
||||
PFNGLBINDBUFFERARBPROC glBindBufferARB;
|
||||
PFNGLBUFFERDATAARBPROC glBufferDataARB;
|
||||
PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB;
|
||||
|
||||
};
|
||||
|
||||
|
@ -3,24 +3,60 @@
|
||||
// Author: Kirill GAVRILOV
|
||||
// Copyright: OPEN CASCADE 2012
|
||||
|
||||
#if (defined(_WIN32) || defined(__WIN32__))
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <OpenGl_Context.hxx>
|
||||
|
||||
#include <OpenGl_ArbVBO.hxx>
|
||||
#include <OpenGl_ExtFBO.hxx>
|
||||
#include <OpenGl_GlCore20.hxx>
|
||||
|
||||
#if (defined(_WIN32) || defined(__WIN32__))
|
||||
//
|
||||
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
||||
#include <dlfcn.h>
|
||||
#else
|
||||
#include <GL/glx.h> // glXGetProcAddress()
|
||||
#endif
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE (OpenGl_Context, Standard_Transient)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Context, Standard_Transient)
|
||||
|
||||
#if (!defined(_WIN32) && !defined(__WIN32__))
|
||||
#include <GL/glx.h>
|
||||
#endif
|
||||
//! Make record shorter to retrieve function pointer using variable with same name
|
||||
#define FindProcShort(theStruct, theFunc) FindProc(#theFunc, theStruct->theFunc)
|
||||
|
||||
// =======================================================================
|
||||
// function : OpenGl_Context
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
OpenGl_Context::OpenGl_Context()
|
||||
: arbVBO (NULL),
|
||||
extFBO (NULL)
|
||||
: core12 (NULL),
|
||||
core13 (NULL),
|
||||
core14 (NULL),
|
||||
core15 (NULL),
|
||||
core20 (NULL),
|
||||
arbVBO (NULL),
|
||||
extFBO (NULL),
|
||||
myGlLibHandle (NULL),
|
||||
myGlCore20 (NULL),
|
||||
myGlVerMajor (0),
|
||||
myGlVerMinor (0),
|
||||
myIsInitialized (Standard_False)
|
||||
{
|
||||
//
|
||||
#if defined(MAC_OS_X_VERSION_10_3) && !defined(MACOSX_USE_GLX)
|
||||
// Vendors can not extend functionality on this system
|
||||
// and developers are limited to OpenGL support provided by Mac OS X SDK.
|
||||
// We retrieve function pointers from system library
|
||||
// to generalize extensions support on all platforms.
|
||||
// In this way we also reach binary compatibility benefit between OS releases
|
||||
// if some newest functionality is optionally used.
|
||||
// Notice that GL version / extension availability checks are required
|
||||
// because function pointers may be available but not functionality itself
|
||||
// (depends on renderer).
|
||||
myGlLibHandle = dlopen ("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY);
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@ -29,34 +65,76 @@ OpenGl_Context::OpenGl_Context()
|
||||
// =======================================================================
|
||||
OpenGl_Context::~OpenGl_Context()
|
||||
{
|
||||
//
|
||||
delete myGlCore20;
|
||||
delete arbVBO;
|
||||
delete extFBO;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : findProc
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void* OpenGl_Context::findProc (const char* theFuncName)
|
||||
{
|
||||
#if (defined(_WIN32) || defined(__WIN32__))
|
||||
return wglGetProcAddress (theFuncName);
|
||||
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
||||
return (myGlLibHandle != NULL) ? dlsym (myGlLibHandle, theFuncName) : NULL;
|
||||
#else
|
||||
return (void* )glXGetProcAddress ((const GLubyte* )theFuncName);
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : CheckExtension
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_Context::CheckExtension (const char* theExtName,
|
||||
const char* theExtString)
|
||||
Standard_Boolean OpenGl_Context::CheckExtension (const char* theExtName)
|
||||
{
|
||||
if (theExtName == NULL
|
||||
|| theExtString == NULL) {
|
||||
std::cerr << "CheckExtension called with NULL string! No GL context?\n";
|
||||
if (theExtName == NULL)
|
||||
{
|
||||
std::cerr << "CheckExtension called with NULL string!\n";
|
||||
return Standard_False;
|
||||
}
|
||||
int anExtNameLen = strlen (theExtName);
|
||||
|
||||
// available since OpenGL 3.0
|
||||
// and the ONLY way to check extensions with OpenGL 3.1+ core profile
|
||||
/**if (IsGlUpperEqual (3, 0))
|
||||
{
|
||||
GLint anExtNb = 0;
|
||||
glGetIntegerv (GL_NUM_EXTENSIONS, &anExtNb);
|
||||
for (GLint anIter = 0; anIter < anExtNb; ++anIter)
|
||||
{
|
||||
const char* anExtension = (const char* )core30->glGetStringi (GL_EXTENSIONS, (GLuint )anIter);
|
||||
if (anExtension[anExtNameLen] == '\0' &&
|
||||
strncmp (anExtension, theExtName, anExtNameLen) == 0)
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}*/
|
||||
|
||||
// use old way with huge string for all extensions
|
||||
const char* anExtString = (const char* )glGetString (GL_EXTENSIONS);
|
||||
if (anExtString == NULL)
|
||||
{
|
||||
std::cerr << "glGetString (GL_EXTENSIONS) returns NULL! No GL context?\n";
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// Search for theExtName in the extensions string.
|
||||
// Use of strstr() is not sufficient because extension names can be prefixes of other extension names.
|
||||
char* aPtrIter = (char* )theExtString;
|
||||
int anExtNameLen = strlen(theExtName);
|
||||
const char* aPtrEnd = aPtrIter + strlen(theExtString);
|
||||
|
||||
char* aPtrIter = (char* )anExtString;
|
||||
const char* aPtrEnd = aPtrIter + strlen (anExtString);
|
||||
while (aPtrIter < aPtrEnd)
|
||||
{
|
||||
int n = strcspn (aPtrIter, " ");
|
||||
if ((n == anExtNameLen) && (strncmp (theExtName, aPtrIter, n) == 0))
|
||||
if ((n == anExtNameLen) && (strncmp (aPtrIter, theExtName, anExtNameLen) == 0))
|
||||
{
|
||||
return Standard_True;
|
||||
|
||||
}
|
||||
aPtrIter += (n + 1);
|
||||
}
|
||||
return Standard_False;
|
||||
@ -68,38 +146,380 @@ Standard_Boolean OpenGl_Context::CheckExtension (const char* theExtName,
|
||||
// =======================================================================
|
||||
void OpenGl_Context::Init()
|
||||
{
|
||||
const char* anExtString = (const char* )glGetString (GL_EXTENSIONS);
|
||||
if (CheckExtension ("GL_ARB_vertex_buffer_object", anExtString))
|
||||
if (!myIsInitialized)
|
||||
{
|
||||
init();
|
||||
myIsInitialized = Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ResetErrors
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Context::ResetErrors()
|
||||
{
|
||||
while (glGetError() != GL_NO_ERROR)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : readGlVersion
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Context::readGlVersion()
|
||||
{
|
||||
// reset values
|
||||
myGlVerMajor = 0;
|
||||
myGlVerMinor = 0;
|
||||
|
||||
// available since OpenGL 3.0
|
||||
GLint aMajor, aMinor;
|
||||
glGetIntegerv (GL_MAJOR_VERSION, &aMajor);
|
||||
glGetIntegerv (GL_MINOR_VERSION, &aMinor);
|
||||
if (glGetError() == GL_NO_ERROR)
|
||||
{
|
||||
myGlVerMajor = aMajor;
|
||||
myGlVerMinor = aMinor;
|
||||
return;
|
||||
}
|
||||
ResetErrors();
|
||||
|
||||
// Read version string.
|
||||
// Notice that only first two numbers splitted 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.
|
||||
const char* aVerStr = (const char* )glGetString (GL_VERSION);
|
||||
if (aVerStr == NULL || *aVerStr == '\0')
|
||||
{
|
||||
// invalid GL context
|
||||
return;
|
||||
}
|
||||
|
||||
// parse string for major number
|
||||
char aMajorStr[32];
|
||||
char aMinorStr[32];
|
||||
size_t aMajIter = 0;
|
||||
while (aVerStr[aMajIter] >= '0' && aVerStr[aMajIter] <= '9')
|
||||
{
|
||||
++aMajIter;
|
||||
}
|
||||
if (aMajIter == 0 || aMajIter >= sizeof(aMajorStr))
|
||||
{
|
||||
return;
|
||||
}
|
||||
memcpy (aMajorStr, aVerStr, aMajIter);
|
||||
aMajorStr[aMajIter] = '\0';
|
||||
|
||||
// parse string for minor number
|
||||
size_t aMinIter = aMajIter + 1;
|
||||
while (aVerStr[aMinIter] >= '0' && aVerStr[aMinIter] <= '9')
|
||||
{
|
||||
++aMinIter;
|
||||
}
|
||||
size_t aMinLen = aMinIter - aMajIter - 1;
|
||||
if (aMinLen == 0 || aMinLen >= sizeof(aMinorStr))
|
||||
{
|
||||
return;
|
||||
}
|
||||
memcpy (aMinorStr, aVerStr, aMinLen);
|
||||
aMinorStr[aMinLen] = '\0';
|
||||
|
||||
// read numbers
|
||||
myGlVerMajor = atoi (aMajorStr);
|
||||
myGlVerMinor = atoi (aMinorStr);
|
||||
|
||||
if (myGlVerMajor <= 0)
|
||||
{
|
||||
myGlVerMajor = 0;
|
||||
myGlVerMinor = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Context::init()
|
||||
{
|
||||
// read version
|
||||
readGlVersion();
|
||||
|
||||
// initialize VBO extension (ARB)
|
||||
if (CheckExtension ("GL_ARB_vertex_buffer_object"))
|
||||
{
|
||||
arbVBO = new OpenGl_ArbVBO();
|
||||
memset(arbVBO, 0, sizeof(OpenGl_ArbVBO)); // nullify whole structure for safety
|
||||
if (!FindProc ("glGenBuffersARB", arbVBO->glGenBuffersARB)
|
||||
|| !FindProc ("glBindBufferARB", arbVBO->glBindBufferARB)
|
||||
|| !FindProc ("glBufferDataARB", arbVBO->glBufferDataARB)
|
||||
|| !FindProc ("glDeleteBuffersARB", arbVBO->glDeleteBuffersARB))
|
||||
memset (arbVBO, 0, sizeof(OpenGl_ArbVBO)); // nullify whole structure
|
||||
if (!FindProcShort (arbVBO, glGenBuffersARB)
|
||||
|| !FindProcShort (arbVBO, glBindBufferARB)
|
||||
|| !FindProcShort (arbVBO, glBufferDataARB)
|
||||
|| !FindProcShort (arbVBO, glDeleteBuffersARB))
|
||||
{
|
||||
delete arbVBO;
|
||||
arbVBO = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (CheckExtension ("GL_EXT_framebuffer_object", anExtString))
|
||||
// initialize FBO extension (EXT)
|
||||
if (CheckExtension ("GL_EXT_framebuffer_object"))
|
||||
{
|
||||
extFBO = new OpenGl_ExtFBO();
|
||||
memset(extFBO, 0, sizeof(OpenGl_ExtFBO)); // nullify whole structure for safety
|
||||
if (!FindProc ("glGenFramebuffersEXT", extFBO->glGenFramebuffersEXT)
|
||||
|| !FindProc ("glDeleteFramebuffersEXT", extFBO->glDeleteFramebuffersEXT)
|
||||
|| !FindProc ("glBindFramebufferEXT", extFBO->glBindFramebufferEXT)
|
||||
|| !FindProc ("glFramebufferTexture2DEXT", extFBO->glFramebufferTexture2DEXT)
|
||||
|| !FindProc ("glCheckFramebufferStatusEXT", extFBO->glCheckFramebufferStatusEXT)
|
||||
|| !FindProc ("glGenRenderbuffersEXT", extFBO->glGenRenderbuffersEXT)
|
||||
|| !FindProc ("glDeleteRenderbuffersEXT", extFBO->glDeleteRenderbuffersEXT)
|
||||
|| !FindProc ("glBindRenderbufferEXT", extFBO->glBindRenderbufferEXT)
|
||||
|| !FindProc ("glRenderbufferStorageEXT", extFBO->glRenderbufferStorageEXT)
|
||||
|| !FindProc ("glFramebufferRenderbufferEXT", extFBO->glFramebufferRenderbufferEXT))
|
||||
memset (extFBO, 0, sizeof(OpenGl_ExtFBO)); // nullify whole structure
|
||||
if (!FindProcShort (extFBO, glGenFramebuffersEXT)
|
||||
|| !FindProcShort (extFBO, glDeleteFramebuffersEXT)
|
||||
|| !FindProcShort (extFBO, glBindFramebufferEXT)
|
||||
|| !FindProcShort (extFBO, glFramebufferTexture2DEXT)
|
||||
|| !FindProcShort (extFBO, glCheckFramebufferStatusEXT)
|
||||
|| !FindProcShort (extFBO, glGenRenderbuffersEXT)
|
||||
|| !FindProcShort (extFBO, glDeleteRenderbuffersEXT)
|
||||
|| !FindProcShort (extFBO, glBindRenderbufferEXT)
|
||||
|| !FindProcShort (extFBO, glRenderbufferStorageEXT)
|
||||
|| !FindProcShort (extFBO, glFramebufferRenderbufferEXT))
|
||||
{
|
||||
delete extFBO;
|
||||
extFBO = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
myGlCore20 = new OpenGl_GlCore20();
|
||||
memset (myGlCore20, 0, sizeof(OpenGl_GlCore20)); // nullify whole structure
|
||||
|
||||
// initialize OpenGL 1.2 core functionality
|
||||
if (IsGlUpperEqual (1, 2))
|
||||
{
|
||||
if (!FindProcShort (myGlCore20, glBlendColor)
|
||||
|| !FindProcShort (myGlCore20, glBlendEquation)
|
||||
|| !FindProcShort (myGlCore20, glDrawRangeElements)
|
||||
|| !FindProcShort (myGlCore20, glTexImage3D)
|
||||
|| !FindProcShort (myGlCore20, glTexSubImage3D)
|
||||
|| !FindProcShort (myGlCore20, glCopyTexSubImage3D))
|
||||
{
|
||||
myGlVerMajor = 1;
|
||||
myGlVerMinor = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// initialize OpenGL 1.3 core functionality
|
||||
if (IsGlUpperEqual (1, 3))
|
||||
{
|
||||
if (!FindProcShort (myGlCore20, glActiveTexture)
|
||||
|| !FindProcShort (myGlCore20, glSampleCoverage)
|
||||
|| !FindProcShort (myGlCore20, glCompressedTexImage3D)
|
||||
|| !FindProcShort (myGlCore20, glCompressedTexImage2D)
|
||||
|| !FindProcShort (myGlCore20, glCompressedTexImage1D)
|
||||
|| !FindProcShort (myGlCore20, glCompressedTexSubImage3D)
|
||||
|| !FindProcShort (myGlCore20, glCompressedTexSubImage2D)
|
||||
|| !FindProcShort (myGlCore20, glCompressedTexSubImage1D)
|
||||
|| !FindProcShort (myGlCore20, glGetCompressedTexImage)
|
||||
// deprecated
|
||||
|| !FindProcShort (myGlCore20, glClientActiveTexture)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord1d)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord1dv)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord1f)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord1fv)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord1i)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord1iv)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord1s)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord1sv)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord2d)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord2dv)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord2f)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord2fv)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord2i)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord2iv)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord2s)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord2sv)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord3d)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord3dv)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord3f)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord3fv)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord3i)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord3iv)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord3s)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord3sv)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord4d)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord4dv)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord4f)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord4fv)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord4i)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord4iv)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord4s)
|
||||
|| !FindProcShort (myGlCore20, glMultiTexCoord4sv)
|
||||
|| !FindProcShort (myGlCore20, glLoadTransposeMatrixf)
|
||||
|| !FindProcShort (myGlCore20, glLoadTransposeMatrixd)
|
||||
|| !FindProcShort (myGlCore20, glMultTransposeMatrixf)
|
||||
|| !FindProcShort (myGlCore20, glMultTransposeMatrixd))
|
||||
{
|
||||
myGlVerMajor = 1;
|
||||
myGlVerMinor = 2;
|
||||
core12 = myGlCore20;
|
||||
}
|
||||
}
|
||||
|
||||
// initialize OpenGL 1.4 core functionality
|
||||
if (IsGlUpperEqual (1, 4))
|
||||
{
|
||||
if (!FindProcShort (myGlCore20, glBlendFuncSeparate)
|
||||
|| !FindProcShort (myGlCore20, glMultiDrawArrays)
|
||||
|| !FindProcShort (myGlCore20, glMultiDrawElements)
|
||||
|| !FindProcShort (myGlCore20, glPointParameterf)
|
||||
|| !FindProcShort (myGlCore20, glPointParameterfv)
|
||||
|| !FindProcShort (myGlCore20, glPointParameteri)
|
||||
|| !FindProcShort (myGlCore20, glPointParameteriv))
|
||||
{
|
||||
myGlVerMajor = 1;
|
||||
myGlVerMinor = 3;
|
||||
core12 = myGlCore20;
|
||||
core13 = myGlCore20;
|
||||
}
|
||||
}
|
||||
|
||||
// initialize OpenGL 1.5 core functionality
|
||||
if (IsGlUpperEqual (1, 5))
|
||||
{
|
||||
if (!FindProcShort (myGlCore20, glGenQueries)
|
||||
|| !FindProcShort (myGlCore20, glDeleteQueries)
|
||||
|| !FindProcShort (myGlCore20, glIsQuery)
|
||||
|| !FindProcShort (myGlCore20, glBeginQuery)
|
||||
|| !FindProcShort (myGlCore20, glEndQuery)
|
||||
|| !FindProcShort (myGlCore20, glGetQueryiv)
|
||||
|| !FindProcShort (myGlCore20, glGetQueryObjectiv)
|
||||
|| !FindProcShort (myGlCore20, glGetQueryObjectuiv)
|
||||
|| !FindProcShort (myGlCore20, glBindBuffer)
|
||||
|| !FindProcShort (myGlCore20, glDeleteBuffers)
|
||||
|| !FindProcShort (myGlCore20, glGenBuffers)
|
||||
|| !FindProcShort (myGlCore20, glIsBuffer)
|
||||
|| !FindProcShort (myGlCore20, glBufferData)
|
||||
|| !FindProcShort (myGlCore20, glBufferSubData)
|
||||
|| !FindProcShort (myGlCore20, glGetBufferSubData)
|
||||
|| !FindProcShort (myGlCore20, glMapBuffer)
|
||||
|| !FindProcShort (myGlCore20, glUnmapBuffer)
|
||||
|| !FindProcShort (myGlCore20, glGetBufferParameteriv)
|
||||
|| !FindProcShort (myGlCore20, glGetBufferPointerv))
|
||||
{
|
||||
myGlVerMajor = 1;
|
||||
myGlVerMinor = 4;
|
||||
core12 = myGlCore20;
|
||||
core13 = myGlCore20;
|
||||
core14 = myGlCore20;
|
||||
}
|
||||
}
|
||||
|
||||
// initialize OpenGL 2.0 core functionality
|
||||
if (IsGlUpperEqual (2, 0))
|
||||
{
|
||||
if (!FindProcShort (myGlCore20, glBlendEquationSeparate)
|
||||
|| !FindProcShort (myGlCore20, glDrawBuffers)
|
||||
|| !FindProcShort (myGlCore20, glStencilOpSeparate)
|
||||
|| !FindProcShort (myGlCore20, glStencilFuncSeparate)
|
||||
|| !FindProcShort (myGlCore20, glStencilMaskSeparate)
|
||||
|| !FindProcShort (myGlCore20, glAttachShader)
|
||||
|| !FindProcShort (myGlCore20, glBindAttribLocation)
|
||||
|| !FindProcShort (myGlCore20, glCompileShader)
|
||||
|| !FindProcShort (myGlCore20, glCreateProgram)
|
||||
|| !FindProcShort (myGlCore20, glCreateShader)
|
||||
|| !FindProcShort (myGlCore20, glDeleteProgram)
|
||||
|| !FindProcShort (myGlCore20, glDeleteShader)
|
||||
|| !FindProcShort (myGlCore20, glDetachShader)
|
||||
|| !FindProcShort (myGlCore20, glDisableVertexAttribArray)
|
||||
|| !FindProcShort (myGlCore20, glEnableVertexAttribArray)
|
||||
|| !FindProcShort (myGlCore20, glGetActiveAttrib)
|
||||
|| !FindProcShort (myGlCore20, glGetActiveUniform)
|
||||
|| !FindProcShort (myGlCore20, glGetAttachedShaders)
|
||||
|| !FindProcShort (myGlCore20, glGetAttribLocation)
|
||||
|| !FindProcShort (myGlCore20, glGetProgramiv)
|
||||
|| !FindProcShort (myGlCore20, glGetProgramInfoLog)
|
||||
|| !FindProcShort (myGlCore20, glGetShaderiv)
|
||||
|| !FindProcShort (myGlCore20, glGetShaderInfoLog)
|
||||
|| !FindProcShort (myGlCore20, glGetShaderSource)
|
||||
|| !FindProcShort (myGlCore20, glGetUniformLocation)
|
||||
|| !FindProcShort (myGlCore20, glGetUniformfv)
|
||||
|| !FindProcShort (myGlCore20, glGetUniformiv)
|
||||
|| !FindProcShort (myGlCore20, glGetVertexAttribdv)
|
||||
|| !FindProcShort (myGlCore20, glGetVertexAttribfv)
|
||||
|| !FindProcShort (myGlCore20, glGetVertexAttribiv)
|
||||
|| !FindProcShort (myGlCore20, glGetVertexAttribPointerv)
|
||||
|| !FindProcShort (myGlCore20, glIsProgram)
|
||||
|| !FindProcShort (myGlCore20, glIsShader)
|
||||
|| !FindProcShort (myGlCore20, glLinkProgram)
|
||||
|| !FindProcShort (myGlCore20, glShaderSource)
|
||||
|| !FindProcShort (myGlCore20, glUseProgram)
|
||||
|| !FindProcShort (myGlCore20, glUniform1f)
|
||||
|| !FindProcShort (myGlCore20, glUniform2f)
|
||||
|| !FindProcShort (myGlCore20, glUniform3f)
|
||||
|| !FindProcShort (myGlCore20, glUniform4f)
|
||||
|| !FindProcShort (myGlCore20, glUniform1i)
|
||||
|| !FindProcShort (myGlCore20, glUniform2i)
|
||||
|| !FindProcShort (myGlCore20, glUniform3i)
|
||||
|| !FindProcShort (myGlCore20, glUniform4i)
|
||||
|| !FindProcShort (myGlCore20, glUniform1fv)
|
||||
|| !FindProcShort (myGlCore20, glUniform2fv)
|
||||
|| !FindProcShort (myGlCore20, glUniform3fv)
|
||||
|| !FindProcShort (myGlCore20, glUniform4fv)
|
||||
|| !FindProcShort (myGlCore20, glUniform1iv)
|
||||
|| !FindProcShort (myGlCore20, glUniform2iv)
|
||||
|| !FindProcShort (myGlCore20, glUniform3iv)
|
||||
|| !FindProcShort (myGlCore20, glUniform4iv)
|
||||
|| !FindProcShort (myGlCore20, glUniformMatrix2fv)
|
||||
|| !FindProcShort (myGlCore20, glUniformMatrix3fv)
|
||||
|| !FindProcShort (myGlCore20, glUniformMatrix4fv)
|
||||
|| !FindProcShort (myGlCore20, glValidateProgram)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib1d)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib1dv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib1f)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib1fv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib1s)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib1sv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib2d)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib2dv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib2f)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib2fv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib2s)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib2sv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib3d)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib3dv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib3f)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib3fv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib3s)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib3sv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib4Nbv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib4Niv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib4Nsv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib4Nub)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib4Nubv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib4Nuiv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib4Nusv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib4bv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib4d)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib4dv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib4f)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib4fv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib4iv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib4s)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib4sv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib4ubv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib4uiv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttrib4usv)
|
||||
|| !FindProcShort (myGlCore20, glVertexAttribPointer))
|
||||
{
|
||||
myGlVerMajor = 1;
|
||||
myGlVerMinor = 5;
|
||||
core12 = myGlCore20;
|
||||
core13 = myGlCore20;
|
||||
core14 = myGlCore20;
|
||||
core15 = myGlCore20;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsGlUpperEqual (2, 0))
|
||||
{
|
||||
core12 = myGlCore20;
|
||||
core13 = myGlCore20;
|
||||
core14 = myGlCore20;
|
||||
core15 = myGlCore20;
|
||||
core20 = myGlCore20;
|
||||
}
|
||||
}
|
||||
|
@ -6,55 +6,126 @@
|
||||
#ifndef _OpenGl_Context_H__
|
||||
#define _OpenGl_Context_H__
|
||||
|
||||
#include <OpenGl_ArbVBO.hxx>
|
||||
#include <OpenGl_ExtFBO.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Handle_OpenGl_Context.hxx>
|
||||
|
||||
#if (!defined(_WIN32) && !defined(__WIN32__))
|
||||
extern "C" {
|
||||
extern void (*glXGetProcAddress (const GLubyte* theProcName))();
|
||||
}
|
||||
#endif
|
||||
//! Forward declarations
|
||||
struct OpenGl_GlCore12;
|
||||
struct OpenGl_GlCore13;
|
||||
struct OpenGl_GlCore14;
|
||||
struct OpenGl_GlCore15;
|
||||
struct OpenGl_GlCore20;
|
||||
struct OpenGl_ArbVBO;
|
||||
struct OpenGl_ExtFBO;
|
||||
|
||||
//! This class provide access to the GL context and available extensions.
|
||||
//! This class generalize access to the GL context and available extensions.
|
||||
//!
|
||||
//! Functions are grouped into structures and accessed as fields.
|
||||
//! You should check the group for NULL before usage (if group is not NULL
|
||||
//! then all functions are available):
|
||||
//! @code
|
||||
//! if (myContext->core20 != NULL)
|
||||
//! {
|
||||
//! myGlProgram = myContext->core20->glCreateProgram();
|
||||
//! .. do more stuff ..
|
||||
//! }
|
||||
//! else
|
||||
//! {
|
||||
//! .. compatibility with outdated configurations ..
|
||||
//! }
|
||||
//! @endcode
|
||||
//!
|
||||
//! Current implementation provide access to OpenGL core functionality up to 2.0 version
|
||||
//! (core12, core13, core14, core15, fields core20).
|
||||
//! within several extensions (arbVBO, extFBO, etc.).
|
||||
//!
|
||||
//! Simplified extensions classification:
|
||||
//! - prefixed with NV, AMD, ATI are vendor-specific (however may be provided by other vendors in some cases);
|
||||
//! - prefixed with EXT are accepted by 2+ vendors;
|
||||
//! - prefixed with ARB are accepted by Architecture Review Board and are candidates
|
||||
//! for inclusion into GL core functionality.
|
||||
//! Some functionality can be represented in several extensions simultaneously.
|
||||
//! In this case developer should be careful because different specification may differ
|
||||
//! in aspects (like enumeration values and error-handling).
|
||||
//!
|
||||
//! Notice that some systems provide mechanisms to simultaneously incorporate with GL contexts
|
||||
//! with different capabilities. Thats why OpenGl_Context should be initialized and used
|
||||
//! for each GL context individually.
|
||||
class OpenGl_Context : public Standard_Transient
|
||||
{
|
||||
public:
|
||||
|
||||
OpenGl_Context();
|
||||
virtual ~OpenGl_Context();
|
||||
//! Empty constructor. You should call Init() to perform initialization with bound GL context.
|
||||
Standard_EXPORT OpenGl_Context();
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~OpenGl_Context();
|
||||
|
||||
//! Initialize available extensions.
|
||||
//! GL context should be active!
|
||||
void Init();
|
||||
Standard_EXPORT void Init();
|
||||
|
||||
//! Parse theExtString string for presence of theExtName extension.
|
||||
static Standard_Boolean CheckExtension (const char* theExtName,
|
||||
const char* theExtString);
|
||||
//! Check if theExtName extension is supported by active GL context.
|
||||
Standard_EXPORT static Standard_Boolean CheckExtension (const char* theExtName);
|
||||
|
||||
//! Auxiliary template to retrieve GL function pointer.
|
||||
//! Pointer to function retrieved from library is statically casted
|
||||
//! to requested type - there no way to check real signature of exported function.
|
||||
//! The context should be bound before call.
|
||||
template <typename FuncType_t>
|
||||
bool FindProc (const char* theFuncName,
|
||||
FuncType_t& theFuncPtr)
|
||||
Standard_Boolean FindProc (const char* theFuncName,
|
||||
FuncType_t& theFuncPtr)
|
||||
{
|
||||
#if (defined(_WIN32) || defined(__WIN32__))
|
||||
theFuncPtr = (FuncType_t )wglGetProcAddress (theFuncName);
|
||||
#else
|
||||
theFuncPtr = (FuncType_t )glXGetProcAddress ((const GLubyte* )theFuncName);
|
||||
#endif
|
||||
theFuncPtr = (FuncType_t )findProc (theFuncName);
|
||||
return (theFuncPtr != NULL);
|
||||
}
|
||||
|
||||
public:
|
||||
//! @return true if detected GL version is higher or equal to requested one.
|
||||
inline Standard_Boolean IsGlUpperEqual (const Standard_Integer theVerMajor,
|
||||
const Standard_Integer theVerMinor)
|
||||
{
|
||||
return (myGlVerMajor > theVerMajor)
|
||||
|| (myGlVerMajor == theVerMajor && myGlVerMinor >= theVerMinor);
|
||||
}
|
||||
|
||||
OpenGl_ArbVBO* arbVBO;
|
||||
OpenGl_ExtFBO* extFBO;
|
||||
//! Clean up errors stack for this GL context (glGetError() in loop).
|
||||
Standard_EXPORT void ResetErrors();
|
||||
|
||||
private:
|
||||
|
||||
//! Wrapper to system function to retrieve GL function pointer by name.
|
||||
Standard_EXPORT void* findProc (const char* theFuncName);
|
||||
|
||||
//! Read OpenGL version information from active context.
|
||||
Standard_EXPORT void readGlVersion();
|
||||
|
||||
//! Private initialization function that should be called only once.
|
||||
Standard_EXPORT void init();
|
||||
|
||||
public: // core profiles
|
||||
|
||||
OpenGl_GlCore12* core12;
|
||||
OpenGl_GlCore13* core13;
|
||||
OpenGl_GlCore14* core14;
|
||||
OpenGl_GlCore15* core15;
|
||||
OpenGl_GlCore20* core20;
|
||||
|
||||
public: // extensions
|
||||
|
||||
OpenGl_ArbVBO* arbVBO;
|
||||
OpenGl_ExtFBO* extFBO;
|
||||
|
||||
private:
|
||||
|
||||
void* myGlLibHandle; //!< optional handle to GL library
|
||||
OpenGl_GlCore20* myGlCore20; //!< common structure for GL core functions upto 2.0
|
||||
Standard_Integer myGlVerMajor; //!< cached GL version major number
|
||||
Standard_Integer myGlVerMinor; //!< cached GL version minor number
|
||||
Standard_Boolean myIsInitialized; //!< flag to indicate initialization state
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI(OpenGl_Window) // Type definition
|
||||
DEFINE_STANDARD_RTTI(OpenGl_Context) // Type definition
|
||||
|
||||
};
|
||||
|
||||
|
@ -3,17 +3,20 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_Display.hxx>
|
||||
|
||||
#include <OSD_Environment.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Aspect_GraphicDeviceDefinitionError.hxx>
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <GL/gl.h>
|
||||
|
||||
#include <OpenGl_Light.hxx>
|
||||
|
||||
#if (!defined(_WIN32) && !defined(__WIN32__))
|
||||
#include <X11/Xlib.h> // XOpenDisplay()
|
||||
#endif
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE(OpenGl_Display,MMgt_TShared)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Display,MMgt_TShared)
|
||||
|
||||
|
@ -3,20 +3,14 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_Display.hxx>
|
||||
|
||||
#ifdef HAVE_GL2PS
|
||||
#include <gl2ps.h>
|
||||
#include <gl2ps.h>
|
||||
#endif
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <GL/gl.h>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Constantes
|
||||
*/
|
||||
|
||||
#define DOT_LS 0xCCCC
|
||||
#define DASH_DOT_LS 0xFF18
|
||||
#define DASH_LS 0xFFC0
|
||||
|
@ -6,62 +6,22 @@
|
||||
#ifndef _OpenGl_ExtFBO_H__
|
||||
#define _OpenGl_ExtFBO_H__
|
||||
|
||||
#if (defined(_WIN32) || defined(__WIN32__))
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <GL/gl.h>
|
||||
#include <OpenGl_GlCore12.hxx>
|
||||
|
||||
//! FBO is part of OpenGL since 2.0
|
||||
//! FBO is available on OpenGL 2.0+ hardware
|
||||
struct OpenGl_ExtFBO
|
||||
{
|
||||
#ifndef GL_FRAMEBUFFER_EXT
|
||||
#define GL_FRAMEBUFFER_EXT 0x8D40
|
||||
#endif
|
||||
#ifndef GL_COLOR_ATTACHMENT0_EXT
|
||||
#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
|
||||
#endif
|
||||
#ifndef GL_FRAMEBUFFER_COMPLETE_EXT
|
||||
#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
|
||||
#endif
|
||||
#ifndef GL_RENDERBUFFER_EXT
|
||||
#define GL_RENDERBUFFER_EXT 0x8D41
|
||||
#endif
|
||||
#ifndef GL_DEPTH_ATTACHMENT_EXT
|
||||
#define GL_DEPTH_ATTACHMENT_EXT 0x8D00
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
typedef void (APIENTRY *glGenFramebuffersEXT_t) (GLsizei n, GLuint* ids);
|
||||
typedef void (APIENTRY *glDeleteFramebuffersEXT_t) (GLsizei n, GLuint* ids);
|
||||
typedef void (APIENTRY *glBindFramebufferEXT_t) (GLenum target, GLuint id);
|
||||
typedef void (APIENTRY *glFramebufferTexture2DEXT_t) (GLenum target, GLenum attachmentPoint,
|
||||
GLenum textureTarget, GLuint textureId,
|
||||
GLint level);
|
||||
typedef GLenum (APIENTRY *glCheckFramebufferStatusEXT_t) (GLenum target);
|
||||
typedef void (APIENTRY *glGenRenderbuffersEXT_t) (GLsizei n, GLuint* ids);
|
||||
typedef void (APIENTRY *glDeleteRenderbuffersEXT_t) (GLsizei n, GLuint* ids);
|
||||
typedef void (APIENTRY *glBindRenderbufferEXT_t) (GLenum target, GLuint id);
|
||||
typedef void (APIENTRY *glRenderbufferStorageEXT_t) (GLenum target, GLenum internalFormat,
|
||||
GLsizei width, GLsizei height);
|
||||
|
||||
typedef void (APIENTRY *glFramebufferRenderbufferEXT_t) (GLenum target,
|
||||
GLenum attachmentPoint,
|
||||
GLenum renderbufferTarget,
|
||||
GLuint renderbufferId);
|
||||
|
||||
public:
|
||||
|
||||
glGenFramebuffersEXT_t glGenFramebuffersEXT;
|
||||
glDeleteFramebuffersEXT_t glDeleteFramebuffersEXT;
|
||||
glBindFramebufferEXT_t glBindFramebufferEXT;
|
||||
glFramebufferTexture2DEXT_t glFramebufferTexture2DEXT;
|
||||
glCheckFramebufferStatusEXT_t glCheckFramebufferStatusEXT;
|
||||
glGenRenderbuffersEXT_t glGenRenderbuffersEXT;
|
||||
glDeleteRenderbuffersEXT_t glDeleteRenderbuffersEXT;
|
||||
glBindRenderbufferEXT_t glBindRenderbufferEXT;
|
||||
glRenderbufferStorageEXT_t glRenderbufferStorageEXT;
|
||||
glFramebufferRenderbufferEXT_t glFramebufferRenderbufferEXT;
|
||||
PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT;
|
||||
PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT;
|
||||
PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT;
|
||||
PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT;
|
||||
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
|
||||
PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT;
|
||||
PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT;
|
||||
PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT;
|
||||
PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT;
|
||||
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT;
|
||||
|
||||
};
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#define OPENGL_FRAME_BUFFER_H
|
||||
|
||||
#include <OpenGl_Context.hxx>
|
||||
#include <OpenGl_ExtFBO.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <InterfaceGraphic.hxx>
|
||||
|
40
src/OpenGl/OpenGl_GlCore11.hxx
Normal file
40
src/OpenGl/OpenGl_GlCore11.hxx
Normal file
@ -0,0 +1,40 @@
|
||||
// File: OpenGl_GlCore11.hxx
|
||||
// Created: 06 March 2012
|
||||
// Author: Kirill GAVRILOV
|
||||
// Copyright: OPEN CASCADE 2012
|
||||
|
||||
#ifndef _OpenGl_GlCore11_H__
|
||||
#define _OpenGl_GlCore11_H__
|
||||
|
||||
// required for correct APIENTRY definition
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
#ifndef APIENTRYP
|
||||
#define APIENTRYP APIENTRY *
|
||||
#endif
|
||||
#ifndef GLAPI
|
||||
#define GLAPI extern
|
||||
#endif
|
||||
|
||||
// current TKOpenGl implementation is incompatible with native OpenGL on MacOS X
|
||||
#define MACOSX_USE_GLX
|
||||
|
||||
// include main OpenGL header provided with system
|
||||
#if defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
||||
#define GL_GLEXT_LEGACY // exclude modern definitions
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
#include <InterfaceGraphic.hxx>
|
||||
#include <InterfaceGraphic_tgl_all.hxx>
|
||||
#include <InterfaceGraphic_telem.hxx>
|
||||
|
||||
#endif // _OpenGl_GlCore11_H__
|
34
src/OpenGl/OpenGl_GlCore12.hxx
Normal file
34
src/OpenGl/OpenGl_GlCore12.hxx
Normal file
@ -0,0 +1,34 @@
|
||||
// File: OpenGl_GlCore12.hxx
|
||||
// Created: 06 March 2012
|
||||
// Author: Kirill GAVRILOV
|
||||
// Copyright: OPEN CASCADE 2012
|
||||
|
||||
#ifndef _OpenGl_GlCore12_H__
|
||||
#define _OpenGl_GlCore12_H__
|
||||
|
||||
#include <OpenGl_GlCore11.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
|
||||
|
||||
// include glext.h provided by Khronos group
|
||||
#include <glext.h>
|
||||
|
||||
//! Function list for GL1.2 core functionality.
|
||||
struct OpenGl_GlCore12
|
||||
{
|
||||
|
||||
PFNGLBLENDCOLORPROC glBlendColor;
|
||||
PFNGLBLENDEQUATIONPROC glBlendEquation;
|
||||
PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements;
|
||||
PFNGLTEXIMAGE3DPROC glTexImage3D;
|
||||
PFNGLTEXSUBIMAGE3DPROC glTexSubImage3D;
|
||||
PFNGLCOPYTEXSUBIMAGE3DPROC glCopyTexSubImage3D;
|
||||
|
||||
};
|
||||
|
||||
#endif // _OpenGl_GlCore12_H__
|
67
src/OpenGl/OpenGl_GlCore13.hxx
Normal file
67
src/OpenGl/OpenGl_GlCore13.hxx
Normal file
@ -0,0 +1,67 @@
|
||||
// File: OpenGl_GlCore13.hxx
|
||||
// Created: 06 March 2012
|
||||
// Author: Kirill GAVRILOV
|
||||
// Copyright: OPEN CASCADE 2012
|
||||
|
||||
#ifndef _OpenGl_GlCore13_H__
|
||||
#define _OpenGl_GlCore13_H__
|
||||
|
||||
#include <OpenGl_GlCore12.hxx>
|
||||
|
||||
//! Function list for GL1.3 core functionality.
|
||||
struct OpenGl_GlCore13 : public OpenGl_GlCore12
|
||||
{
|
||||
|
||||
PFNGLACTIVETEXTUREPROC glActiveTexture;
|
||||
PFNGLSAMPLECOVERAGEPROC glSampleCoverage;
|
||||
PFNGLCOMPRESSEDTEXIMAGE3DPROC glCompressedTexImage3D;
|
||||
PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D;
|
||||
PFNGLCOMPRESSEDTEXIMAGE1DPROC glCompressedTexImage1D;
|
||||
PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glCompressedTexSubImage3D;
|
||||
PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glCompressedTexSubImage2D;
|
||||
PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glCompressedTexSubImage1D;
|
||||
PFNGLGETCOMPRESSEDTEXIMAGEPROC glGetCompressedTexImage;
|
||||
|
||||
// deprecated functions
|
||||
|
||||
PFNGLCLIENTACTIVETEXTUREPROC glClientActiveTexture;
|
||||
PFNGLMULTITEXCOORD1DPROC glMultiTexCoord1d;
|
||||
PFNGLMULTITEXCOORD1DVPROC glMultiTexCoord1dv;
|
||||
PFNGLMULTITEXCOORD1FPROC glMultiTexCoord1f;
|
||||
PFNGLMULTITEXCOORD1FVPROC glMultiTexCoord1fv;
|
||||
PFNGLMULTITEXCOORD1IPROC glMultiTexCoord1i;
|
||||
PFNGLMULTITEXCOORD1IVPROC glMultiTexCoord1iv;
|
||||
PFNGLMULTITEXCOORD1SPROC glMultiTexCoord1s;
|
||||
PFNGLMULTITEXCOORD1SVPROC glMultiTexCoord1sv;
|
||||
PFNGLMULTITEXCOORD2DPROC glMultiTexCoord2d;
|
||||
PFNGLMULTITEXCOORD2DVPROC glMultiTexCoord2dv;
|
||||
PFNGLMULTITEXCOORD2FPROC glMultiTexCoord2f;
|
||||
PFNGLMULTITEXCOORD2FVPROC glMultiTexCoord2fv;
|
||||
PFNGLMULTITEXCOORD2IPROC glMultiTexCoord2i;
|
||||
PFNGLMULTITEXCOORD2IVPROC glMultiTexCoord2iv;
|
||||
PFNGLMULTITEXCOORD2SPROC glMultiTexCoord2s;
|
||||
PFNGLMULTITEXCOORD2SVPROC glMultiTexCoord2sv;
|
||||
PFNGLMULTITEXCOORD3DPROC glMultiTexCoord3d;
|
||||
PFNGLMULTITEXCOORD3DVPROC glMultiTexCoord3dv;
|
||||
PFNGLMULTITEXCOORD3FPROC glMultiTexCoord3f;
|
||||
PFNGLMULTITEXCOORD3FVPROC glMultiTexCoord3fv;
|
||||
PFNGLMULTITEXCOORD3IPROC glMultiTexCoord3i;
|
||||
PFNGLMULTITEXCOORD3IVPROC glMultiTexCoord3iv;
|
||||
PFNGLMULTITEXCOORD3SPROC glMultiTexCoord3s;
|
||||
PFNGLMULTITEXCOORD3SVPROC glMultiTexCoord3sv;
|
||||
PFNGLMULTITEXCOORD4DPROC glMultiTexCoord4d;
|
||||
PFNGLMULTITEXCOORD4DVPROC glMultiTexCoord4dv;
|
||||
PFNGLMULTITEXCOORD4FPROC glMultiTexCoord4f;
|
||||
PFNGLMULTITEXCOORD4FVPROC glMultiTexCoord4fv;
|
||||
PFNGLMULTITEXCOORD4IPROC glMultiTexCoord4i;
|
||||
PFNGLMULTITEXCOORD4IVPROC glMultiTexCoord4iv;
|
||||
PFNGLMULTITEXCOORD4SPROC glMultiTexCoord4s;
|
||||
PFNGLMULTITEXCOORD4SVPROC glMultiTexCoord4sv;
|
||||
PFNGLLOADTRANSPOSEMATRIXFPROC glLoadTransposeMatrixf;
|
||||
PFNGLLOADTRANSPOSEMATRIXDPROC glLoadTransposeMatrixd;
|
||||
PFNGLMULTTRANSPOSEMATRIXFPROC glMultTransposeMatrixf;
|
||||
PFNGLMULTTRANSPOSEMATRIXDPROC glMultTransposeMatrixd;
|
||||
|
||||
};
|
||||
|
||||
#endif // _OpenGl_GlCore13_H__
|
25
src/OpenGl/OpenGl_GlCore14.hxx
Normal file
25
src/OpenGl/OpenGl_GlCore14.hxx
Normal file
@ -0,0 +1,25 @@
|
||||
// File: OpenGl_GlCore14.hxx
|
||||
// Created: 06 March 2012
|
||||
// Author: Kirill GAVRILOV
|
||||
// Copyright: OPEN CASCADE 2012
|
||||
|
||||
#ifndef _OpenGl_GlCore14_H__
|
||||
#define _OpenGl_GlCore14_H__
|
||||
|
||||
#include <OpenGl_GlCore13.hxx>
|
||||
|
||||
//! Function list for GL1.4 core functionality.
|
||||
struct OpenGl_GlCore14 : public OpenGl_GlCore13
|
||||
{
|
||||
|
||||
PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate;
|
||||
PFNGLMULTIDRAWARRAYSPROC glMultiDrawArrays;
|
||||
PFNGLMULTIDRAWELEMENTSPROC glMultiDrawElements;
|
||||
PFNGLPOINTPARAMETERFPROC glPointParameterf;
|
||||
PFNGLPOINTPARAMETERFVPROC glPointParameterfv;
|
||||
PFNGLPOINTPARAMETERIPROC glPointParameteri;
|
||||
PFNGLPOINTPARAMETERIVPROC glPointParameteriv;
|
||||
|
||||
};
|
||||
|
||||
#endif // _OpenGl_GlCore14_H__
|
37
src/OpenGl/OpenGl_GlCore15.hxx
Normal file
37
src/OpenGl/OpenGl_GlCore15.hxx
Normal file
@ -0,0 +1,37 @@
|
||||
// File: OpenGl_GlCore15.hxx
|
||||
// Created: 06 March 2012
|
||||
// Author: Kirill GAVRILOV
|
||||
// Copyright: OPEN CASCADE 2012
|
||||
|
||||
#ifndef _OpenGl_GlCore15_H__
|
||||
#define _OpenGl_GlCore15_H__
|
||||
|
||||
#include <OpenGl_GlCore14.hxx>
|
||||
|
||||
//! Function list for GL1.5 core functionality.
|
||||
struct OpenGl_GlCore15 : public OpenGl_GlCore14
|
||||
{
|
||||
|
||||
PFNGLGENQUERIESPROC glGenQueries;
|
||||
PFNGLDELETEQUERIESPROC glDeleteQueries;
|
||||
PFNGLISQUERYPROC glIsQuery;
|
||||
PFNGLBEGINQUERYPROC glBeginQuery;
|
||||
PFNGLENDQUERYPROC glEndQuery;
|
||||
PFNGLGETQUERYIVPROC glGetQueryiv;
|
||||
PFNGLGETQUERYOBJECTIVPROC glGetQueryObjectiv;
|
||||
PFNGLGETQUERYOBJECTUIVPROC glGetQueryObjectuiv;
|
||||
PFNGLBINDBUFFERPROC glBindBuffer;
|
||||
PFNGLDELETEBUFFERSPROC glDeleteBuffers;
|
||||
PFNGLGENBUFFERSPROC glGenBuffers;
|
||||
PFNGLISBUFFERPROC glIsBuffer;
|
||||
PFNGLBUFFERDATAPROC glBufferData;
|
||||
PFNGLBUFFERSUBDATAPROC glBufferSubData;
|
||||
PFNGLGETBUFFERSUBDATAPROC glGetBufferSubData;
|
||||
PFNGLMAPBUFFERPROC glMapBuffer;
|
||||
PFNGLUNMAPBUFFERPROC glUnmapBuffer;
|
||||
PFNGLGETBUFFERPARAMETERIVPROC glGetBufferParameteriv;
|
||||
PFNGLGETBUFFERPOINTERVPROC glGetBufferPointerv;
|
||||
|
||||
};
|
||||
|
||||
#endif // _OpenGl_GlCore15_H__
|
111
src/OpenGl/OpenGl_GlCore20.hxx
Normal file
111
src/OpenGl/OpenGl_GlCore20.hxx
Normal file
@ -0,0 +1,111 @@
|
||||
// File: OpenGl_GlCore20.hxx
|
||||
// Created: 06 March 2012
|
||||
// Author: Kirill GAVRILOV
|
||||
// Copyright: OPEN CASCADE 2012
|
||||
|
||||
#ifndef _OpenGl_GlCore20_H__
|
||||
#define _OpenGl_GlCore20_H__
|
||||
|
||||
#include <OpenGl_GlCore15.hxx>
|
||||
|
||||
//! Function list for GL2.0 core functionality.
|
||||
struct OpenGl_GlCore20 : public OpenGl_GlCore15
|
||||
{
|
||||
|
||||
PFNGLBLENDEQUATIONSEPARATEPROC glBlendEquationSeparate;
|
||||
PFNGLDRAWBUFFERSPROC glDrawBuffers;
|
||||
PFNGLSTENCILOPSEPARATEPROC glStencilOpSeparate;
|
||||
PFNGLSTENCILFUNCSEPARATEPROC glStencilFuncSeparate;
|
||||
PFNGLSTENCILMASKSEPARATEPROC glStencilMaskSeparate;
|
||||
PFNGLATTACHSHADERPROC glAttachShader;
|
||||
PFNGLBINDATTRIBLOCATIONPROC glBindAttribLocation;
|
||||
PFNGLCOMPILESHADERPROC glCompileShader;
|
||||
PFNGLCREATEPROGRAMPROC glCreateProgram;
|
||||
PFNGLCREATESHADERPROC glCreateShader;
|
||||
PFNGLDELETEPROGRAMPROC glDeleteProgram;
|
||||
PFNGLDELETESHADERPROC glDeleteShader;
|
||||
PFNGLDETACHSHADERPROC glDetachShader;
|
||||
PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray;
|
||||
PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
|
||||
PFNGLGETACTIVEATTRIBPROC glGetActiveAttrib;
|
||||
PFNGLGETACTIVEUNIFORMPROC glGetActiveUniform;
|
||||
PFNGLGETATTACHEDSHADERSPROC glGetAttachedShaders;
|
||||
PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation;
|
||||
PFNGLGETPROGRAMIVPROC glGetProgramiv;
|
||||
PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;
|
||||
PFNGLGETSHADERIVPROC glGetShaderiv;
|
||||
PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog;
|
||||
PFNGLGETSHADERSOURCEPROC glGetShaderSource;
|
||||
PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation;
|
||||
PFNGLGETUNIFORMFVPROC glGetUniformfv;
|
||||
PFNGLGETUNIFORMIVPROC glGetUniformiv;
|
||||
PFNGLGETVERTEXATTRIBDVPROC glGetVertexAttribdv;
|
||||
PFNGLGETVERTEXATTRIBFVPROC glGetVertexAttribfv;
|
||||
PFNGLGETVERTEXATTRIBIVPROC glGetVertexAttribiv;
|
||||
PFNGLGETVERTEXATTRIBPOINTERVPROC glGetVertexAttribPointerv;
|
||||
PFNGLISPROGRAMPROC glIsProgram;
|
||||
PFNGLISSHADERPROC glIsShader;
|
||||
PFNGLLINKPROGRAMPROC glLinkProgram;
|
||||
PFNGLSHADERSOURCEPROC glShaderSource;
|
||||
PFNGLUSEPROGRAMPROC glUseProgram;
|
||||
PFNGLUNIFORM1FPROC glUniform1f;
|
||||
PFNGLUNIFORM2FPROC glUniform2f;
|
||||
PFNGLUNIFORM3FPROC glUniform3f;
|
||||
PFNGLUNIFORM4FPROC glUniform4f;
|
||||
PFNGLUNIFORM1IPROC glUniform1i;
|
||||
PFNGLUNIFORM2IPROC glUniform2i;
|
||||
PFNGLUNIFORM3IPROC glUniform3i;
|
||||
PFNGLUNIFORM4IPROC glUniform4i;
|
||||
PFNGLUNIFORM1FVPROC glUniform1fv;
|
||||
PFNGLUNIFORM2FVPROC glUniform2fv;
|
||||
PFNGLUNIFORM3FVPROC glUniform3fv;
|
||||
PFNGLUNIFORM4FVPROC glUniform4fv;
|
||||
PFNGLUNIFORM1IVPROC glUniform1iv;
|
||||
PFNGLUNIFORM2IVPROC glUniform2iv;
|
||||
PFNGLUNIFORM3IVPROC glUniform3iv;
|
||||
PFNGLUNIFORM4IVPROC glUniform4iv;
|
||||
PFNGLUNIFORMMATRIX2FVPROC glUniformMatrix2fv;
|
||||
PFNGLUNIFORMMATRIX3FVPROC glUniformMatrix3fv;
|
||||
PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv;
|
||||
PFNGLVALIDATEPROGRAMPROC glValidateProgram;
|
||||
PFNGLVERTEXATTRIB1DPROC glVertexAttrib1d;
|
||||
PFNGLVERTEXATTRIB1DVPROC glVertexAttrib1dv;
|
||||
PFNGLVERTEXATTRIB1FPROC glVertexAttrib1f;
|
||||
PFNGLVERTEXATTRIB1FVPROC glVertexAttrib1fv;
|
||||
PFNGLVERTEXATTRIB1SPROC glVertexAttrib1s;
|
||||
PFNGLVERTEXATTRIB1SVPROC glVertexAttrib1sv;
|
||||
PFNGLVERTEXATTRIB2DPROC glVertexAttrib2d;
|
||||
PFNGLVERTEXATTRIB2DVPROC glVertexAttrib2dv;
|
||||
PFNGLVERTEXATTRIB2FPROC glVertexAttrib2f;
|
||||
PFNGLVERTEXATTRIB2FVPROC glVertexAttrib2fv;
|
||||
PFNGLVERTEXATTRIB2SPROC glVertexAttrib2s;
|
||||
PFNGLVERTEXATTRIB2SVPROC glVertexAttrib2sv;
|
||||
PFNGLVERTEXATTRIB3DPROC glVertexAttrib3d;
|
||||
PFNGLVERTEXATTRIB3DVPROC glVertexAttrib3dv;
|
||||
PFNGLVERTEXATTRIB3FPROC glVertexAttrib3f;
|
||||
PFNGLVERTEXATTRIB3FVPROC glVertexAttrib3fv;
|
||||
PFNGLVERTEXATTRIB3SPROC glVertexAttrib3s;
|
||||
PFNGLVERTEXATTRIB3SVPROC glVertexAttrib3sv;
|
||||
PFNGLVERTEXATTRIB4NBVPROC glVertexAttrib4Nbv;
|
||||
PFNGLVERTEXATTRIB4NIVPROC glVertexAttrib4Niv;
|
||||
PFNGLVERTEXATTRIB4NSVPROC glVertexAttrib4Nsv;
|
||||
PFNGLVERTEXATTRIB4NUBPROC glVertexAttrib4Nub;
|
||||
PFNGLVERTEXATTRIB4NUBVPROC glVertexAttrib4Nubv;
|
||||
PFNGLVERTEXATTRIB4NUIVPROC glVertexAttrib4Nuiv;
|
||||
PFNGLVERTEXATTRIB4NUSVPROC glVertexAttrib4Nusv;
|
||||
PFNGLVERTEXATTRIB4BVPROC glVertexAttrib4bv;
|
||||
PFNGLVERTEXATTRIB4DPROC glVertexAttrib4d;
|
||||
PFNGLVERTEXATTRIB4DVPROC glVertexAttrib4dv;
|
||||
PFNGLVERTEXATTRIB4FPROC glVertexAttrib4f;
|
||||
PFNGLVERTEXATTRIB4FVPROC glVertexAttrib4fv;
|
||||
PFNGLVERTEXATTRIB4IVPROC glVertexAttrib4iv;
|
||||
PFNGLVERTEXATTRIB4SPROC glVertexAttrib4s;
|
||||
PFNGLVERTEXATTRIB4SVPROC glVertexAttrib4sv;
|
||||
PFNGLVERTEXATTRIB4UBVPROC glVertexAttrib4ubv;
|
||||
PFNGLVERTEXATTRIB4UIVPROC glVertexAttrib4uiv;
|
||||
PFNGLVERTEXATTRIB4USVPROC glVertexAttrib4usv;
|
||||
PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
|
||||
|
||||
};
|
||||
|
||||
#endif // _OpenGl_GlCore20_H__
|
@ -3,20 +3,19 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
#include <InterfaceGraphic_Graphic3d.hxx>
|
||||
#include <InterfaceGraphic_Aspect.hxx>
|
||||
#include <InterfaceGraphic_Visual3d.hxx>
|
||||
|
||||
#include <GL/glu.h> // gluUnProject()
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
@ -3,14 +3,13 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
|
||||
#include <OpenGl_Display.hxx>
|
||||
#include <OpenGl_CView.hxx>
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <OpenGl_tgl_funcs.hxx>
|
||||
|
||||
Standard_Integer OpenGl_GraphicDriver::InquireLightLimit ()
|
||||
{
|
||||
return (openglDisplay.IsNull()? 0 : openglDisplay->Facilities().MaxLights);
|
||||
@ -35,6 +34,14 @@ Standard_Boolean OpenGl_GraphicDriver::InquireTextureAvailable ()
|
||||
|
||||
Standard_Integer OpenGl_GraphicDriver::InquirePlaneLimit ()
|
||||
{
|
||||
return call_togl_inquireplane();
|
||||
GLint aMaxPlanes = 0;
|
||||
if (GET_GL_CONTEXT())
|
||||
{
|
||||
glGetIntegerv (GL_MAX_CLIP_PLANES, &aMaxPlanes);
|
||||
aMaxPlanes -= 2; // NOTE the 2 first planes are reserved for ZClipping
|
||||
if (aMaxPlanes < 0)
|
||||
aMaxPlanes = 0;
|
||||
}
|
||||
return aMaxPlanes;
|
||||
}
|
||||
|
||||
|
@ -195,19 +195,18 @@ Standard_Integer OpenGl_GraphicDriver::CreateTexture (const Graphic3d_TypeOfText
|
||||
*MyData++ = 0xFF;
|
||||
}
|
||||
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
case Graphic3d_TOT_1D:
|
||||
TexId = call_togl_create_texture(0, aGlWidth, aGlHeight, MyImageData, (Standard_PCharacter)fileName);
|
||||
TexId = GetTextureData1D (fileName, aGlWidth, aGlHeight, MyImageData);
|
||||
break;
|
||||
|
||||
case Graphic3d_TOT_2D:
|
||||
TexId = call_togl_create_texture(1, aGlWidth, aGlHeight, MyImageData, (Standard_PCharacter)fileName);
|
||||
TexId = GetTextureData2D (fileName, aGlWidth, aGlHeight, MyImageData);
|
||||
break;
|
||||
|
||||
case Graphic3d_TOT_2D_MIPMAP:
|
||||
TexId = call_togl_create_texture(2, aGlWidth, aGlHeight, MyImageData, (Standard_PCharacter)fileName);
|
||||
TexId = GetTextureData2DMipMap (fileName, aGlWidth, aGlHeight, MyImageData);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -219,13 +218,50 @@ Standard_Integer OpenGl_GraphicDriver::CreateTexture (const Graphic3d_TypeOfText
|
||||
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::DestroyTexture(const Standard_Integer TexId) const
|
||||
void OpenGl_GraphicDriver::DestroyTexture (const Standard_Integer theTexId) const
|
||||
{
|
||||
call_togl_destroy_texture(TexId);
|
||||
FreeTexture (theTexId);
|
||||
}
|
||||
|
||||
|
||||
void OpenGl_GraphicDriver::ModifyTexture(const Standard_Integer TexId,const Graphic3d_CInitTexture& AValue) const
|
||||
void OpenGl_GraphicDriver::ModifyTexture (const Standard_Integer theTexId,
|
||||
const Graphic3d_CInitTexture& theInfo) const
|
||||
{
|
||||
call_togl_modify_texture(TexId, (CALL_DEF_INIT_TEXTURE *)&AValue);
|
||||
if (theInfo.doModulate)
|
||||
SetTextureModulate (theTexId);
|
||||
else
|
||||
SetTextureDecal (theTexId);
|
||||
|
||||
if (theInfo.doRepeat)
|
||||
SetTextureRepeat (theTexId);
|
||||
else
|
||||
SetTextureClamp (theTexId);
|
||||
|
||||
switch (theInfo.Mode)
|
||||
{
|
||||
case 0:
|
||||
SetModeObject (theTexId, theInfo.sparams, theInfo.tparams);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
SetModeSphere (theTexId);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
SetModeEye (theTexId, theInfo.sparams, theInfo.tparams);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
SetModeManual (theTexId);
|
||||
break;
|
||||
}
|
||||
|
||||
if (theInfo.doLinear)
|
||||
SetRenderLinear (theTexId);
|
||||
else
|
||||
SetRenderNearest (theTexId);
|
||||
|
||||
SetTexturePosition (theTexId,
|
||||
theInfo.sx, theInfo.sy,
|
||||
theInfo.tx, theInfo.ty,
|
||||
theInfo.angle);
|
||||
}
|
||||
|
@ -3,12 +3,12 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
|
||||
#include <OSD_FontAspect.hxx>
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
|
||||
#include <OpenGl_Display.hxx>
|
||||
#include <OpenGl_AspectText.hxx>
|
||||
#include <OpenGl_TextParam.hxx>
|
||||
|
@ -3,8 +3,9 @@
|
||||
// Author: Anton POLETAEV
|
||||
// Copyright: OPEN CASCADE 2012
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_LayerList.hxx>
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
|
||||
#include <InterfaceGraphic_Graphic3d.hxx>
|
||||
|
@ -3,10 +3,9 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_Marker.hxx>
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <GL/gl.h>
|
||||
#include <OpenGl_Marker.hxx>
|
||||
|
||||
#include <OpenGl_AspectMarker.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
|
@ -3,10 +3,9 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_MarkerSet.hxx>
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <GL/gl.h>
|
||||
#include <OpenGl_MarkerSet.hxx>
|
||||
|
||||
#include <OpenGl_AspectMarker.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef OPENGL_MEMORY_H
|
||||
#define OPENGL_MEMORY_H
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <Standard.hxx>
|
||||
|
||||
template <class XType> XType *cmn_resizemem( XType *ptr, Tint size )
|
||||
{
|
||||
|
@ -11,8 +11,7 @@
|
||||
* Includes
|
||||
*/
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <GL/gl.h>
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_Mesh.hxx>
|
||||
|
||||
|
@ -3,11 +3,10 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_Context.hxx>
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_Polygon.hxx>
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <OpenGl_telem_util.hxx>
|
||||
#include <OpenGl_TextureBox.hxx>
|
||||
#include <OpenGl_Memory.hxx>
|
||||
|
@ -3,10 +3,9 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_Polyline.hxx>
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <GL/gl.h>
|
||||
#include <OpenGl_Polyline.hxx>
|
||||
|
||||
#include <OpenGl_AspectLine.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
|
@ -3,7 +3,9 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <OpenGl_ArbVBO.hxx>
|
||||
#include <OpenGl_Context.hxx>
|
||||
|
||||
#include <OpenGl_PrimitiveArray.hxx>
|
||||
|
||||
#include <OpenGl_AspectFace.hxx>
|
||||
@ -93,8 +95,8 @@ void OpenGl_PrimitiveArray::clearMemoryGL (const Handle(OpenGl_Context)& theGlCo
|
||||
{
|
||||
theGlContext->arbVBO->glDeleteBuffersARB (1, &myPArray->bufferVBO[VBOVtexels]);
|
||||
}
|
||||
theGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, 0);
|
||||
theGlContext->arbVBO->glBindBufferARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, 0);
|
||||
theGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, 0);
|
||||
theGlContext->arbVBO->glBindBufferARB (GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@ -127,8 +129,8 @@ Standard_Boolean OpenGl_PrimitiveArray::BuildVBO (const Handle(OpenGl_Workspace)
|
||||
{
|
||||
size_reqd = myPArray->num_edges * sizeof(Tint);
|
||||
aGlContext->arbVBO->glGenBuffersARB (1, &myPArray->bufferVBO[VBOEdges]);
|
||||
aGlContext->arbVBO->glBindBufferARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOEdges]);
|
||||
aGlContext->arbVBO->glBufferDataARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, size_reqd, myPArray->edges, GL_STATIC_DRAW_ARB);
|
||||
aGlContext->arbVBO->glBindBufferARB (GL_ELEMENT_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOEdges]);
|
||||
aGlContext->arbVBO->glBufferDataARB (GL_ELEMENT_ARRAY_BUFFER_ARB, size_reqd, myPArray->edges, GL_STATIC_DRAW_ARB);
|
||||
if (!checkSizeForGraphicMemory (aGlContext))
|
||||
return Standard_False;
|
||||
}
|
||||
@ -403,7 +405,7 @@ void OpenGl_PrimitiveArray::DrawArray (Tint theLightingModel,
|
||||
{
|
||||
if (myPArray->num_edges > 0 && myPArray->bufferVBO[VBOEdges] != 0)
|
||||
{
|
||||
aGlContext->arbVBO->glBindBufferARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOEdges]); // for edge indices
|
||||
aGlContext->arbVBO->glBindBufferARB (GL_ELEMENT_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOEdges]); // for edge indices
|
||||
if (myPArray->num_bounds > 0)
|
||||
{
|
||||
// draw primitives by vertex count with the indicies
|
||||
@ -435,7 +437,7 @@ void OpenGl_PrimitiveArray::DrawArray (Tint theLightingModel,
|
||||
|
||||
// bind with 0
|
||||
aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, 0);
|
||||
aGlContext->arbVBO->glBindBufferARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, 0);
|
||||
aGlContext->arbVBO->glBindBufferARB (GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -571,7 +573,7 @@ void OpenGl_PrimitiveArray::DrawEdges (const TEL_COLOUR* theEdgeCo
|
||||
glColor3fv (theEdgeColour->rgb);
|
||||
if (myPArray->num_edges > 0 && myPArray->bufferVBO[VBOEdges])
|
||||
{
|
||||
aGlContext->arbVBO->glBindBufferARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOEdges]);
|
||||
aGlContext->arbVBO->glBindBufferARB (GL_ELEMENT_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOEdges]);
|
||||
|
||||
// draw primitives by vertex count with the indicies
|
||||
if (myPArray->num_bounds > 0)
|
||||
@ -605,7 +607,7 @@ void OpenGl_PrimitiveArray::DrawEdges (const TEL_COLOUR* theEdgeCo
|
||||
// unbind buffers
|
||||
glDisableClientState (GL_VERTEX_ARRAY);
|
||||
aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, 0);
|
||||
aGlContext->arbVBO->glBindBufferARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, 0);
|
||||
aGlContext->arbVBO->glBindBufferARB (GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifndef OpenGl_PrimitiveArray_Header
|
||||
#define OpenGl_PrimitiveArray_Header
|
||||
|
||||
#include <OpenGl_Context.hxx>
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <InterfaceGraphic_telem.hxx>
|
||||
#include <Aspect_InteriorStyle.hxx>
|
||||
@ -14,6 +14,7 @@
|
||||
#include <OpenGl_Element.hxx>
|
||||
|
||||
struct OPENGL_SURF_PROP;
|
||||
class Handle(OpenGl_Context);
|
||||
|
||||
class OpenGl_PrimitiveArray : public OpenGl_Element
|
||||
{
|
||||
|
@ -5,11 +5,12 @@
|
||||
#ifndef _OPENGL_PRINTERCONTEXT_H
|
||||
#define _OPENGL_PRINTERCONTEXT_H
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <MMgt_TShared.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
#include <Handle_MMgt_TShared.hxx>
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <InterfaceGraphic_Graphic3d.hxx>
|
||||
#include <InterfaceGraphic_Visual3d.hxx>
|
||||
|
@ -3,8 +3,7 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <GL/gl.h>
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_QuadrangleStrip.hxx>
|
||||
|
||||
|
@ -5,10 +5,10 @@
|
||||
#ifndef _OPENGL_RESOURCE_H
|
||||
#define _OPENGL_RESOURCE_H
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_ResourceCleaner.hxx>
|
||||
#include <MMgt_TShared.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
#include <Handle_MMgt_TShared.hxx>
|
||||
|
||||
class Standard_Transient;
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifndef _OPENGL_RESOURCECLEANER_H
|
||||
#define _OPENGL_RESOURCECLEANER_H
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
#include <NCollection_Queue.hxx>
|
||||
#include <NCollection_List.hxx>
|
||||
#include <NCollection_Map.hxx>
|
||||
|
@ -2,8 +2,8 @@
|
||||
// Created: 18.03.11 9:40:00
|
||||
// Author: Anton POLETAEV
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
#include <OpenGl_ResourceTexture.hxx>
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : OpenGl_ResourceTexture
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include <OpenGl_ResourceVBO.hxx>
|
||||
#include <OpenGl_Context.hxx>
|
||||
#include <OpenGl_ArbVBO.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : OpenGl_ResourceVBO
|
||||
|
@ -3,13 +3,14 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_Structure.hxx>
|
||||
|
||||
#include <OpenGl_Polyline.hxx>
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
#include <OpenGl_View.hxx>
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <OpenGl_telem_util.hxx>
|
||||
|
||||
|
||||
|
@ -3,20 +3,14 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
#include <OpenGl_Text.hxx>
|
||||
|
||||
#if (!defined(_WIN32) && !defined(__WIN32__))
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <GL/gl.h>
|
||||
|
||||
#include <OpenGl_Memory.hxx>
|
||||
|
||||
#include <OpenGl_AspectText.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
|
||||
#include <GL/glu.h> // gluUnProject()
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
OpenGl_Text::OpenGl_Text (const TCollection_ExtendedString& AText,
|
||||
|
@ -53,7 +53,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
#include <OpenGl_Display.hxx>
|
||||
#include <OpenGl_TextureBox.hxx>
|
||||
#include <OpenGl_ImageBox.hxx>
|
||||
@ -61,14 +61,12 @@
|
||||
#include <OpenGl_ResourceCleaner.hxx>
|
||||
#include <OpenGl_ResourceTexture.hxx>
|
||||
|
||||
#include <GL/glu.h> // gluBuild2DMipmaps()
|
||||
|
||||
#define GROW_TEXTURES 8
|
||||
#define GROW_TEXTURES_DATA 8
|
||||
#define GROW_CONTEXT 8
|
||||
|
||||
#ifndef max
|
||||
#define max(a,b) ((a) > (b)) ? (a) : (b);
|
||||
#endif
|
||||
|
||||
typedef enum {TEXDATA_NONE, TEXDATA_1D, TEXDATA_2D, TEXDATA_2DMM} texDataStatus;
|
||||
typedef enum {TEX_NONE, TEX_ALLOCATED} texStatus;
|
||||
|
||||
@ -185,7 +183,7 @@ static TextureDataID FindFreeTextureData(void)
|
||||
for (i=0; i<textures_data_size; i++)
|
||||
if (texdata[i].status == TEXDATA_NONE)
|
||||
{
|
||||
textures_data_count = max (textures_data_count, i + 1);
|
||||
textures_data_count = Max (textures_data_count, i + 1);
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -221,7 +219,7 @@ static TextureID FindFreeTexture(void)
|
||||
for (i=0; i<textures_size; i++)
|
||||
if (textab[i].status == TEX_NONE)
|
||||
{
|
||||
textures_count = max (textures_count, i + 1);
|
||||
textures_count = Max (textures_count, i + 1);
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -924,7 +922,7 @@ void SetTextureRepeat(TextureID ID)
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
/* gestion de la facon d'appliquer la texture */
|
||||
void SetModeObject(TextureID ID, GLfloat sparams[4], GLfloat tparams[4])
|
||||
void SetModeObject(TextureID ID, const GLfloat sparams[4], const GLfloat tparams[4])
|
||||
{
|
||||
if (!IsTextureValid(ID)) return;
|
||||
|
||||
@ -949,7 +947,7 @@ void SetModeSphere(TextureID ID)
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void SetModeEye(TextureID ID, GLfloat sparams[4], GLfloat tparams[4])
|
||||
void SetModeEye(TextureID ID, const GLfloat sparams[4], const GLfloat tparams[4])
|
||||
{
|
||||
if (!IsTextureValid(ID)) return;
|
||||
|
||||
|
@ -42,22 +42,9 @@
|
||||
#ifndef _OPENGL_TEXTUREBOX_H_
|
||||
#define _OPENGL_TEXTUREBOX_H_
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Includes
|
||||
*/
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
|
||||
#include <GL/gl.h>
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Constantes
|
||||
*/
|
||||
|
||||
typedef int TextureID;
|
||||
#define TEXTUREBOX_ERROR ((TextureID)-1)
|
||||
|
||||
@ -81,11 +68,6 @@ struct _TextureData
|
||||
};
|
||||
typedef _TextureData TextureData;
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
|
||||
/*
|
||||
* Gestion des textures
|
||||
*/
|
||||
@ -122,9 +104,9 @@ void SetTextureDecal(TextureID ID);
|
||||
void SetTextureClamp(TextureID ID);
|
||||
void SetTextureRepeat(TextureID ID);
|
||||
|
||||
void SetModeObject(TextureID ID, GLfloat sparams[4], GLfloat tparams[4]);
|
||||
void SetModeObject(TextureID ID, const GLfloat sparams[4], const GLfloat tparams[4]);
|
||||
void SetModeSphere(TextureID ID);
|
||||
void SetModeEye(TextureID ID, GLfloat sparams[4], GLfloat tparams[4]);
|
||||
void SetModeEye(TextureID ID, const GLfloat sparams[4], const GLfloat tparams[4]);
|
||||
void SetModeManual(TextureID ID);
|
||||
|
||||
void SetRenderNearest(TextureID ID);
|
||||
|
@ -3,8 +3,7 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <GL/gl.h>
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_TriangleStrip.hxx>
|
||||
|
||||
|
@ -3,14 +3,11 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#define QTOCC_PATCH /* Active QtOPENCASCADE patches */
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h> /* pour M_PI */
|
||||
|
||||
#include <OpenGl_TextureBox.hxx>
|
||||
|
||||
@ -20,37 +17,15 @@
|
||||
|
||||
#include <OpenGl_transform_persistence.hxx>
|
||||
|
||||
#ifdef HAVE_GL2PS
|
||||
#include <gl2ps.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
#include <OpenGl_View.hxx>
|
||||
#include <OpenGl_Trihedron.hxx>
|
||||
|
||||
#include <GL/glu.h> // gluNewQuadric()
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE(OpenGl_Trihedron,MMgt_TShared)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Trihedron,MMgt_TShared)
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Constantes
|
||||
*/
|
||||
|
||||
#define NO_DEBUG
|
||||
#define NO_PRINT
|
||||
#define NO_PRINT_MATRIX
|
||||
|
||||
#ifndef M_PI
|
||||
# define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
static const CALL_DEF_CONTEXTLINE myDefaultContextLine =
|
||||
{
|
||||
1, //IsDef
|
||||
@ -173,7 +148,7 @@ void OpenGl_Trihedron::Redraw (const Handle(OpenGl_Workspace) &AWorkspace) const
|
||||
*/
|
||||
const OpenGl_AspectLine *AspectLine = AWorkspace->AspectLine( Standard_True );
|
||||
|
||||
#ifdef QTOCC_PATCH /* Fotis Sioutis 2007-11-14 15:06
|
||||
/* Fotis Sioutis 2007-11-14 15:06
|
||||
I have also seen in previous posts that the view trihedron in V3d_WIREFRAME mode
|
||||
changes colors depending on the state of the view. This behaviour can be easily
|
||||
corrected by altering call_triedron_redraw function in OpenGl_triedron.c of TKOpengl.
|
||||
@ -182,7 +157,6 @@ void OpenGl_Trihedron::Redraw (const Handle(OpenGl_Workspace) &AWorkspace) const
|
||||
Below is the code portion with the modification.I don't know if this is considered to
|
||||
be a bug but anyway i believe it might help some of you out there.*/
|
||||
glDisable(GL_LIGHTING);
|
||||
#endif
|
||||
|
||||
/* Position de l'origine */
|
||||
const GLdouble TriedronOrigin[3] = { 0.0, 0.0, 0.0 };
|
||||
@ -308,25 +282,11 @@ void OpenGl_Trihedron::RedrawZBuffer (const Handle(OpenGl_Workspace) &AWorkspace
|
||||
glGetDoublev( GL_PROJECTION_MATRIX, (GLdouble *) projMatrix );
|
||||
|
||||
/* Check position in the ViewPort */
|
||||
#ifdef QTOCC_PATCH /* PCD 29/09/2008 */
|
||||
/* PCD 29/09/2008 */
|
||||
/* Simple code modification recommended by Fotis Sioutis and Peter Dolbey */
|
||||
/* to remove the irritating default behaviour of triedrons using V3d_ZBUFFER */
|
||||
/* which causes the glyph to jump around the screen when the origin moves offscreen. */
|
||||
GLboolean isWithinView = GL_FALSE;
|
||||
#else
|
||||
/* Original code */
|
||||
GLint aViewPort[4]; /* to store view port coordinates */
|
||||
glGetIntegerv(GL_VIEWPORT, aViewPort);
|
||||
GLdouble aWinCoord[3];
|
||||
/* Position de l'origine */
|
||||
const GLdouble TriedronOrigin[3] = { 0.0, 0.0, 0.0 };
|
||||
gluProject(TriedronOrigin[0], TriedronOrigin[1], TriedronOrigin[2],
|
||||
(GLdouble *)modelMatrix, (GLdouble *)projMatrix, aViewPort,
|
||||
&aWinCoord[0], &aWinCoord[1], &aWinCoord[2]);
|
||||
|
||||
GLboolean isWithinView = !((aWinCoord[0]<aViewPort[0]) || (aWinCoord[0]>aViewPort[2]) ||
|
||||
(aWinCoord[1]<aViewPort[1]) || (aWinCoord[1]>aViewPort[3]));
|
||||
#endif
|
||||
|
||||
/* la taille des axes est 1 proportion (fixee a l'init du triedre) */
|
||||
/* de la dimension la plus petite de la window. */
|
||||
@ -393,19 +353,12 @@ void OpenGl_Trihedron::RedrawZBuffer (const Handle(OpenGl_Workspace) &AWorkspace
|
||||
|
||||
const GLboolean aIsDepthEnabled = glIsEnabled(GL_DEPTH_TEST);
|
||||
|
||||
#ifndef BUG
|
||||
|
||||
GLboolean aIsDepthMaskEnabled;
|
||||
#ifdef QTOCC_PATCH /*PCD 02/07/07 */
|
||||
/*PCD 02/07/07 */
|
||||
/* GL_DEPTH_WRITEMASK is not a valid argument to glIsEnabled, the */
|
||||
/* original code is shown to be broken when run under an OpenGL debugger */
|
||||
/* like GLIntercept. This is the correct way to retrieve the mask value. */
|
||||
glGetBooleanv(GL_DEPTH_WRITEMASK, &aIsDepthMaskEnabled);
|
||||
#else
|
||||
aIsDepthMaskEnabled = glIsEnabled(GL_DEPTH_WRITEMASK);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
const GLdouble aCylinderLength = L * CYLINDER_LENGTH;
|
||||
const GLdouble aCylinderDiametr = L * myDiameter;
|
||||
@ -442,7 +395,7 @@ void OpenGl_Trihedron::RedrawZBuffer (const Handle(OpenGl_Workspace) &AWorkspace
|
||||
glCullFace(GL_BACK);
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
#ifdef QTOCC_PATCH /*Fotis Sioutis | 2008-01-21 10:55
|
||||
/*Fotis Sioutis | 2008-01-21 10:55
|
||||
In the function call_zbuffer_triedron_redraw of TKOpengl,
|
||||
the z buffered trihedron changes colors in case there
|
||||
is an object in the scene that has an explicit material
|
||||
@ -464,29 +417,20 @@ void OpenGl_Trihedron::RedrawZBuffer (const Handle(OpenGl_Workspace) &AWorkspace
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, aNULLColor);
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, aNULLColor);
|
||||
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 0.f);
|
||||
#endif
|
||||
|
||||
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
|
||||
if (!aIsDepthEnabled) {
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
#ifndef BUG
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
#endif
|
||||
}
|
||||
#ifdef BUG
|
||||
if (!(aIsDepthEnabled && isWithinView))
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
#endif
|
||||
|
||||
#ifndef BUG
|
||||
if (!aIsDepthMaskEnabled) {
|
||||
/* This is how the depthmask needs to be re-enabled...*/
|
||||
glDepthMask(GL_TRUE);
|
||||
/* ...and not this stuff below */
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Position des Axes */
|
||||
GLdouble TriedronAxeX[3] = { 1.0, 0.0, 0.0 };
|
||||
@ -498,70 +442,10 @@ void OpenGl_Trihedron::RedrawZBuffer (const Handle(OpenGl_Workspace) &AWorkspace
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
#ifdef QTOCC_PATCH /* PCD 17/06/07 */
|
||||
/* PCD 17/06/07 */
|
||||
GLint df;
|
||||
glGetIntegerv (GL_DEPTH_FUNC, &df);
|
||||
#else
|
||||
/*
|
||||
#define COLOR_REDUCE 0.3f
|
||||
#ifdef BUG
|
||||
#define ALPHA_REDUCE 0.4f
|
||||
#else
|
||||
#define ALPHA_REDUCE 1.0f
|
||||
#endif
|
||||
//szv:if (isWithinView) {
|
||||
glDepthFunc(GL_GREATER);
|
||||
glPushMatrix();
|
||||
glPushMatrix();
|
||||
glPushMatrix();
|
||||
|
||||
glColor4f(aLineColor.rgb[0]*COLOR_REDUCE,
|
||||
aLineColor.rgb[1]*COLOR_REDUCE,
|
||||
aLineColor.rgb[2]*COLOR_REDUCE,
|
||||
ALPHA_REDUCE);
|
||||
glCallList(startList+2);
|
||||
|
||||
// Z axis
|
||||
glColor4f(myZColor.rgb[0]*COLOR_REDUCE,
|
||||
myZColor.rgb[1]*COLOR_REDUCE,
|
||||
myZColor.rgb[2]*COLOR_REDUCE,
|
||||
ALPHA_REDUCE);
|
||||
glCallList(startList);
|
||||
glTranslated(0, 0, L * CYLINDER_LENGTH);
|
||||
glCallList(startList + 3);
|
||||
glCallList(startList + 1);
|
||||
glPopMatrix();
|
||||
|
||||
// X axis
|
||||
glRotated(90.0, TriedronAxeY[0], TriedronAxeY[1], TriedronAxeY[2]);
|
||||
glColor4f(myXColor.rgb[0]*COLOR_REDUCE,
|
||||
myXColor.rgb[1]*COLOR_REDUCE,
|
||||
myXColor.rgb[2]*COLOR_REDUCE,
|
||||
ALPHA_REDUCE);
|
||||
glCallList(startList);
|
||||
glTranslated(0, 0, L * CYLINDER_LENGTH);
|
||||
glCallList(startList + 3);
|
||||
glCallList(startList + 1);
|
||||
glPopMatrix();
|
||||
|
||||
// Y axis
|
||||
glRotated(-90.0, TriedronAxeX[0], TriedronAxeX[1], TriedronAxeX[2]);
|
||||
glColor4f(myYColor.rgb[0]*COLOR_REDUCE,
|
||||
myYColor.rgb[1]*COLOR_REDUCE,
|
||||
myYColor.rgb[2]*COLOR_REDUCE,
|
||||
ALPHA_REDUCE);
|
||||
glCallList(startList);
|
||||
glTranslated(0, 0, L * CYLINDER_LENGTH);
|
||||
glCallList(startList + 3);
|
||||
glCallList(startList + 1);
|
||||
glPopMatrix();
|
||||
|
||||
glDepthFunc(GL_LESS);
|
||||
//szv:}
|
||||
*/
|
||||
#endif
|
||||
|
||||
#ifdef QTOCC_PATCH
|
||||
int i;
|
||||
for (i = 0; i < 2; i++) /* PCD 11/02/08 Two pass method */
|
||||
{
|
||||
@ -573,7 +457,6 @@ void OpenGl_Trihedron::RedrawZBuffer (const Handle(OpenGl_Workspace) &AWorkspace
|
||||
{
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
}
|
||||
#endif
|
||||
|
||||
glPushMatrix();
|
||||
glPushMatrix();
|
||||
@ -607,33 +490,22 @@ void OpenGl_Trihedron::RedrawZBuffer (const Handle(OpenGl_Workspace) &AWorkspace
|
||||
glCallList(startList + 3);
|
||||
glCallList(startList + 1);
|
||||
glPopMatrix();
|
||||
|
||||
#ifdef QTOCC_PATCH
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!aIsDepthEnabled)
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
#ifndef BUG
|
||||
|
||||
if (!aIsDepthMaskEnabled)
|
||||
|
||||
#ifdef QTOCC_PATCH /*PCD 02/07/07 */
|
||||
glDepthMask(GL_FALSE);
|
||||
#else
|
||||
glDisable(GL_DEPTH_WRITEMASK);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_COLOR_MATERIAL);
|
||||
|
||||
gluDeleteQuadric(aQuadric);
|
||||
glColor3fv (aLineColor.rgb);
|
||||
|
||||
#ifdef QTOCC_PATCH /* PCD 11/02/08 */
|
||||
/* Always write the text */
|
||||
glDepthFunc(GL_ALWAYS);
|
||||
#endif
|
||||
|
||||
glPopAttrib();
|
||||
|
||||
@ -656,10 +528,8 @@ void OpenGl_Trihedron::RedrawZBuffer (const Handle(OpenGl_Workspace) &AWorkspace
|
||||
AWorkspace->RenderText (L"Y", 0, float(rayon), float(L + 3.0 * rayon), float(2.0 * rayon));
|
||||
AWorkspace->RenderText (L"Z", 0, float(-2.0 * rayon), float(0.5 * rayon), float(L + 3.0 * rayon));
|
||||
|
||||
#ifdef QTOCC_PATCH
|
||||
/*PCD 17/06/07 */
|
||||
glDepthFunc(df);
|
||||
#endif
|
||||
|
||||
if (!isWithinView) { /* restore matrix */
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
|
@ -3,20 +3,21 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_View.hxx>
|
||||
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
#include <OpenGl_Display.hxx>
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <GL/gl.h>
|
||||
|
||||
#include <OpenGl_Display.hxx>
|
||||
#include <OpenGl_Trihedron.hxx>
|
||||
#include <OpenGl_GraduatedTrihedron.hxx>
|
||||
|
||||
#include <OpenGl_transform_persistence.hxx>
|
||||
|
||||
#include <GL/glu.h> // gluUnProject()
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE(OpenGl_View,MMgt_TShared)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_View,MMgt_TShared)
|
||||
|
||||
|
@ -3,16 +3,18 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_View.hxx>
|
||||
|
||||
#include <Visual3d_Layer.hxx>
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <OpenGl_tgl_funcs.hxx>
|
||||
|
||||
#include <OpenGl_PrinterContext.hxx>
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
|
||||
#include <GL/glu.h> // gluProject(), gluUnProject()
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
//TelProjectionRaster in OpenGl_telem_util.cxx
|
||||
|
@ -3,18 +3,10 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#define G003 /* EUG 20-09-99 ; Animation management
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Includes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
#include <OpenGl_tgl_funcs.hxx>
|
||||
#include <OpenGl_TextureBox.hxx>
|
||||
|
||||
@ -22,10 +14,6 @@
|
||||
#include <Image_Image.hxx>
|
||||
#include <Visual3d_Layer.hxx>
|
||||
|
||||
#if defined(WNT)
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
|
||||
#include <OpenGl_AspectLine.hxx>
|
||||
#include <OpenGl_Display.hxx>
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
@ -35,17 +23,10 @@
|
||||
#include <OpenGl_PrinterContext.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Constantes
|
||||
*/
|
||||
#include <GL/glu.h> // gluBuild2DMipmaps()
|
||||
|
||||
#define EPSI 0.0001
|
||||
|
||||
#ifndef M_PI
|
||||
# define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
static const GLfloat default_amb[4] = { 0.F, 0.F, 0.F, 1.F };
|
||||
static const GLfloat default_sptdir[3] = { 0.F, 0.F, -1.F };
|
||||
static const GLfloat default_sptexpo = 0.F;
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include <Aspect_GraphicDeviceDefinitionError.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
#include <GL/glu.h> // gluOrtho2D()
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE(OpenGl_Window,MMgt_TShared)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Window,MMgt_TShared)
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <InterfaceGraphic.hxx>
|
||||
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
@ -12,7 +14,6 @@
|
||||
#include <OpenGl_AspectMarker.hxx>
|
||||
#include <OpenGl_AspectText.hxx>
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <OpenGl_TextureBox.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE(OpenGl_Workspace,OpenGl_Window)
|
||||
|
@ -5,15 +5,6 @@
|
||||
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <GL/gl.h>
|
||||
|
||||
#include <InterfaceGraphic_Labels.hxx>
|
||||
#include <InterfaceGraphic_Graphic3d.hxx>
|
||||
#include <InterfaceGraphic_Visual3d.hxx>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
//call_togl_begin_animation
|
||||
void OpenGl_Workspace::BeginAnimation (const Standard_Boolean UseDegeneration, const Standard_Boolean UpdateAM)
|
||||
{
|
||||
|
@ -3,14 +3,10 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#define RIC120302 /* GG Enable to use the application display
|
||||
// callback at end of traversal
|
||||
*/
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <OpenGl_FrameBuffer.hxx>
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
#include <string.h>
|
||||
#include <OpenGl_telem_util.hxx>
|
||||
|
||||
#ifdef HAVE_FREEIMAGE
|
||||
@ -28,6 +24,8 @@
|
||||
#include <OpenGl_View.hxx>
|
||||
#include <OpenGl_Display.hxx>
|
||||
|
||||
#include <GL/glu.h> // gluOrtho2D()
|
||||
|
||||
//10-05-96 : CAL ; Ajout d'un nouveau delta dans les copies de pixels (voir CALL_DEF_DELTA)
|
||||
#define CALL_DEF_DELTA 10
|
||||
|
||||
|
@ -3,42 +3,19 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#define BUC60863 /*GG_100401 After any view update, made identical
|
||||
// the front and back buffer to avoid ghost drawing.
|
||||
// Minimize flicking.
|
||||
*/
|
||||
|
||||
#define IMP150501 /*GG_150501 CADPAK_V2 Enable/Disable Zbuffer
|
||||
NOTE that the previous and unused "double-buffer"
|
||||
arg is changed to "zbuffer" and enable/disable
|
||||
to use the OpenGl zbuffer capabilities during immediat
|
||||
drawing
|
||||
*/
|
||||
|
||||
#define IMP260601 /*GG Enable correct backing store between 2 different views.
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#define RIC120302 /* GG Enable to use the application display
|
||||
// callback at end of traversal
|
||||
*/
|
||||
|
||||
/*
|
||||
* Includes
|
||||
*/
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_GL2PS
|
||||
#include <gl2ps.h>
|
||||
#endif
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
#include <OpenGl_Context.hxx>
|
||||
#include <OpenGl_telem_util.hxx>
|
||||
#include <OpenGl_AspectLine.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
|
||||
#ifdef HAVE_GL2PS
|
||||
#include <gl2ps.h>
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Prototypes Private functions
|
||||
|
@ -3,12 +3,11 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#if (defined(_WIN32) || defined(__WIN32__))
|
||||
#include <OpenGl_AVIWriter.hxx>
|
||||
#else
|
||||
#define CALL_DEF_STRING_LENGTH 132
|
||||
#endif
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
|
||||
#include <OpenGl_FrameBuffer.hxx>
|
||||
#include <OpenGl_ResourceCleaner.hxx>
|
||||
|
@ -3,6 +3,8 @@
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
|
||||
#include <OpenGl_AspectLine.hxx>
|
||||
@ -20,13 +22,8 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <GL/gl.h>
|
||||
|
||||
#include <OpenGl_TextureBox.hxx>
|
||||
|
||||
#include <Aspect_PolygonOffsetMode.hxx>
|
||||
|
||||
#include <OpenGl_View.hxx>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
@ -48,35 +48,8 @@ when a face has confused or aligned points.
|
||||
|
||||
************************************************************************/
|
||||
|
||||
#define IMP190100 /*GG To avoid too many REDRAW in immediat mode,
|
||||
// Add TelMakeFrontAndBackBufCurrent() function
|
||||
*/
|
||||
#define QTOCC_PATCH
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Includes
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef WNT
|
||||
# include <X11/Xlib.h>
|
||||
#else
|
||||
# define STRICT
|
||||
# include <windows.h>
|
||||
#endif /* WNT */
|
||||
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#ifndef WNT
|
||||
#include <GL/glx.h>
|
||||
#endif /* WNT */
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <OpenGl_telem_util.hxx>
|
||||
#include <InterfaceGraphic_Graphic3d.hxx>
|
||||
#include <InterfaceGraphic_Visual3d.hxx>
|
||||
|
@ -23,22 +23,8 @@ xx-xx-xx : xxx ; Creation.
|
||||
#ifndef OPENGL_TELEM_UTIL_H
|
||||
#define OPENGL_TELEM_UTIL_H
|
||||
|
||||
#ifndef IMP190100
|
||||
#define IMP190100 /*GG To avoid too many REDRAW in immediat mode,
|
||||
// Add TelMakeFrontAndBackBufCurrent() function
|
||||
*/
|
||||
#endif
|
||||
|
||||
#define BUC60823 /* GG 05/03/01 Avoid to crash in normal computation
|
||||
// between confused points
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <GL/gl.h>
|
||||
#ifndef WNT
|
||||
#include <GL/glx.h>
|
||||
#endif
|
||||
#include <InterfaceGraphic_telem.hxx>
|
||||
#include <cmath>
|
||||
|
||||
/*
|
||||
* ShortRealLast () = 3.40282346638528860e+38
|
||||
@ -78,17 +64,12 @@ xx-xx-xx : xxx ; Creation.
|
||||
#define vecmg2(a) (square((a)[0])+square((a)[1])+square((a)[2]))
|
||||
|
||||
/* magnitude */
|
||||
#define vecmag(a) (sqrt((double)vecmg2(a)))
|
||||
#define vecmag(a) (std::sqrt((double)vecmg2(a)))
|
||||
|
||||
/* normalize */
|
||||
#ifdef BUC60823
|
||||
#define vecnrmd(a,d) ( d = (Tfloat)vecmag(a), \
|
||||
( d > 1e-10 ? (a[0] /= d, a[1] /= d, a[2] /= d, d) : (Tfloat)0. ) )
|
||||
#define vecnrm(a) { Tfloat d; vecnrmd(a,d); }
|
||||
#else
|
||||
#define vecnrm(a) { Tfloat d; d = ( Tfloat )vecmag(a); \
|
||||
(a)[0] /= d; (a)[1] /= d; (a)[2] /= d; }
|
||||
#endif
|
||||
|
||||
/* angle between two vectors */
|
||||
#define vecang(a,b,d) { d = (Tfloat)(vecmag(a)*vecmag(b)); \
|
||||
|
@ -6,7 +6,7 @@ File OpenGl_telem_view :
|
||||
|
||||
************************************************************************/
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
#include <OpenGl_telem_view.hxx>
|
||||
#include <OpenGl_telem_util.hxx>
|
||||
#include <OpenGl_Display.hxx>
|
||||
|
@ -1,41 +0,0 @@
|
||||
/***********************************************************************
|
||||
|
||||
FONCTION :
|
||||
----------
|
||||
File OpenGl_tgl_all.h :
|
||||
|
||||
|
||||
REMARQUES:
|
||||
----------
|
||||
|
||||
|
||||
HISTORIQUE DES MODIFICATIONS :
|
||||
--------------------------------
|
||||
xx-xx-xx : xxx ; Creation.
|
||||
07-10-97 : FMN ; Simplification WNT
|
||||
16-06-2000 : ATS : G005 : Move type declarations to InterfaceGraphic_tgl_all.h
|
||||
|
||||
************************************************************************/
|
||||
|
||||
#ifndef OPENGL_TGL_ALL_H
|
||||
#define OPENGL_TGL_ALL_H
|
||||
|
||||
#if defined(WNT) && !defined(HAVE_NO_DLL)
|
||||
# ifdef __OpenGl_DLL
|
||||
# define EXPORT __declspec(dllexport)
|
||||
# else
|
||||
# define EXPORT
|
||||
# endif /* DLL */
|
||||
#else
|
||||
# define EXPORT
|
||||
#endif /* WNT */
|
||||
|
||||
#include <InterfaceGraphic.hxx>
|
||||
#include <InterfaceGraphic_tgl_all.hxx>
|
||||
#include <InterfaceGraphic_telem.hxx>
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
|
||||
#endif /* OPENGL_TGL_ALL_H */
|
@ -1,65 +1,10 @@
|
||||
/***********************************************************************
|
||||
// File: OpenGl_tgl_funcs.hxx
|
||||
// Created: ??-??-??
|
||||
// Author: PCT
|
||||
// Copyright: OPEN CASCADE 2012
|
||||
|
||||
FONCTION :
|
||||
----------
|
||||
Fichier OpenGl_tgl_funcs.h
|
||||
|
||||
|
||||
REMARQUES:
|
||||
----------
|
||||
|
||||
|
||||
HISTORIQUE DES MODIFICATIONS :
|
||||
--------------------------------
|
||||
??-??-?? : PCT ; creation
|
||||
10-07-96 : FMN ; Suppression #define sur calcul matrice
|
||||
05-08-97 : PCT ; support texture mapping
|
||||
23-12-97 : FMN ; Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex
|
||||
15-01-98 : FMN ; Ajout Hidden line
|
||||
08-04-98 : FGU ; Ajout emission
|
||||
27-11-98 : CAL ; S4062. Ajout des layers.
|
||||
30-11-98 : FMN ; S3819 : Textes toujours visibles
|
||||
22-03-04 : SAN ; OCC4895 High-level interface for controlling polygon offsets
|
||||
04-10-04 : ABD ; Added User Defined marker type
|
||||
|
||||
************************************************************************/
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#ifndef OPENGL_TGL_FUNCS_H
|
||||
#define OPENGL_TGL_FUNCS_H
|
||||
|
||||
#define BUC60570 /* GG 06-09-99
|
||||
// The model view SD_NORMAL must shown objects with FLAT shading
|
||||
*/
|
||||
|
||||
#ifndef G003
|
||||
#define G003 /* EUG 06-10-99 Degeneration support
|
||||
*/
|
||||
#endif
|
||||
|
||||
|
||||
#define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing
|
||||
from higher API */
|
||||
#define BUC61045 /* 25/10/01 SAV ; added functionality to control gl lighting
|
||||
from higher API */
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Includes
|
||||
*/
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <InterfaceGraphic_Graphic3d.hxx>
|
||||
#include <InterfaceGraphic_Visual3d.hxx>
|
||||
|
||||
#include <OSD_FontAspect.hxx>
|
||||
#include <Graphic3d_CGraduatedTrihedron.hxx>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Types definis
|
||||
*/
|
||||
#ifndef OPENGL_TGL_FUNCS_H
|
||||
#define OPENGL_TGL_FUNCS_H
|
||||
|
||||
typedef float matrix3[4][4];
|
||||
|
||||
@ -111,11 +56,6 @@ typedef struct {
|
||||
float front_plane; /* front plane distance */
|
||||
} view_map3;
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
|
||||
extern void call_func_eval_ori_matrix3 (const point3* vrp,
|
||||
const vec3* vpn,
|
||||
const vec3* vup,
|
||||
@ -123,15 +63,5 @@ extern void call_func_eval_ori_matrix3 (const point3* vrp,
|
||||
float mout[4][4]);
|
||||
|
||||
extern void call_func_eval_map_matrix3(view_map3 *Map, int *err_ind, matrix3 mat);
|
||||
|
||||
int EXPORT call_togl_create_texture (int Type, unsigned int Width, unsigned int Height, unsigned char *Data, char *FileName);
|
||||
|
||||
void EXPORT call_togl_destroy_texture (int TexId);
|
||||
|
||||
void EXPORT call_togl_modify_texture (int TexId, CALL_DEF_INIT_TEXTURE *init_tex);
|
||||
|
||||
int EXPORT call_togl_inquiretexture ();
|
||||
|
||||
int EXPORT call_togl_inquireplane ();
|
||||
|
||||
#endif
|
||||
|
||||
#endif // OPENGL_TGL_FUNCS_H
|
||||
|
@ -1,27 +0,0 @@
|
||||
#define GER61454 /*GG 14-09-99 Activates the model clipping planes
|
||||
// GG 110800 UNDER LINUX and MESA 3.2, nothing can be done until
|
||||
// gl context is open first.
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
|
||||
int EXPORT
|
||||
call_togl_inquireplane ()
|
||||
{
|
||||
GLint maxplanes = 0;
|
||||
if( GET_GL_CONTEXT() ) {
|
||||
#ifdef GER61454
|
||||
glGetIntegerv( GL_MAX_CLIP_PLANES, &maxplanes);
|
||||
maxplanes -= 2; /* NOTE the 2 first planes are reserved for ZClipping */
|
||||
if( maxplanes < 0 )
|
||||
maxplanes = 0;
|
||||
#endif
|
||||
}
|
||||
#ifdef DEBUG
|
||||
printf(" @@@ call_togl_inquireplane. GL_MAX_CLIP_PLANES is %d\n",maxplanes);
|
||||
#endif
|
||||
return maxplanes;
|
||||
}
|
@ -1,144 +0,0 @@
|
||||
/***********************************************************************
|
||||
|
||||
FONCTION :
|
||||
----------
|
||||
File OpenGl_togl_texture.c :
|
||||
|
||||
|
||||
REMARQUES:
|
||||
----------
|
||||
|
||||
|
||||
HISTORIQUE DES MODIFICATIONS :
|
||||
--------------------------------
|
||||
05-08-97 : PCT ; Support texture mapping
|
||||
20-11-97 : FMN ; Ajout call_togl_inquiretexture
|
||||
Ajout coupure du texture mapping
|
||||
|
||||
************************************************************************/
|
||||
|
||||
#define OCC1188 /*SAV 23/12/02 - added methods to set background image */
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Includes
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <OpenGl_tgl_all.hxx>
|
||||
#include <OpenGl_tgl_funcs.hxx>
|
||||
#include <OpenGl_TextureBox.hxx>
|
||||
|
||||
#ifdef OCC1188
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
int EXPORT
|
||||
call_togl_create_texture
|
||||
(
|
||||
int Type,
|
||||
unsigned int Width,
|
||||
unsigned int Height,
|
||||
unsigned char *Data,
|
||||
char *FileName
|
||||
)
|
||||
{
|
||||
if (call_togl_inquiretexture ())
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
case 0:
|
||||
return GetTextureData1D(FileName, Width, Height, Data);
|
||||
|
||||
case 1:
|
||||
return GetTextureData2D(FileName, Width, Height, Data);
|
||||
|
||||
case 2:
|
||||
return GetTextureData2DMipMap(FileName, Width, Height, Data);
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return -1 ;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void EXPORT
|
||||
call_togl_destroy_texture
|
||||
(
|
||||
int TexId
|
||||
)
|
||||
{
|
||||
if (call_togl_inquiretexture ())
|
||||
FreeTexture(TexId);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void EXPORT
|
||||
call_togl_modify_texture
|
||||
(
|
||||
int TexId,
|
||||
CALL_DEF_INIT_TEXTURE *init_tex
|
||||
)
|
||||
{
|
||||
if (call_togl_inquiretexture ())
|
||||
{
|
||||
if (init_tex->doModulate)
|
||||
SetTextureModulate(TexId);
|
||||
else
|
||||
SetTextureDecal(TexId);
|
||||
|
||||
if (init_tex->doRepeat)
|
||||
SetTextureRepeat(TexId);
|
||||
else
|
||||
SetTextureClamp(TexId);
|
||||
|
||||
switch (init_tex->Mode)
|
||||
{
|
||||
case 0:
|
||||
SetModeObject(TexId,
|
||||
&init_tex->sparams[0], &init_tex->tparams[0]);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
SetModeSphere(TexId);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
SetModeEye(TexId,
|
||||
&init_tex->sparams[0], &init_tex->tparams[0]);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
SetModeManual(TexId);
|
||||
break;
|
||||
}
|
||||
|
||||
if (init_tex->doLinear)
|
||||
SetRenderLinear(TexId);
|
||||
else
|
||||
SetRenderNearest(TexId);
|
||||
|
||||
SetTexturePosition(TexId,
|
||||
init_tex->sx, init_tex->sy,
|
||||
init_tex->tx, init_tex->ty,
|
||||
init_tex->angle);
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
int EXPORT
|
||||
call_togl_inquiretexture ()
|
||||
{
|
||||
#if defined(__sun)
|
||||
return 1;
|
||||
#else
|
||||
return 1;
|
||||
#endif /* SUN */
|
||||
}
|
@ -25,9 +25,6 @@ et TelBackInteriorShadingMethod
|
||||
#ifndef OPENGL_TSM_H
|
||||
#define OPENGL_TSM_H
|
||||
|
||||
#define G003 /* EUG 21-09-99 Degeneration management
|
||||
*/
|
||||
|
||||
#define OCC1188 /* SAV 23/12/02 Added structure to control background texture
|
||||
+ enum to control texture fill method
|
||||
*/
|
||||
@ -94,9 +91,7 @@ typedef enum
|
||||
TelTextStyle,
|
||||
TelTextDisplayType,
|
||||
TelTextColourSubTitle,
|
||||
#ifdef G003
|
||||
TelDegenerationMode,
|
||||
#endif /* G003 */
|
||||
TelTextZoomable,//Text Zoomable attributes
|
||||
TelTextAngle,//Text Angle attributes
|
||||
TelTextFontAspect,//Text Font Aspect attributes
|
||||
|
11751
src/OpenGl/glext.h
Normal file
11751
src/OpenGl/glext.h
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user