1 // Created on: 2011-07-13
2 // Created by: Sergey ZERCHANINOV
3 // Copyright (c) 2011-2013 OPEN CASCADE SAS
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.
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.
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.
20 #include <OpenGl_IndexBuffer.hxx>
21 #include <OpenGl_Context.hxx>
23 #include <OpenGl_PrimitiveArray.hxx>
25 #include <OpenGl_AspectFace.hxx>
26 #include <OpenGl_GraphicDriver.hxx>
27 #include <OpenGl_PointSprite.hxx>
28 #include <OpenGl_Structure.hxx>
29 #include <OpenGl_Workspace.hxx>
31 #include <InterfaceGraphic_PrimitiveArray.hxx>
33 // =======================================================================
34 // function : clearMemoryOwn
36 // =======================================================================
37 void OpenGl_PrimitiveArray::clearMemoryOwn() const
39 Standard::Free ((Standard_Address& )myPArray->edges);
40 Standard::Free ((Standard_Address& )myPArray->vertices);
41 Standard::Free ((Standard_Address& )myPArray->vcolours);
42 Standard::Free ((Standard_Address& )myPArray->vnormals);
43 Standard::Free ((Standard_Address& )myPArray->vtexels);
44 Standard::Free ((Standard_Address& )myPArray->edge_vis); /// ???
46 myPArray->edges = NULL;
47 myPArray->vertices = NULL;
48 myPArray->vcolours = NULL;
49 myPArray->vnormals = NULL;
50 myPArray->vtexels = NULL;
51 myPArray->edge_vis = NULL;
54 // =======================================================================
55 // function : clearMemoryGL
57 // =======================================================================
58 void OpenGl_PrimitiveArray::clearMemoryGL (const Handle(OpenGl_Context)& theGlCtx) const
60 for (Standard_Integer anIter = 0; anIter < VBOMaxType; ++anIter)
62 if (!myVbos[anIter].IsNull())
64 myVbos[anIter]->Release (theGlCtx.operator->());
65 myVbos[anIter].Nullify();
70 // =======================================================================
71 // function : BuildVBO
73 // =======================================================================
74 Standard_Boolean OpenGl_PrimitiveArray::BuildVBO (const Handle(OpenGl_Workspace)& theWorkspace) const
76 const Handle(OpenGl_Context)& aGlCtx = theWorkspace->GetGlContext();
77 if (myPArray->vertices == NULL)
79 // vertices should be always defined - others are optional
80 return Standard_False;
82 myVbos[VBOVertices] = new OpenGl_VertexBuffer();
83 if (!myVbos[VBOVertices]->Init (aGlCtx, 3, myPArray->num_vertexs, &myPArray->vertices[0].xyz[0]))
85 clearMemoryGL (aGlCtx);
86 return Standard_False;
89 if (myPArray->edges != NULL
90 && myPArray->num_edges > 0)
92 myVbos[VBOEdges] = new OpenGl_IndexBuffer();
93 if (!myVbos[VBOEdges]->Init (aGlCtx, 1, myPArray->num_edges, (GLuint* )myPArray->edges))
95 clearMemoryGL (aGlCtx);
96 return Standard_False;
99 if (myPArray->vcolours != NULL)
101 myVbos[VBOVcolours] = new OpenGl_VertexBuffer();
102 if (!myVbos[VBOVcolours]->Init (aGlCtx, 4, myPArray->num_vertexs, (GLubyte* )myPArray->vcolours))
104 clearMemoryGL (aGlCtx);
105 return Standard_False;
108 if (myPArray->vnormals != NULL)
110 myVbos[VBOVnormals] = new OpenGl_VertexBuffer();
111 if (!myVbos[VBOVnormals]->Init (aGlCtx, 3, myPArray->num_vertexs, &myPArray->vnormals[0].xyz[0]))
113 clearMemoryGL (aGlCtx);
114 return Standard_False;
117 if (myPArray->vtexels)
119 myVbos[VBOVtexels] = new OpenGl_VertexBuffer();
120 if (!myVbos[VBOVtexels]->Init (aGlCtx, 2, myPArray->num_vertexs, &myPArray->vtexels[0].xy[0]))
122 clearMemoryGL (aGlCtx);
123 return Standard_False;
128 return Standard_True;
131 // =======================================================================
132 // function : DrawArray
134 // =======================================================================
135 void OpenGl_PrimitiveArray::DrawArray (Tint theLightingModel,
136 const Aspect_InteriorStyle theInteriorStyle,
138 const TEL_COLOUR* theInteriorColour,
139 const TEL_COLOUR* theLineColour,
140 const TEL_COLOUR* theEdgeColour,
141 const OPENGL_SURF_PROP* theFaceProp,
142 const Handle(OpenGl_Workspace)& theWorkspace) const
144 const Handle(OpenGl_Context)& aGlContext = theWorkspace->GetGlContext();
148 // Following pointers have been provided for performance improvement
149 tel_colour pfc = myPArray->fcolours;
150 Tint* pvc = myPArray->vcolours;
153 for (i = 0; i < myPArray->num_vertexs; ++i)
155 transp = int(theFaceProp->trans * 255.0f);
156 #if defined (sparc) || defined (__sparc__) || defined (__sparc)
157 pvc[i] = (pvc[i] & 0xffffff00);
160 pvc[i] = (pvc[i] & 0x00ffffff);
161 pvc[i] += transp << 24;
166 switch (myPArray->type)
168 case TelPointsArrayType:
169 case TelPolylinesArrayType:
170 case TelSegmentsArrayType:
171 glColor3fv (theLineColour->rgb);
173 case TelPolygonsArrayType:
174 case TelTrianglesArrayType:
175 case TelQuadranglesArrayType:
176 case TelTriangleStripsArrayType:
177 case TelQuadrangleStripsArrayType:
178 case TelTriangleFansArrayType:
179 glColor3fv (theInteriorColour->rgb);
183 // Temporarily disable environment mapping
184 if (myDrawMode <= GL_LINE_STRIP)
186 glPushAttrib (GL_ENABLE_BIT);
187 glDisable (GL_TEXTURE_1D);
188 glDisable (GL_TEXTURE_2D);
191 if ((myDrawMode > GL_LINE_STRIP && theInteriorStyle != Aspect_IS_EMPTY) ||
192 (myDrawMode <= GL_LINE_STRIP))
194 if (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)
200 if (theInteriorStyle == Aspect_IS_HIDDENLINE)
207 // Sometimes the GL_LIGHTING mode is activated here
208 // without glEnable(GL_LIGHTING) call for an unknown reason, so it is necessary
209 // to call glEnable(GL_LIGHTING) to synchronize Light On/Off mechanism*
210 if (theLightingModel == 0 || myDrawMode <= GL_LINE_STRIP)
211 glDisable (GL_LIGHTING);
213 glEnable (GL_LIGHTING);
217 if (myPArray->vertices != NULL)
219 glVertexPointer (3, GL_FLOAT, 0, myPArray->vertices); // array of vertices
220 glEnableClientState (GL_VERTEX_ARRAY);
222 if (myPArray->vnormals != NULL)
224 glNormalPointer (GL_FLOAT, 0, myPArray->vnormals); // array of normals
225 glEnableClientState (GL_NORMAL_ARRAY);
227 if (myPArray->vtexels != NULL)
229 glTexCoordPointer (2, GL_FLOAT, 0, myPArray->vtexels); // array of texture coordinates
230 glEnableClientState (GL_TEXTURE_COORD_ARRAY);
233 if ((pvc != NULL) && (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) == 0)
235 glColorPointer (4, GL_UNSIGNED_BYTE, 0, pvc); // array of colors
236 glEnableClientState (GL_COLOR_ARRAY);
237 glColorMaterial (GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE);
238 glEnable (GL_COLOR_MATERIAL);
243 // Bindings concrete pointer in accordance with VBO buffer
244 myVbos[VBOVertices]->BindFixed (aGlContext, GL_VERTEX_ARRAY);
245 if (!myVbos[VBOVnormals].IsNull())
247 myVbos[VBOVnormals]->BindFixed (aGlContext, GL_NORMAL_ARRAY);
249 if (!myVbos[VBOVtexels].IsNull() && (theWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0)
251 myVbos[VBOVtexels]->BindFixed (aGlContext, GL_TEXTURE_COORD_ARRAY);
253 if (!myVbos[VBOVcolours].IsNull() && (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) == 0)
255 myVbos[VBOVcolours]->BindFixed (aGlContext, GL_COLOR_ARRAY);
256 glColorMaterial (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
257 glEnable (GL_COLOR_MATERIAL);
261 /// OCC22236 NOTE: draw for all situations:
262 /// 1) draw elements from myPArray->bufferVBO[VBOEdges] indicies array
263 /// 2) draw elements from vertice array, when bounds defines count of primitive's verts.
264 /// 3) draw primitive by vertexes if no edges and bounds array is specified
267 if (!myVbos[VBOEdges].IsNull())
269 myVbos[VBOEdges]->Bind (aGlContext);
270 if (myPArray->num_bounds > 0)
272 // draw primitives by vertex count with the indicies
273 Tint* anOffset = NULL;
274 for (i = 0; i < myPArray->num_bounds; ++i)
276 if (pfc != NULL) glColor3fv (pfc[i].rgb);
277 glDrawElements (myDrawMode, myPArray->bounds[i], myVbos[VBOEdges]->GetDataType(), anOffset);
278 anOffset += myPArray->bounds[i];
283 // draw one (or sequential) primitive by the indicies
284 glDrawElements (myDrawMode, myPArray->num_edges, myVbos[VBOEdges]->GetDataType(), NULL);
286 myVbos[VBOEdges]->Unbind (aGlContext);
288 else if (myPArray->num_bounds > 0)
290 for (i = n = 0; i < myPArray->num_bounds; ++i)
292 if (pfc != NULL) glColor3fv (pfc[i].rgb);
293 glDrawArrays (myDrawMode, n, myPArray->bounds[i]);
294 n += myPArray->bounds[i];
299 if (myDrawMode == GL_POINTS)
301 DrawMarkers (theWorkspace);
305 glDrawArrays (myDrawMode, 0, myVbos[VBOVertices]->GetElemsNb());
310 myVbos[VBOVertices]->UnbindFixed (aGlContext, GL_VERTEX_ARRAY);
311 if (!myVbos[VBOVnormals].IsNull())
313 myVbos[VBOVnormals]->UnbindFixed (aGlContext, GL_NORMAL_ARRAY);
315 if (!myVbos[VBOVtexels].IsNull() && (theWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0)
317 myVbos[VBOVtexels]->UnbindFixed (aGlContext, GL_TEXTURE_COORD_ARRAY);
319 if (!myVbos[VBOVcolours].IsNull())
321 myVbos[VBOVcolours]->UnbindFixed (aGlContext, GL_COLOR_ARRAY);
322 glDisable (GL_COLOR_MATERIAL);
323 theWorkspace->NamedStatus |= OPENGL_NS_RESMAT; // Reset material
328 if (myPArray->num_bounds > 0)
330 if (myPArray->num_edges > 0)
332 for (i = n = 0; i < myPArray->num_bounds; ++i)
334 if (pfc != NULL) glColor3fv (pfc[i].rgb);
335 glDrawElements (myDrawMode, myPArray->bounds[i], GL_UNSIGNED_INT, (GLenum* )&myPArray->edges[n]);
336 n += myPArray->bounds[i];
341 for (i = n = 0; i < myPArray->num_bounds; ++i)
343 if (pfc != NULL) glColor3fv (pfc[i].rgb);
344 glDrawArrays (myDrawMode, n, myPArray->bounds[i]);
345 n += myPArray->bounds[i];
349 else if (myPArray->num_edges > 0)
351 glDrawElements (myDrawMode, myPArray->num_edges, GL_UNSIGNED_INT, (GLenum* )myPArray->edges);
355 if (myDrawMode == GL_POINTS)
357 DrawMarkers (theWorkspace);
361 glDrawArrays (myDrawMode, 0, myPArray->num_vertexs);
367 glDisable (GL_COLOR_MATERIAL);
368 theWorkspace->NamedStatus |= OPENGL_NS_RESMAT; // Reset material
371 glDisableClientState (GL_VERTEX_ARRAY);
372 if (myPArray->vcolours != NULL)
373 glDisableClientState (GL_COLOR_ARRAY);
374 if (myPArray->vnormals != NULL)
375 glDisableClientState (GL_NORMAL_ARRAY);
376 if (myPArray->vtexels != NULL)
377 glDisableClientState (GL_TEXTURE_COORD_ARRAY);
381 // On some NVIDIA graphic cards, using glEdgeFlagPointer() in
382 // combination with VBO (edge flag data put into a VBO buffer)
383 // leads to a crash in a driver. Therefore, edge flags are simply
384 // igonored when VBOs are enabled, so all the edges are drawn if
385 // edge visibility is turned on. In order to draw edges selectively,
386 // either disable VBO or turn off edge visibilty in the current
387 // primitive array and create a separate primitive array (segments)
388 // and put edges to be drawn into it.
389 if (theEdgeFlag && myDrawMode > GL_LINE_STRIP)
391 DrawEdges (theEdgeColour, theWorkspace);
394 if (myDrawMode <= GL_LINE_STRIP)
398 // =======================================================================
399 // function : DrawEdges
401 // =======================================================================
402 void OpenGl_PrimitiveArray::DrawEdges (const TEL_COLOUR* theEdgeColour,
403 const Handle(OpenGl_Workspace)& theWorkspace) const
405 glDisable (GL_LIGHTING);
407 const Handle(OpenGl_Context)& aGlContext = theWorkspace->GetGlContext();
408 const OpenGl_AspectLine* anAspectLineOld = NULL;
409 if (myDrawMode > GL_LINE_STRIP)
411 anAspectLineOld = theWorkspace->SetAspectLine (theWorkspace->AspectFace (Standard_True)->AspectEdge());
412 theWorkspace->AspectLine (Standard_True);
414 glPushAttrib (GL_POLYGON_BIT);
415 glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
420 /// OCC22236 NOTE: draw edges for all situations:
421 /// 1) draw elements with GL_LINE style as edges from myPArray->bufferVBO[VBOEdges] indicies array
422 /// 2) draw elements from vertice array, when bounds defines count of primitive's verts.
423 /// 3) draw primitive's edges by vertexes if no edges and bounds array is specified
426 myVbos[VBOVertices]->BindFixed (aGlContext, GL_VERTEX_ARRAY);
427 glColor3fv (theEdgeColour->rgb);
428 if (!myVbos[VBOEdges].IsNull())
430 myVbos[VBOEdges]->Bind (aGlContext);
432 // draw primitives by vertex count with the indicies
433 if (myPArray->num_bounds > 0)
436 for (i = 0, offset = 0; i < myPArray->num_bounds; ++i)
438 glDrawElements (myDrawMode, myPArray->bounds[i], myVbos[VBOEdges]->GetDataType(), offset);
439 offset += myPArray->bounds[i];
442 // draw one (or sequential) primitive by the indicies
445 glDrawElements (myDrawMode, myVbos[VBOEdges]->GetElemsNb(), myVbos[VBOEdges]->GetDataType(), NULL);
447 myVbos[VBOEdges]->Unbind (aGlContext);
449 else if (myPArray->num_bounds > 0)
451 for (i = n = 0; i < myPArray->num_bounds; ++i)
453 glDrawArrays (myDrawMode, n, myPArray->bounds[i]);
454 n += myPArray->bounds[i];
459 glDrawArrays (myDrawMode, 0, myPArray->num_vertexs);
463 myVbos[VBOVertices]->UnbindFixed (aGlContext, GL_VERTEX_ARRAY);
467 glEnableClientState (GL_VERTEX_ARRAY);
468 glVertexPointer (3, GL_FLOAT, 0, myPArray->vertices); // array of vertices
470 glColor3fv (theEdgeColour->rgb);
471 if (myPArray->num_bounds > 0)
473 if (myPArray->num_edges > 0)
475 for (i = n = 0; i < myPArray->num_bounds; ++i)
477 if (myPArray->edge_vis)
479 glBegin (myDrawMode);
480 for (j = 0; j < myPArray->bounds[i]; ++j)
482 glEdgeFlag (myPArray->edge_vis[n+j]);
483 glVertex3fv (&myPArray->vertices[myPArray->edges[n+j]].xyz[0]);
489 glDrawElements (myDrawMode, myPArray->bounds[i], GL_UNSIGNED_INT, (GLenum* )&myPArray->edges[n]);
491 n += myPArray->bounds[i];
496 for (i = n = 0 ; i < myPArray->num_bounds; ++i)
498 glDrawArrays (myDrawMode, n, myPArray->bounds[i]);
499 n += myPArray->bounds[i];
503 else if (myPArray->num_edges > 0)
505 if (myPArray->edge_vis)
507 glBegin (myDrawMode);
508 for (i = 0; i < myPArray->num_edges; ++i)
510 glEdgeFlag (myPArray->edge_vis[i]);
511 glVertex3fv (&myPArray->vertices[myPArray->edges[i]].xyz[0]);
517 glDrawElements (myDrawMode, myPArray->num_edges, GL_UNSIGNED_INT, (GLenum* )myPArray->edges);
522 glDrawArrays (myDrawMode, 0, myPArray->num_vertexs);
526 if (myDrawMode > GL_LINE_STRIP)
528 // Restore line context
529 theWorkspace->SetAspectLine (anAspectLineOld);
534 // =======================================================================
535 // function : DrawMarkers
537 // =======================================================================
538 void OpenGl_PrimitiveArray::DrawMarkers (const Handle(OpenGl_Workspace)& theWorkspace) const
540 const OpenGl_AspectMarker* anAspectMarker = theWorkspace->AspectMarker (Standard_True);
541 const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
542 const Handle(OpenGl_PointSprite)& aSpriteNorm = anAspectMarker->Sprite(theWorkspace);
543 const Standard_Boolean isHilight = (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT);
544 if (aCtx->IsGlGreaterEqual (2, 0)
545 && !aSpriteNorm.IsNull() && !aSpriteNorm->IsDisplayList())
547 // Textured markers will be drawn with the point sprites
548 glPointSize (anAspectMarker->MarkerSize());
550 Handle(OpenGl_Texture) aTextureBack;
551 if (anAspectMarker->Type() != Aspect_TOM_POINT)
553 const Handle(OpenGl_PointSprite)& aSprite = (isHilight && anAspectMarker->SpriteHighlight(theWorkspace)->IsValid())
554 ? anAspectMarker->SpriteHighlight(theWorkspace)
556 aTextureBack = theWorkspace->EnableTexture (aSprite);
558 glEnable (GL_ALPHA_TEST);
559 glAlphaFunc (GL_GEQUAL, 0.1f);
562 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
565 glDrawArrays (myDrawMode, 0, toDrawVbo() ? myVbos[VBOVertices]->GetElemsNb() : myPArray->num_vertexs);
567 glDisable (GL_BLEND);
568 glDisable (GL_ALPHA_TEST);
569 if (anAspectMarker->Type() != Aspect_TOM_POINT)
571 theWorkspace->EnableTexture (aTextureBack);
577 // Textured markers will be drawn with the glBitmap
578 if (anAspectMarker->Type() == Aspect_TOM_POINT
579 || anAspectMarker->Type() == Aspect_TOM_O_POINT)
581 const GLfloat aPntSize = anAspectMarker->Type() == Aspect_TOM_POINT
582 ? anAspectMarker->MarkerSize()
586 glPointSize (aPntSize);
588 glDrawArrays (myDrawMode, 0, toDrawVbo() ? myVbos[VBOVertices]->GetElemsNb() : myPArray->num_vertexs);
595 if (anAspectMarker->Type() != Aspect_TOM_POINT
596 && !aSpriteNorm.IsNull())
598 if (!isHilight && (myPArray->vcolours != NULL))
600 for (Standard_Integer anIter = 0; anIter < myPArray->num_vertexs; anIter++)
602 glColor4ubv ((GLubyte* )&myPArray->vcolours[anIter]);
603 glRasterPos3fv (myPArray->vertices[anIter].xyz);
604 aSpriteNorm->DrawBitmap (theWorkspace->GetGlContext());
609 for (Standard_Integer anIter = 0; anIter < myPArray->num_vertexs; anIter++)
611 glRasterPos3fv (myPArray->vertices[anIter].xyz);
612 aSpriteNorm->DrawBitmap (theWorkspace->GetGlContext());
618 // =======================================================================
619 // function : OpenGl_PrimitiveArray
621 // =======================================================================
622 OpenGl_PrimitiveArray::OpenGl_PrimitiveArray (CALL_DEF_PARRAY* thePArray)
623 : myPArray (thePArray),
624 myDrawMode (DRAW_MODE_NONE),
625 myIsVboInit (Standard_False)
627 switch (myPArray->type)
629 case TelPointsArrayType:
630 myDrawMode = GL_POINTS;
632 case TelPolylinesArrayType:
633 myDrawMode = GL_LINE_STRIP;
635 case TelSegmentsArrayType:
636 myDrawMode = GL_LINES;
638 case TelPolygonsArrayType:
639 myDrawMode = GL_POLYGON;
641 case TelTrianglesArrayType:
642 myDrawMode = GL_TRIANGLES;
644 case TelQuadranglesArrayType:
645 myDrawMode = GL_QUADS;
647 case TelTriangleStripsArrayType:
648 myDrawMode = GL_TRIANGLE_STRIP;
650 case TelQuadrangleStripsArrayType:
651 myDrawMode = GL_QUAD_STRIP;
653 case TelTriangleFansArrayType:
654 myDrawMode = GL_TRIANGLE_FAN;
659 // =======================================================================
660 // function : ~OpenGl_PrimitiveArray
662 // =======================================================================
663 OpenGl_PrimitiveArray::~OpenGl_PrimitiveArray()
668 // =======================================================================
669 // function : Release
671 // =======================================================================
672 void OpenGl_PrimitiveArray::Release (const Handle(OpenGl_Context)& theContext)
674 for (Standard_Integer anIter = 0; anIter < VBOMaxType; ++anIter)
676 if (!myVbos[anIter].IsNull())
678 if (!theContext.IsNull())
680 theContext->DelayedRelease (myVbos[anIter]);
682 myVbos[anIter].Nullify();
687 // =======================================================================
690 // =======================================================================
691 void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
693 if (myPArray == NULL || myDrawMode == DRAW_MODE_NONE || myPArray->num_vertexs <= 0)
698 const OpenGl_AspectFace* anAspectFace = theWorkspace->AspectFace (Standard_True);
699 const OpenGl_AspectLine* anAspectLine = theWorkspace->AspectLine (Standard_True);
700 const OpenGl_AspectMarker* anAspectMarker = theWorkspace->AspectMarker (myDrawMode == GL_POINTS);
702 // create VBOs on first render call
703 const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
705 && !aCtx->caps->vboDisable
706 && aCtx->core15 != NULL
707 && (myDrawMode != GL_POINTS || anAspectMarker->Sprite(theWorkspace).IsNull() || !anAspectMarker->Sprite(theWorkspace)->IsDisplayList()))
709 if (!BuildVBO (theWorkspace))
711 TCollection_ExtendedString aMsg;
712 aMsg += "VBO creation for Primitive Array has failed for ";
713 aMsg += myPArray->num_vertexs;
714 aMsg += " vertices. Out of memory?";
715 aCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION_ARB, GL_DEBUG_TYPE_PERFORMANCE_ARB, 0, GL_DEBUG_SEVERITY_LOW_ARB, aMsg);
717 myIsVboInit = Standard_True;
720 switch (myPArray->type)
722 case TelPointsArrayType:
723 case TelPolylinesArrayType:
724 case TelSegmentsArrayType:
726 glDisable (GL_LIGHTING);
733 Tint aFrontLightingModel = anAspectFace->IntFront().color_mask;
734 const TEL_COLOUR* anInteriorColor = &anAspectFace->IntFront().matcol;
735 const TEL_COLOUR* anEdgeColor = &anAspectFace->AspectEdge()->Color();
736 const TEL_COLOUR* aLineColor = (myPArray->type == TelPointsArrayType) ? &anAspectMarker->Color() : &anAspectLine->Color();
738 // Use highlight colors
739 if (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)
741 anEdgeColor = anInteriorColor = aLineColor = theWorkspace->HighlightColor;
742 aFrontLightingModel = 0;
745 DrawArray (aFrontLightingModel,
746 anAspectFace->InteriorStyle(),
747 anAspectFace->Edge(),
751 &anAspectFace->IntFront(),