aPrefixString += TCollection_AsciiString ("\n#define TRANSPARENT_SHADOWS");
}
- // If OpenGL driver supports bindless textures,
- // activate texturing in ray-tracing mode
- if (theGlContext->arbTexBindless != NULL)
+ // If OpenGL driver supports bindless textures and texturing
+ // is actually used, activate texturing in ray-tracing mode
+ if (myRaytraceParameters.UseBindlessTextures && theGlContext->arbTexBindless != NULL)
{
aPrefixString += TCollection_AsciiString ("\n#define USE_TEXTURES") +
TCollection_AsciiString ("\n#define MAX_TEX_NUMBER ") + TCollection_AsciiString (OpenGl_RaytraceGeometry::MAX_TEX_NUMBER);
aToRebuildShaders = Standard_True;
}
+ if (myRaytraceGeometry.HasTextures() != myRaytraceParameters.UseBindlessTextures)
+ {
+ myRaytraceParameters.UseBindlessTextures = myRaytraceGeometry.HasTextures();
+ aToRebuildShaders = Standard_True;
+ }
+
if (theCView.RenderParams.IsTransparentShadowEnabled != myRaytraceParameters.TransparentShadows)
{
myRaytraceParameters.TransparentShadows = theCView.RenderParams.IsTransparentShadowEnabled;
const OpenGl_Vec3* theOrigins,
const OpenGl_Vec3* theDirects,
const OpenGl_Mat4& theUnviewMat,
- OpenGl_FrameBuffer* theOutputFBO,
+ OpenGl_FrameBuffer* theReadDrawFbo,
const Handle(OpenGl_Context)& theGlContext)
{
bindRaytraceTextures (theGlContext);
{
glEnable (GL_BLEND);
- if (theOutputFBO != NULL)
- theOutputFBO->BindBuffer (theGlContext);
+ if (theReadDrawFbo != NULL)
+ theReadDrawFbo->BindBuffer (theGlContext);
}
else
{
Standard_Boolean OpenGl_View::raytrace (const Graphic3d_CView& theCView,
const Standard_Integer theSizeX,
const Standard_Integer theSizeY,
- OpenGl_FrameBuffer* theOutputFBO,
+ OpenGl_FrameBuffer* theReadDrawFbo,
const Handle(OpenGl_Context)& theGlContext)
{
if (!initRaytraceResources (theCView, theGlContext))
}
// Get model-view and projection matrices
- OpenGl_Mat4 aOrientationMatrix;
- OpenGl_Mat4 aViewMappingMatrix;
- OpenGl_Mat4 aInverOrientMatrix;
-
- GetMatrices (aOrientationMatrix,
- aViewMappingMatrix);
+ OpenGl_Mat4 aOrientationMatrix = myCamera->OrientationMatrixF();
+ OpenGl_Mat4 aViewMappingMatrix = theGlContext->ProjectionState.Current();
+ OpenGl_Mat4 aInverOrientMatrix;
aOrientationMatrix.Inverted (aInverOrientMatrix);
-
if (!updateRaytraceLightSources (aInverOrientMatrix, theGlContext))
{
return Standard_False;
glDisable (GL_DEPTH_TEST);
glBlendFunc (GL_ONE, GL_SRC_ALPHA);
- if (theOutputFBO != NULL)
+ if (theReadDrawFbo != NULL)
{
- theOutputFBO->BindBuffer (theGlContext);
+ theReadDrawFbo->BindBuffer (theGlContext);
}
// Generate ray-traced image
aOrigins,
aDirects,
anUnviewMat,
- theOutputFBO,
+ theReadDrawFbo,
theGlContext);
if (!aResult)