0023076: Empty result done by intersection algorithm for a curve and a surface
[occt.git] / src / OpenGl / OpenGl_Context.cxx
CommitLineData
b311480e 1// Created on: 2012-01-26
2// Created by: Kirill GAVRILOV
3// Copyright (c) 2012-2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
2166f0fa 20
5f8b738e 21#if (defined(_WIN32) || defined(__WIN32__))
22 #include <windows.h>
23#endif
24
2166f0fa
SK
25#include <OpenGl_Context.hxx>
26
5f8b738e 27#include <OpenGl_ArbVBO.hxx>
28#include <OpenGl_ExtFBO.hxx>
29#include <OpenGl_GlCore20.hxx>
30
2bd4c032 31#include <Standard_ProgramError.hxx>
32
5f8b738e 33#if (defined(_WIN32) || defined(__WIN32__))
34 //
35#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
36 #include <dlfcn.h>
37#else
38 #include <GL/glx.h> // glXGetProcAddress()
39#endif
40
2166f0fa
SK
41IMPLEMENT_STANDARD_HANDLE (OpenGl_Context, Standard_Transient)
42IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Context, Standard_Transient)
43
5f8b738e 44//! Make record shorter to retrieve function pointer using variable with same name
45#define FindProcShort(theStruct, theFunc) FindProc(#theFunc, theStruct->theFunc)
2166f0fa
SK
46
47// =======================================================================
48// function : OpenGl_Context
49// purpose :
50// =======================================================================
51OpenGl_Context::OpenGl_Context()
5f8b738e 52: core12 (NULL),
53 core13 (NULL),
54 core14 (NULL),
55 core15 (NULL),
56 core20 (NULL),
57 arbVBO (NULL),
58 extFBO (NULL),
59 myGlLibHandle (NULL),
60 myGlCore20 (NULL),
61 myGlVerMajor (0),
62 myGlVerMinor (0),
664cae74 63 myIsFeedback (Standard_False),
5f8b738e 64 myIsInitialized (Standard_False)
2166f0fa 65{
5f8b738e 66#if defined(MAC_OS_X_VERSION_10_3) && !defined(MACOSX_USE_GLX)
67 // Vendors can not extend functionality on this system
68 // and developers are limited to OpenGL support provided by Mac OS X SDK.
69 // We retrieve function pointers from system library
70 // to generalize extensions support on all platforms.
71 // In this way we also reach binary compatibility benefit between OS releases
72 // if some newest functionality is optionally used.
73 // Notice that GL version / extension availability checks are required
74 // because function pointers may be available but not functionality itself
75 // (depends on renderer).
76 myGlLibHandle = dlopen ("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY);
77#endif
2166f0fa
SK
78}
79
80// =======================================================================
81// function : ~OpenGl_Context
82// purpose :
83// =======================================================================
84OpenGl_Context::~OpenGl_Context()
85{
5f8b738e 86 delete myGlCore20;
87 delete arbVBO;
88 delete extFBO;
89}
90
91// =======================================================================
2bd4c032 92// function : MakeCurrent
93// purpose :
94// =======================================================================
95Standard_Boolean OpenGl_Context::MakeCurrent()
96{
97#if (defined(_WIN32) || defined(__WIN32__))
98 if (myWindowDC == NULL || myGContext == NULL ||
99 !wglMakeCurrent ((HDC )myWindowDC, (HGLRC )myGContext))
100 {
101 //GLenum anErrCode = glGetError();
102 //const GLubyte* anErrorString = gluErrorString (anErrCode);
103 //std::cerr << "wglMakeCurrent() failed: " << anErrCode << " " << anErrorString << "\n";
104 return Standard_False;
105 }
106#else
107 if (myDisplay == NULL || myWindow == 0 || myGContext == 0 ||
108 !glXMakeCurrent ((Display* )myDisplay, (GLXDrawable )myWindow, (GLXContext )myGContext))
109 {
110 // if there is no current context it might be impossible to use glGetError() correctly
111 //std::cerr << "glXMakeCurrent() failed!\n";
112 return Standard_False;
113 }
114#endif
115 return Standard_True;
116}
117
118// =======================================================================
5f8b738e 119// function : findProc
120// purpose :
121// =======================================================================
122void* OpenGl_Context::findProc (const char* theFuncName)
123{
124#if (defined(_WIN32) || defined(__WIN32__))
125 return wglGetProcAddress (theFuncName);
126#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
127 return (myGlLibHandle != NULL) ? dlsym (myGlLibHandle, theFuncName) : NULL;
128#else
129 return (void* )glXGetProcAddress ((const GLubyte* )theFuncName);
130#endif
2166f0fa
SK
131}
132
133// =======================================================================
134// function : CheckExtension
135// purpose :
136// =======================================================================
2bd4c032 137Standard_Boolean OpenGl_Context::CheckExtension (const char* theExtName) const
2166f0fa 138{
5f8b738e 139 if (theExtName == NULL)
140 {
141 std::cerr << "CheckExtension called with NULL string!\n";
142 return Standard_False;
143 }
144 int anExtNameLen = strlen (theExtName);
145
146 // available since OpenGL 3.0
147 // and the ONLY way to check extensions with OpenGL 3.1+ core profile
2bd4c032 148 /**if (IsGlGreaterEqual (3, 0))
5f8b738e 149 {
150 GLint anExtNb = 0;
151 glGetIntegerv (GL_NUM_EXTENSIONS, &anExtNb);
152 for (GLint anIter = 0; anIter < anExtNb; ++anIter)
153 {
154 const char* anExtension = (const char* )core30->glGetStringi (GL_EXTENSIONS, (GLuint )anIter);
155 if (anExtension[anExtNameLen] == '\0' &&
156 strncmp (anExtension, theExtName, anExtNameLen) == 0)
157 {
158 return Standard_True;
159 }
160 }
161 return Standard_False;
162 }*/
163
164 // use old way with huge string for all extensions
165 const char* anExtString = (const char* )glGetString (GL_EXTENSIONS);
166 if (anExtString == NULL)
167 {
168 std::cerr << "glGetString (GL_EXTENSIONS) returns NULL! No GL context?\n";
2166f0fa
SK
169 return Standard_False;
170 }
171
172 // Search for theExtName in the extensions string.
173 // Use of strstr() is not sufficient because extension names can be prefixes of other extension names.
5f8b738e 174 char* aPtrIter = (char* )anExtString;
175 const char* aPtrEnd = aPtrIter + strlen (anExtString);
2166f0fa
SK
176 while (aPtrIter < aPtrEnd)
177 {
178 int n = strcspn (aPtrIter, " ");
5f8b738e 179 if ((n == anExtNameLen) && (strncmp (aPtrIter, theExtName, anExtNameLen) == 0))
180 {
2166f0fa 181 return Standard_True;
5f8b738e 182 }
2166f0fa
SK
183 aPtrIter += (n + 1);
184 }
185 return Standard_False;
186}
187
188// =======================================================================
189// function : Init
190// purpose :
191// =======================================================================
192void OpenGl_Context::Init()
193{
2bd4c032 194 if (myIsInitialized)
5f8b738e 195 {
2bd4c032 196 return;
5f8b738e 197 }
2bd4c032 198
199#if (defined(_WIN32) || defined(__WIN32__))
200 myWindowDC = (Aspect_Handle )wglGetCurrentDC();
201 myGContext = (Aspect_RenderingContext )wglGetCurrentContext();
202#else
203 myDisplay = (Aspect_Display )glXGetCurrentDisplay();
204 myGContext = (Aspect_RenderingContext )glXGetCurrentContext();
205 myWindow = (Aspect_Drawable )glXGetCurrentDrawable();
206#endif
207
208 init();
209 myIsInitialized = Standard_True;
210}
211
212// =======================================================================
213// function : Init
214// purpose :
215// =======================================================================
216#if (defined(_WIN32) || defined(__WIN32__))
217void OpenGl_Context::Init (const Aspect_Handle theWindow,
218 const Aspect_Handle theWindowDC,
219 const Aspect_RenderingContext theGContext)
220#else
221void OpenGl_Context::Init (const Aspect_Drawable theWindow,
222 const Aspect_Display theDisplay,
223 const Aspect_RenderingContext theGContext)
224#endif
225{
226 Standard_ProgramError_Raise_if (myIsInitialized, "OpenGl_Context::Init() should be called only once!");
227
228 myWindow = theWindow;
229 myGContext = theGContext;
230#if (defined(_WIN32) || defined(__WIN32__))
231 myWindowDC = theWindowDC;
232#else
233 myDisplay = theDisplay;
234#endif
235
236 init();
237 myIsInitialized = Standard_True;
5f8b738e 238}
239
240// =======================================================================
241// function : ResetErrors
242// purpose :
243// =======================================================================
244void OpenGl_Context::ResetErrors()
245{
246 while (glGetError() != GL_NO_ERROR)
247 {
248 //
249 }
250}
251
252// =======================================================================
253// function : readGlVersion
254// purpose :
255// =======================================================================
256void OpenGl_Context::readGlVersion()
257{
258 // reset values
259 myGlVerMajor = 0;
260 myGlVerMinor = 0;
261
262 // available since OpenGL 3.0
263 GLint aMajor, aMinor;
264 glGetIntegerv (GL_MAJOR_VERSION, &aMajor);
265 glGetIntegerv (GL_MINOR_VERSION, &aMinor);
266 if (glGetError() == GL_NO_ERROR)
267 {
268 myGlVerMajor = aMajor;
269 myGlVerMinor = aMinor;
270 return;
271 }
272 ResetErrors();
273
274 // Read version string.
275 // Notice that only first two numbers splitted by point '2.1 XXXXX' are significant.
276 // Following trash (after space) is vendor-specific.
277 // New drivers also returns micro version of GL like '3.3.0' which has no meaning
278 // and should be considered as vendor-specific too.
279 const char* aVerStr = (const char* )glGetString (GL_VERSION);
280 if (aVerStr == NULL || *aVerStr == '\0')
281 {
282 // invalid GL context
283 return;
284 }
285
286 // parse string for major number
287 char aMajorStr[32];
288 char aMinorStr[32];
289 size_t aMajIter = 0;
290 while (aVerStr[aMajIter] >= '0' && aVerStr[aMajIter] <= '9')
291 {
292 ++aMajIter;
293 }
294 if (aMajIter == 0 || aMajIter >= sizeof(aMajorStr))
295 {
296 return;
297 }
298 memcpy (aMajorStr, aVerStr, aMajIter);
299 aMajorStr[aMajIter] = '\0';
300
301 // parse string for minor number
302 size_t aMinIter = aMajIter + 1;
303 while (aVerStr[aMinIter] >= '0' && aVerStr[aMinIter] <= '9')
304 {
305 ++aMinIter;
306 }
307 size_t aMinLen = aMinIter - aMajIter - 1;
308 if (aMinLen == 0 || aMinLen >= sizeof(aMinorStr))
309 {
310 return;
311 }
312 memcpy (aMinorStr, aVerStr, aMinLen);
313 aMinorStr[aMinLen] = '\0';
314
315 // read numbers
316 myGlVerMajor = atoi (aMajorStr);
317 myGlVerMinor = atoi (aMinorStr);
318
319 if (myGlVerMajor <= 0)
320 {
321 myGlVerMajor = 0;
322 myGlVerMinor = 0;
323 }
324}
325
326// =======================================================================
327// function : init
328// purpose :
329// =======================================================================
330void OpenGl_Context::init()
331{
332 // read version
333 readGlVersion();
334
335 // initialize VBO extension (ARB)
336 if (CheckExtension ("GL_ARB_vertex_buffer_object"))
2166f0fa
SK
337 {
338 arbVBO = new OpenGl_ArbVBO();
5f8b738e 339 memset (arbVBO, 0, sizeof(OpenGl_ArbVBO)); // nullify whole structure
340 if (!FindProcShort (arbVBO, glGenBuffersARB)
341 || !FindProcShort (arbVBO, glBindBufferARB)
342 || !FindProcShort (arbVBO, glBufferDataARB)
343 || !FindProcShort (arbVBO, glDeleteBuffersARB))
2166f0fa
SK
344 {
345 delete arbVBO;
346 arbVBO = NULL;
347 }
348 }
349
5f8b738e 350 // initialize FBO extension (EXT)
351 if (CheckExtension ("GL_EXT_framebuffer_object"))
2166f0fa
SK
352 {
353 extFBO = new OpenGl_ExtFBO();
5f8b738e 354 memset (extFBO, 0, sizeof(OpenGl_ExtFBO)); // nullify whole structure
355 if (!FindProcShort (extFBO, glGenFramebuffersEXT)
356 || !FindProcShort (extFBO, glDeleteFramebuffersEXT)
357 || !FindProcShort (extFBO, glBindFramebufferEXT)
358 || !FindProcShort (extFBO, glFramebufferTexture2DEXT)
359 || !FindProcShort (extFBO, glCheckFramebufferStatusEXT)
360 || !FindProcShort (extFBO, glGenRenderbuffersEXT)
361 || !FindProcShort (extFBO, glDeleteRenderbuffersEXT)
362 || !FindProcShort (extFBO, glBindRenderbufferEXT)
363 || !FindProcShort (extFBO, glRenderbufferStorageEXT)
364 || !FindProcShort (extFBO, glFramebufferRenderbufferEXT))
2166f0fa
SK
365 {
366 delete extFBO;
367 extFBO = NULL;
368 }
369 }
5f8b738e 370
371 myGlCore20 = new OpenGl_GlCore20();
372 memset (myGlCore20, 0, sizeof(OpenGl_GlCore20)); // nullify whole structure
373
374 // initialize OpenGL 1.2 core functionality
2bd4c032 375 if (IsGlGreaterEqual (1, 2))
5f8b738e 376 {
377 if (!FindProcShort (myGlCore20, glBlendColor)
378 || !FindProcShort (myGlCore20, glBlendEquation)
379 || !FindProcShort (myGlCore20, glDrawRangeElements)
380 || !FindProcShort (myGlCore20, glTexImage3D)
381 || !FindProcShort (myGlCore20, glTexSubImage3D)
382 || !FindProcShort (myGlCore20, glCopyTexSubImage3D))
383 {
384 myGlVerMajor = 1;
385 myGlVerMinor = 1;
386 }
387 }
388
389 // initialize OpenGL 1.3 core functionality
2bd4c032 390 if (IsGlGreaterEqual (1, 3))
5f8b738e 391 {
392 if (!FindProcShort (myGlCore20, glActiveTexture)
393 || !FindProcShort (myGlCore20, glSampleCoverage)
394 || !FindProcShort (myGlCore20, glCompressedTexImage3D)
395 || !FindProcShort (myGlCore20, glCompressedTexImage2D)
396 || !FindProcShort (myGlCore20, glCompressedTexImage1D)
397 || !FindProcShort (myGlCore20, glCompressedTexSubImage3D)
398 || !FindProcShort (myGlCore20, glCompressedTexSubImage2D)
399 || !FindProcShort (myGlCore20, glCompressedTexSubImage1D)
400 || !FindProcShort (myGlCore20, glGetCompressedTexImage)
401 // deprecated
402 || !FindProcShort (myGlCore20, glClientActiveTexture)
403 || !FindProcShort (myGlCore20, glMultiTexCoord1d)
404 || !FindProcShort (myGlCore20, glMultiTexCoord1dv)
405 || !FindProcShort (myGlCore20, glMultiTexCoord1f)
406 || !FindProcShort (myGlCore20, glMultiTexCoord1fv)
407 || !FindProcShort (myGlCore20, glMultiTexCoord1i)
408 || !FindProcShort (myGlCore20, glMultiTexCoord1iv)
409 || !FindProcShort (myGlCore20, glMultiTexCoord1s)
410 || !FindProcShort (myGlCore20, glMultiTexCoord1sv)
411 || !FindProcShort (myGlCore20, glMultiTexCoord2d)
412 || !FindProcShort (myGlCore20, glMultiTexCoord2dv)
413 || !FindProcShort (myGlCore20, glMultiTexCoord2f)
414 || !FindProcShort (myGlCore20, glMultiTexCoord2fv)
415 || !FindProcShort (myGlCore20, glMultiTexCoord2i)
416 || !FindProcShort (myGlCore20, glMultiTexCoord2iv)
417 || !FindProcShort (myGlCore20, glMultiTexCoord2s)
418 || !FindProcShort (myGlCore20, glMultiTexCoord2sv)
419 || !FindProcShort (myGlCore20, glMultiTexCoord3d)
420 || !FindProcShort (myGlCore20, glMultiTexCoord3dv)
421 || !FindProcShort (myGlCore20, glMultiTexCoord3f)
422 || !FindProcShort (myGlCore20, glMultiTexCoord3fv)
423 || !FindProcShort (myGlCore20, glMultiTexCoord3i)
424 || !FindProcShort (myGlCore20, glMultiTexCoord3iv)
425 || !FindProcShort (myGlCore20, glMultiTexCoord3s)
426 || !FindProcShort (myGlCore20, glMultiTexCoord3sv)
427 || !FindProcShort (myGlCore20, glMultiTexCoord4d)
428 || !FindProcShort (myGlCore20, glMultiTexCoord4dv)
429 || !FindProcShort (myGlCore20, glMultiTexCoord4f)
430 || !FindProcShort (myGlCore20, glMultiTexCoord4fv)
431 || !FindProcShort (myGlCore20, glMultiTexCoord4i)
432 || !FindProcShort (myGlCore20, glMultiTexCoord4iv)
433 || !FindProcShort (myGlCore20, glMultiTexCoord4s)
434 || !FindProcShort (myGlCore20, glMultiTexCoord4sv)
435 || !FindProcShort (myGlCore20, glLoadTransposeMatrixf)
436 || !FindProcShort (myGlCore20, glLoadTransposeMatrixd)
437 || !FindProcShort (myGlCore20, glMultTransposeMatrixf)
438 || !FindProcShort (myGlCore20, glMultTransposeMatrixd))
439 {
440 myGlVerMajor = 1;
441 myGlVerMinor = 2;
442 core12 = myGlCore20;
443 }
444 }
445
446 // initialize OpenGL 1.4 core functionality
2bd4c032 447 if (IsGlGreaterEqual (1, 4))
5f8b738e 448 {
449 if (!FindProcShort (myGlCore20, glBlendFuncSeparate)
450 || !FindProcShort (myGlCore20, glMultiDrawArrays)
451 || !FindProcShort (myGlCore20, glMultiDrawElements)
452 || !FindProcShort (myGlCore20, glPointParameterf)
453 || !FindProcShort (myGlCore20, glPointParameterfv)
454 || !FindProcShort (myGlCore20, glPointParameteri)
455 || !FindProcShort (myGlCore20, glPointParameteriv))
456 {
457 myGlVerMajor = 1;
458 myGlVerMinor = 3;
459 core12 = myGlCore20;
460 core13 = myGlCore20;
461 }
462 }
463
464 // initialize OpenGL 1.5 core functionality
2bd4c032 465 if (IsGlGreaterEqual (1, 5))
5f8b738e 466 {
467 if (!FindProcShort (myGlCore20, glGenQueries)
468 || !FindProcShort (myGlCore20, glDeleteQueries)
469 || !FindProcShort (myGlCore20, glIsQuery)
470 || !FindProcShort (myGlCore20, glBeginQuery)
471 || !FindProcShort (myGlCore20, glEndQuery)
472 || !FindProcShort (myGlCore20, glGetQueryiv)
473 || !FindProcShort (myGlCore20, glGetQueryObjectiv)
474 || !FindProcShort (myGlCore20, glGetQueryObjectuiv)
475 || !FindProcShort (myGlCore20, glBindBuffer)
476 || !FindProcShort (myGlCore20, glDeleteBuffers)
477 || !FindProcShort (myGlCore20, glGenBuffers)
478 || !FindProcShort (myGlCore20, glIsBuffer)
479 || !FindProcShort (myGlCore20, glBufferData)
480 || !FindProcShort (myGlCore20, glBufferSubData)
481 || !FindProcShort (myGlCore20, glGetBufferSubData)
482 || !FindProcShort (myGlCore20, glMapBuffer)
483 || !FindProcShort (myGlCore20, glUnmapBuffer)
484 || !FindProcShort (myGlCore20, glGetBufferParameteriv)
485 || !FindProcShort (myGlCore20, glGetBufferPointerv))
486 {
487 myGlVerMajor = 1;
488 myGlVerMinor = 4;
489 core12 = myGlCore20;
490 core13 = myGlCore20;
491 core14 = myGlCore20;
492 }
493 }
494
495 // initialize OpenGL 2.0 core functionality
2bd4c032 496 if (IsGlGreaterEqual (2, 0))
5f8b738e 497 {
498 if (!FindProcShort (myGlCore20, glBlendEquationSeparate)
499 || !FindProcShort (myGlCore20, glDrawBuffers)
500 || !FindProcShort (myGlCore20, glStencilOpSeparate)
501 || !FindProcShort (myGlCore20, glStencilFuncSeparate)
502 || !FindProcShort (myGlCore20, glStencilMaskSeparate)
503 || !FindProcShort (myGlCore20, glAttachShader)
504 || !FindProcShort (myGlCore20, glBindAttribLocation)
505 || !FindProcShort (myGlCore20, glCompileShader)
506 || !FindProcShort (myGlCore20, glCreateProgram)
507 || !FindProcShort (myGlCore20, glCreateShader)
508 || !FindProcShort (myGlCore20, glDeleteProgram)
509 || !FindProcShort (myGlCore20, glDeleteShader)
510 || !FindProcShort (myGlCore20, glDetachShader)
511 || !FindProcShort (myGlCore20, glDisableVertexAttribArray)
512 || !FindProcShort (myGlCore20, glEnableVertexAttribArray)
513 || !FindProcShort (myGlCore20, glGetActiveAttrib)
514 || !FindProcShort (myGlCore20, glGetActiveUniform)
515 || !FindProcShort (myGlCore20, glGetAttachedShaders)
516 || !FindProcShort (myGlCore20, glGetAttribLocation)
517 || !FindProcShort (myGlCore20, glGetProgramiv)
518 || !FindProcShort (myGlCore20, glGetProgramInfoLog)
519 || !FindProcShort (myGlCore20, glGetShaderiv)
520 || !FindProcShort (myGlCore20, glGetShaderInfoLog)
521 || !FindProcShort (myGlCore20, glGetShaderSource)
522 || !FindProcShort (myGlCore20, glGetUniformLocation)
523 || !FindProcShort (myGlCore20, glGetUniformfv)
524 || !FindProcShort (myGlCore20, glGetUniformiv)
525 || !FindProcShort (myGlCore20, glGetVertexAttribdv)
526 || !FindProcShort (myGlCore20, glGetVertexAttribfv)
527 || !FindProcShort (myGlCore20, glGetVertexAttribiv)
528 || !FindProcShort (myGlCore20, glGetVertexAttribPointerv)
529 || !FindProcShort (myGlCore20, glIsProgram)
530 || !FindProcShort (myGlCore20, glIsShader)
531 || !FindProcShort (myGlCore20, glLinkProgram)
532 || !FindProcShort (myGlCore20, glShaderSource)
533 || !FindProcShort (myGlCore20, glUseProgram)
534 || !FindProcShort (myGlCore20, glUniform1f)
535 || !FindProcShort (myGlCore20, glUniform2f)
536 || !FindProcShort (myGlCore20, glUniform3f)
537 || !FindProcShort (myGlCore20, glUniform4f)
538 || !FindProcShort (myGlCore20, glUniform1i)
539 || !FindProcShort (myGlCore20, glUniform2i)
540 || !FindProcShort (myGlCore20, glUniform3i)
541 || !FindProcShort (myGlCore20, glUniform4i)
542 || !FindProcShort (myGlCore20, glUniform1fv)
543 || !FindProcShort (myGlCore20, glUniform2fv)
544 || !FindProcShort (myGlCore20, glUniform3fv)
545 || !FindProcShort (myGlCore20, glUniform4fv)
546 || !FindProcShort (myGlCore20, glUniform1iv)
547 || !FindProcShort (myGlCore20, glUniform2iv)
548 || !FindProcShort (myGlCore20, glUniform3iv)
549 || !FindProcShort (myGlCore20, glUniform4iv)
550 || !FindProcShort (myGlCore20, glUniformMatrix2fv)
551 || !FindProcShort (myGlCore20, glUniformMatrix3fv)
552 || !FindProcShort (myGlCore20, glUniformMatrix4fv)
553 || !FindProcShort (myGlCore20, glValidateProgram)
554 || !FindProcShort (myGlCore20, glVertexAttrib1d)
555 || !FindProcShort (myGlCore20, glVertexAttrib1dv)
556 || !FindProcShort (myGlCore20, glVertexAttrib1f)
557 || !FindProcShort (myGlCore20, glVertexAttrib1fv)
558 || !FindProcShort (myGlCore20, glVertexAttrib1s)
559 || !FindProcShort (myGlCore20, glVertexAttrib1sv)
560 || !FindProcShort (myGlCore20, glVertexAttrib2d)
561 || !FindProcShort (myGlCore20, glVertexAttrib2dv)
562 || !FindProcShort (myGlCore20, glVertexAttrib2f)
563 || !FindProcShort (myGlCore20, glVertexAttrib2fv)
564 || !FindProcShort (myGlCore20, glVertexAttrib2s)
565 || !FindProcShort (myGlCore20, glVertexAttrib2sv)
566 || !FindProcShort (myGlCore20, glVertexAttrib3d)
567 || !FindProcShort (myGlCore20, glVertexAttrib3dv)
568 || !FindProcShort (myGlCore20, glVertexAttrib3f)
569 || !FindProcShort (myGlCore20, glVertexAttrib3fv)
570 || !FindProcShort (myGlCore20, glVertexAttrib3s)
571 || !FindProcShort (myGlCore20, glVertexAttrib3sv)
572 || !FindProcShort (myGlCore20, glVertexAttrib4Nbv)
573 || !FindProcShort (myGlCore20, glVertexAttrib4Niv)
574 || !FindProcShort (myGlCore20, glVertexAttrib4Nsv)
575 || !FindProcShort (myGlCore20, glVertexAttrib4Nub)
576 || !FindProcShort (myGlCore20, glVertexAttrib4Nubv)
577 || !FindProcShort (myGlCore20, glVertexAttrib4Nuiv)
578 || !FindProcShort (myGlCore20, glVertexAttrib4Nusv)
579 || !FindProcShort (myGlCore20, glVertexAttrib4bv)
580 || !FindProcShort (myGlCore20, glVertexAttrib4d)
581 || !FindProcShort (myGlCore20, glVertexAttrib4dv)
582 || !FindProcShort (myGlCore20, glVertexAttrib4f)
583 || !FindProcShort (myGlCore20, glVertexAttrib4fv)
584 || !FindProcShort (myGlCore20, glVertexAttrib4iv)
585 || !FindProcShort (myGlCore20, glVertexAttrib4s)
586 || !FindProcShort (myGlCore20, glVertexAttrib4sv)
587 || !FindProcShort (myGlCore20, glVertexAttrib4ubv)
588 || !FindProcShort (myGlCore20, glVertexAttrib4uiv)
589 || !FindProcShort (myGlCore20, glVertexAttrib4usv)
590 || !FindProcShort (myGlCore20, glVertexAttribPointer))
591 {
592 myGlVerMajor = 1;
593 myGlVerMinor = 5;
594 core12 = myGlCore20;
595 core13 = myGlCore20;
596 core14 = myGlCore20;
597 core15 = myGlCore20;
598 }
599 }
600
2bd4c032 601 if (IsGlGreaterEqual (2, 0))
5f8b738e 602 {
603 core12 = myGlCore20;
604 core13 = myGlCore20;
605 core14 = myGlCore20;
606 core15 = myGlCore20;
607 core20 = myGlCore20;
608 }
2166f0fa 609}
664cae74 610
611// =======================================================================
612// function : IsFeedback
613// purpose :
614// =======================================================================
615Standard_Boolean OpenGl_Context::IsFeedback() const
616{
617 return myIsFeedback;
618}
619
620// =======================================================================
621// function : SetFeedback
622// purpose :
623// =======================================================================
624void OpenGl_Context::SetFeedback (const Standard_Boolean theFeedbackOn)
625{
626 myIsFeedback = theFeedbackOn;
627}