#include <OpenGl_Context.hxx>
#include <OpenGl_ShaderProgram.hxx>
#include <OpenGl_ShaderManager.hxx>
+#include <OpenGl_ArbTexBindless.hxx>
IMPLEMENT_STANDARD_HANDLE (OpenGl_ShaderProgram, OpenGl_Resource)
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_ShaderProgram, OpenGl_Resource)
"occTextureEnable", // OpenGl_OCCT_TEXTURE_ENABLE
"occDistinguishingMode", // OpenGl_OCCT_DISTINGUISH_MODE
"occFrontMaterial", // OpenGl_OCCT_FRONT_MATERIAL
- "occBackMaterial" // OpenGl_OCCT_BACK_MATERIAL
+ "occBackMaterial", // OpenGl_OCCT_BACK_MATERIAL
+ "occColor", // OpenGl_OCCT_COLOR
+
+ "occPointSize" // OpenGl_OCCT_POINT_SIZE
};
}
TCollection_AsciiString aSource = aDeclarations + anIter.Value()->Source();
- if (anIter.Value()->Type() == Graphic3d_TOS_VERTEX)
+ switch (anIter.Value()->Type())
{
- aSource = TCollection_AsciiString ("#define VERTEX_SHADER\n") + aSource;
+ case Graphic3d_TOS_VERTEX:
+ {
+ aSource = TCollection_AsciiString ("#define VERTEX_SHADER\n") + aSource;
+ break;
+ }
+ case Graphic3d_TOS_FRAGMENT:
+ {
+ #if defined(GL_ES_VERSION_2_0)
+ TCollection_AsciiString aPrefix (theCtx->hasHighp
+ ? "precision highp float;\n"
+ : "precision mediump float;\n");
+ aSource = aPrefix + aSource;
+ #endif
+ break;
+ }
}
if (!aShader->LoadSource (theCtx, aSource))
SetAttributeName (theCtx, Graphic3d_TOA_POS, "occVertex");
SetAttributeName (theCtx, Graphic3d_TOA_NORM, "occNormal");
SetAttributeName (theCtx, Graphic3d_TOA_UV, "occTexCoord");
- SetAttributeName (theCtx, Graphic3d_TOA_COLOR, "occColor");
+ SetAttributeName (theCtx, Graphic3d_TOA_COLOR, "occVertColor");
if (!Link (theCtx))
{
return Standard_True;
}
+// =======================================================================
+// function : SetUniform
+// purpose : Specifies the value of the 64-bit unsigned uniform variable
+// =======================================================================
+Standard_Boolean OpenGl_ShaderProgram::SetUniform (const Handle(OpenGl_Context)& theCtx,
+ const GLchar* theName,
+ GLuint64 theValue)
+{
+ return SetUniform (theCtx, GetUniformLocation (theCtx, theName), theValue);
+}
+
+// =======================================================================
+// function : SetUniform
+// purpose : Specifies the value of the 64-bit unsigned uniform variable
+// =======================================================================
+Standard_Boolean OpenGl_ShaderProgram::SetUniform (const Handle(OpenGl_Context)& theCtx,
+ GLint theLocation,
+ GLuint64 theValue)
+{
+ if (theCtx->arbTexBindless == NULL || myProgramID == NO_PROGRAM || theLocation == INVALID_LOCATION)
+ {
+ return Standard_False;
+ }
+
+#if !defined(GL_ES_VERSION_2_0)
+ theCtx->arbTexBindless->glUniformHandleui64ARB (theLocation, theValue);
+#endif
+
+ return Standard_True;
+}
+
+// =======================================================================
+// function : SetUniform
+// purpose : Specifies the value of the 64-bit unsigned uniform array
+// =======================================================================
+Standard_Boolean OpenGl_ShaderProgram::SetUniform (const Handle(OpenGl_Context)& theCtx,
+ const GLchar* theName,
+ const GLsizei theCount,
+ const GLuint64* theValue)
+{
+ return SetUniform (theCtx, GetUniformLocation (theCtx, theName), theCount, theValue);
+}
+
+// =======================================================================
+// function : SetUniform
+// purpose : Specifies the value of the 64-bit unsigned uniform array
+// =======================================================================
+Standard_Boolean OpenGl_ShaderProgram::SetUniform (const Handle(OpenGl_Context)& theCtx,
+ GLint theLocation,
+ const GLsizei theCount,
+ const GLuint64* theValue)
+{
+ if (theCtx->arbTexBindless == NULL || myProgramID == NO_PROGRAM || theLocation == INVALID_LOCATION)
+ {
+ return Standard_False;
+ }
+
+#if !defined(GL_ES_VERSION_2_0)
+ theCtx->arbTexBindless->glUniformHandleui64vARB (theLocation, theCount, theValue);
+#endif
+
+ return Standard_True;
+}
+
// =======================================================================
// function : SetUniform
// purpose : Specifies the value of the floating-point uniform variable
// =======================================================================
Standard_Boolean OpenGl_ShaderProgram::SetUniform (const Handle(OpenGl_Context)& theCtx,
const GLchar* theName,
- const OpenGl_Matrix& theValue,
+ const OpenGl_Mat4& theValue,
GLboolean theTranspose)
{
return SetUniform (theCtx, GetUniformLocation (theCtx, theName), theValue, theTranspose);
// =======================================================================
Standard_Boolean OpenGl_ShaderProgram::SetUniform (const Handle(OpenGl_Context)& theCtx,
GLint theLocation,
- const OpenGl_Matrix& theValue,
+ const OpenGl_Mat4& theValue,
GLboolean theTranspose)
{
if (myProgramID == NO_PROGRAM || theLocation == INVALID_LOCATION)
return Standard_False;
}
- theCtx->core20->glUniformMatrix4fv (theLocation, 1, theTranspose, *theValue.mat);
+ theCtx->core20->glUniformMatrix4fv (theLocation, 1, GL_FALSE, theTranspose ? theValue.Transposed() : theValue);
return Standard_True;
}
// =======================================================================
Standard_Boolean OpenGl_ShaderProgram::SetUniform (const Handle(OpenGl_Context)& theCtx,
const GLchar* theName,
- const Tmatrix3& theValue,
+ const OpenGl_Matrix& theValue,
GLboolean theTranspose)
{
return SetUniform (theCtx, GetUniformLocation (theCtx, theName), theValue, theTranspose);
// =======================================================================
Standard_Boolean OpenGl_ShaderProgram::SetUniform (const Handle(OpenGl_Context)& theCtx,
GLint theLocation,
- const Tmatrix3& theValue,
+ const OpenGl_Matrix& theValue,
GLboolean theTranspose)
{
- if (myProgramID == NO_PROGRAM || theLocation == INVALID_LOCATION)
- {
- return Standard_False;
- }
-
- theCtx->core20->glUniformMatrix4fv (theLocation, 1, theTranspose, *theValue);
- return Standard_True;
+ return SetUniform (theCtx, theLocation, OpenGl_Mat4::Map (*theValue.mat), theTranspose);
}
// =======================================================================