0026122: Visualization, TKOpenGl - clipping and capping is broken when ffp is disable...
[occt.git] / src / OpenGl / OpenGl_PrimitiveArray.cxx
index ccf176c..c976732 100644 (file)
 
 namespace
 {
-  //! Convert index data type from size
-  inline GLenum toGlIndexType (const Standard_Integer theStride)
-  {
-    switch (theStride)
-    {
-      case 2:  return GL_UNSIGNED_SHORT;
-      case 4:  return GL_UNSIGNED_INT;
-      default: return GL_NONE;
-    }
-  }
-
   //! Convert data type to GL info
   inline GLenum toGlDataType (const Graphic3d_TypeOfData theType,
                               GLint&                     theNbComp)
@@ -795,15 +784,22 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace
         }
         default:
         {
+          const Handle(OpenGl_Texture)& aTexture = theWorkspace->ActiveTexture();
           const Standard_Boolean isLightOnFace = isLightOn
-                                              && (theWorkspace->ActiveTexture().IsNull()
-                                               || theWorkspace->ActiveTexture()->GetParams()->IsModulate());
-          aCtx->ShaderManager()->BindProgram (anAspectFace, theWorkspace->ActiveTexture(), isLightOnFace, hasVertColor, anAspectFace->ShaderProgramRes (aCtx));
+                                              && (aTexture.IsNull()
+                                               || aTexture->GetParams()->IsModulate());
+          aCtx->ShaderManager()->BindProgram (anAspectFace, aTexture, isLightOnFace, hasVertColor, anAspectFace->ShaderProgramRes (aCtx));
           break;
         }
       }
     }
 
+    if (!theWorkspace->ActiveTexture().IsNull()
+     && myDrawMode != GL_POINTS) // transformation is not supported within point sprites
+    {
+      aCtx->SetTextureMatrix (theWorkspace->ActiveTexture()->GetParams());
+    }
+
     aCtx->SetColor4fv (*(const OpenGl_Vec4* )(myDrawMode <= GL_LINE_STRIP ? aLineColor->rgb : anInteriorColor->rgb));
     if (myDrawMode == GL_LINES
      || myDrawMode == GL_LINE_STRIP)