Graphic3d_RenderingParams()
: Method (Graphic3d_RM_RASTERIZATION),
NbMsaaSamples (0),
+ RenderResolutionScale (1.0f),
// ray tracing parameters
IsGlobalIlluminationEnabled (Standard_False),
RaytracingDepth (THE_DEFAULT_DEPTH),
Graphic3d_RenderingMode Method; //!< specifies rendering mode, Graphic3d_RM_RASTERIZATION by default
Standard_Integer NbMsaaSamples; //!< number of MSAA samples (should be within 0..GL_MAX_SAMPLES, power-of-two number), 0 by default
+ Standard_ShortReal RenderResolutionScale; //!< rendering resolution scale factor, 1 by default;
+ //! incompatible with MSAA (e.g. NbMsaaSamples should be set to 0)
Standard_Boolean IsGlobalIlluminationEnabled; //!< enables/disables global illumination effects (path tracing)
Standard_Integer SamplesPerPixel; //!< number of samples per pixel (SPP)
Standard_Boolean ToReverseStereo; //!< flag to reverse stereo pair, FALSE by default
unsigned int Resolution; //!< Pixels density (PPI), defines scaling factor for parameters like text size
- //!< (when defined in screen-space units rather than in 3D) to be properly displayed
- //!< on device (screen / printer). 72 is default value.
- //!< Note that using difference resolution in different Views in same Viewer
- //!< will lead to performance regression (for example, text will be recreated every time).
+ //! (when defined in screen-space units rather than in 3D) to be properly displayed
+ //! on device (screen / printer). 72 is default value.
+ //! Note that using difference resolution in different Views in same Viewer
+ //! will lead to performance regression (for example, text will be recreated every time).
};
#include <OpenGl_Workspace.hxx>
#include <OpenGl_AspectFace.hxx>
#include <Graphic3d_TransformUtils.hxx>
+#include <Graphic3d_RenderingParams.hxx>
#include <Message_Messenger.hxx>
myDrawBuffer (0),
myDefaultVao (0),
myIsGlDebugCtx (Standard_False),
- myResolutionRatio (1.0f)
+ myResolution (Graphic3d_RenderingParams::THE_DEFAULT_RESOLUTION),
+ myResolutionRatio (1.0f),
+ myLineWidthScale (1.0f),
+ myRenderScale (1.0f),
+ myRenderScaleInv (1.0f)
{
myViewport[0] = 0;
myViewport[1] = 0;
myViewport[2] = 0;
myViewport[3] = 0;
+ myViewportVirt[0] = 0;
+ myViewportVirt[1] = 0;
+ myViewportVirt[2] = 0;
+ myViewportVirt[3] = 0;
// system-dependent fields
#if defined(HAVE_EGL)
myViewport[1] = theRect[1];
myViewport[2] = theRect[2];
myViewport[3] = theRect[3];
+ if (HasRenderScale())
+ {
+ myViewportVirt[0] = Standard_Integer(theRect[0] * myRenderScaleInv);
+ myViewportVirt[1] = Standard_Integer(theRect[1] * myRenderScaleInv);
+ myViewportVirt[2] = Standard_Integer(theRect[2] * myRenderScaleInv);
+ myViewportVirt[3] = Standard_Integer(theRect[3] * myRenderScaleInv);
+ }
+ else
+ {
+ myViewportVirt[0] = theRect[0];
+ myViewportVirt[1] = theRect[1];
+ myViewportVirt[2] = theRect[2];
+ myViewportVirt[3] = theRect[3];
+ }
}
#if !defined(GL_ES_VERSION_2_0)
if (core11 != NULL)
{
// glLineWidth() is still defined within Core Profile, but has no effect with values != 1.0f
- core11fwd->glLineWidth (theWidth * myResolutionRatio);
+ core11fwd->glLineWidth (theWidth * myLineWidthScale);
}
#ifdef HAVE_GL2PS
if (IsFeedback())
//! @param theRect viewport definition (x, y, width, height)
Standard_EXPORT void ResizeViewport (const Standard_Integer theRect[4]);
+ //! Return virtual viewport definition (x, y, width, height).
+ const Standard_Integer* VirtualViewport() const { return myViewportVirt; }
+
//! Return active read buffer.
Standard_Integer ReadBuffer() { return myReadBuffer; }
Standard_EXPORT void DisableFeatures() const;
+ //! Return resolution for rendering text.
+ unsigned int Resolution() const { return myResolution; }
+
+ //! Resolution scale factor (rendered resolution to standard resolution).
+ //! This scaling factor for parameters like text size to be properly displayed on device (screen / printer).
+ Standard_ShortReal ResolutionRatio() const { return myResolutionRatio; }
+
+ //! Rendering scale factor (rendering viewport height to real window buffer height).
+ Standard_ShortReal RenderScale() const { return myRenderScale; }
+
+ //! Return TRUE if rendering scale factor is not 1.
+ Standard_Boolean HasRenderScale() const { return Abs (myRenderScale - 1.0f) > 0.0001f; }
+
+ //! Rendering scale factor (inverted value).
+ Standard_ShortReal RenderScaleInv() const { return myRenderScaleInv; }
+
+ //! Set resolution ratio.
+ //! Note that this method rounds @theRatio to nearest integer.
+ void SetResolution (unsigned int theResolution,
+ Standard_ShortReal theRatio,
+ Standard_ShortReal theScale)
+ {
+ myResolution = (unsigned int )(theScale * theResolution + 0.5f);
+ myRenderScale = theScale;
+ myRenderScaleInv = 1.0f / theScale;
+ SetResolutionRatio (theRatio * theScale);
+ }
+
//! Set resolution ratio.
//! Note that this method rounds @theRatio to nearest integer.
void SetResolutionRatio (const Standard_ShortReal theRatio)
{
- myResolutionRatio = Max (1.0f, std::floor (theRatio + 0.5f));
+ myResolutionRatio = theRatio;
+ myLineWidthScale = Max (1.0f, std::floor (theRatio + 0.5f));
}
private:
Handle(OpenGl_FrameBuffer) myDefaultFbo; //!< default Frame Buffer Object
Handle(OpenGl_LineAttributes) myHatchStyles; //!< resource holding predefined hatch styles patterns
Standard_Integer myViewport[4]; //!< current viewport
+ Standard_Integer myViewportVirt[4]; //!< virtual viewport
Standard_Integer myPointSpriteOrig; //!< GL_POINT_SPRITE_COORD_ORIGIN state (GL_UPPER_LEFT by default)
Standard_Integer myRenderMode; //!< value for active rendering mode
Standard_Integer myPolygonMode; //!< currently used polygon rasterization mode (glPolygonMode)
Standard_Boolean myIsGlDebugCtx; //!< debug context initialization state
TCollection_AsciiString myVendor; //!< Graphics Driver's vendor
TColStd_PackedMapOfInteger myFilters[6]; //!< messages suppressing filter (for sources from GL_DEBUG_SOURCE_API_ARB to GL_DEBUG_SOURCE_OTHER_ARB)
+ unsigned int myResolution; //!< Pixels density (PPI), defines scaling factor for parameters like text size
Standard_ShortReal myResolutionRatio; //!< scaling factor for parameters like text size
- //!< to be properly displayed on device (screen / printer)
+ //! to be properly displayed on device (screen / printer)
+ Standard_ShortReal myLineWidthScale; //!< scaling factor for line width
+ Standard_ShortReal myRenderScale; //!< scaling factor for rendering resolution
+ Standard_ShortReal myRenderScaleInv; //!< scaling factor for rendering resolution (inverted value)
OpenGl_Material myMatFront; //!< current front material state (cached to reduce GL context updates)
OpenGl_Material myMatBack; //!< current back material state
OpenGl_Mat4& aWorldView = aCtx->WorldViewState.ChangeCurrent();
myTrsfPers->Apply (theWorkspace->View()->Camera(),
aCtx->ProjectionState.Current(), aWorldView,
- aCtx->Viewport()[2], aCtx->Viewport()[3]);
+ aCtx->VirtualViewport()[2], aCtx->VirtualViewport()[3]);
#if !defined(GL_ES_VERSION_2_0)
if (!aCtx->IsGlNormalizeEnabled()
*aTextAspect,
theWorkspace->TextColor(),
theWorkspace->TextSubtitleColor(),
- theWorkspace->View()->RenderingParams().Resolution);
+ aCtx->Resolution());
// restore aspects
if (!aPrevTexture.IsNull())
{
Graphic3d_TransformUtils::Scale<GLdouble> (aModViewMat, myScaleHeight, myScaleHeight, myScaleHeight);
}
+ else if (theCtx->HasRenderScale())
+ {
+ Graphic3d_TransformUtils::Scale<GLdouble> (aModViewMat, theCtx->RenderScaleInv(), theCtx->RenderScaleInv(), theCtx->RenderScaleInv());
+ }
}
if (myHasPlane && !myHasAnchorPoint)
myExportHeight = 1.0f;
myScaleHeight = 1.0f;
- if (myHasPlane && !myHasAnchorPoint)
- {
- OpenGl_Mat4d aWorldViewMat;
- aWorldViewMat.Convert (theCtx->WorldViewState.Current());
- theCtx->WorldViewState.Push();
- theCtx->WorldViewState.SetCurrent<Standard_Real> (aWorldViewMat);
- theCtx->ApplyWorldViewMatrix();
- }
- else
- {
- theCtx->WorldViewState.Push();
- }
-
+ theCtx->WorldViewState.Push();
myModelMatrix.Convert (theCtx->WorldViewState.Current() * theCtx->ModelWorldState.Current());
+ const GLdouble aPointSize = (GLdouble )myFont->FTFont()->PointSize();
if (!myIs2d)
{
- Graphic3d_TransformUtils::Project<Standard_Real> (myPoint.x(),
- myPoint.y(),
- myPoint.z(),
- myModelMatrix,
- myProjMatrix,
- theCtx->Viewport(),
- myWinX,
- myWinY,
- myWinZ);
+ Graphic3d_TransformUtils::Project<Standard_Real> (myPoint.x(), myPoint.y(), myPoint.z(),
+ myModelMatrix, myProjMatrix, theCtx->Viewport(),
+ myWinX, myWinY, myWinZ);
// compute scale factor for constant text height
- GLdouble x1, y1, z1;
- Graphic3d_TransformUtils::UnProject<Standard_Real> (myWinX,
- myWinY,
- myWinZ,
- OpenGl_Mat4d::Map (THE_IDENTITY_MATRIX),
- myProjMatrix,
- theCtx->Viewport(),
- x1,
- y1,
- z1);
-
- GLdouble x2, y2, z2;
- const GLdouble h = (GLdouble )myFont->FTFont()->PointSize();
- Graphic3d_TransformUtils::UnProject<Standard_Real> (myWinX,
- myWinY + h,
- myWinZ,
- OpenGl_Mat4d::Map (THE_IDENTITY_MATRIX),
- myProjMatrix,
- theCtx->Viewport(),
- x2,
- y2,
- z2);
-
- myScaleHeight = (y2 - y1) / h;
if (theTextAspect.Aspect()->GetTextZoomable())
{
- myExportHeight = (float )h;
+ myExportHeight = aPointSize;
+ }
+ else
+ {
+ Graphic3d_Vec3d aPnt1, aPnt2;
+ Graphic3d_TransformUtils::UnProject<Standard_Real> (myWinX, myWinY, myWinZ,
+ OpenGl_Mat4d::Map (THE_IDENTITY_MATRIX), myProjMatrix, theCtx->Viewport(),
+ aPnt1.x(), aPnt1.y(), aPnt1.z());
+ Graphic3d_TransformUtils::UnProject<Standard_Real> (myWinX, myWinY + aPointSize, myWinZ,
+ OpenGl_Mat4d::Map (THE_IDENTITY_MATRIX), myProjMatrix, theCtx->Viewport(),
+ aPnt2.x(), aPnt2.y(), aPnt2.z());
+ myScaleHeight = (aPnt2.y() - aPnt1.y()) / aPointSize;
}
}
- myExportHeight = (float )myFont->FTFont()->PointSize() / myExportHeight;
+ myExportHeight = aPointSize / myExportHeight;
#if !defined(GL_ES_VERSION_2_0)
if (theCtx->core11 != NULL)
// fetch OpenGl context state
aCtx->FetchState();
- // set resolution ratio
- aCtx->SetResolutionRatio (RenderingParams().ResolutionRatio());
-
OpenGl_FrameBuffer* aFrameBuffer = myFBO.operator->();
bool toSwap = aCtx->IsRender()
&& !aCtx->caps->buffersNoSwap
Standard_Integer aSizeX = aFrameBuffer != NULL ? aFrameBuffer->GetVPSizeX() : myWindow->Width();
Standard_Integer aSizeY = aFrameBuffer != NULL ? aFrameBuffer->GetVPSizeY() : myWindow->Height();
+ Standard_Integer aRendSizeX = Standard_Integer(myRenderParams.RenderResolutionScale * aSizeX + 0.5f);
+ Standard_Integer aRendSizeY = Standard_Integer(myRenderParams.RenderResolutionScale * aSizeY + 0.5f);
// determine multisampling parameters
- Standard_Integer aNbSamples = !myToDisableMSAA
+ Standard_Integer aNbSamples = !myToDisableMSAA && aSizeX == aRendSizeX
? Max (Min (myRenderParams.NbMsaaSamples, aCtx->MaxMsaaSamples()), 0)
: 0;
if (aNbSamples != 0)
if (myHasFboBlit
&& (myTransientDrawToFront
|| aProjectType == Graphic3d_Camera::Projection_Stereo
- || aNbSamples != 0))
+ || aNbSamples != 0
+ || aSizeX != aRendSizeX))
{
- if (myMainSceneFbos[0]->GetVPSizeX() != aSizeX
- || myMainSceneFbos[0]->GetVPSizeY() != aSizeY
+ if (myMainSceneFbos[0]->GetVPSizeX() != aRendSizeX
+ || myMainSceneFbos[0]->GetVPSizeY() != aRendSizeY
|| myMainSceneFbos[0]->NbSamples() != aNbSamples)
{
if (!myTransientDrawToFront)
// for further blitting and rendering immediate presentations on top
if (aCtx->core20fwd != NULL)
{
- myMainSceneFbos[0]->Init (aCtx, aSizeX, aSizeY, myFboColorFormat, myFboDepthFormat, aNbSamples);
+ myMainSceneFbos[0]->Init (aCtx, aRendSizeX, aRendSizeY, myFboColorFormat, myFboDepthFormat, aNbSamples);
}
if (myTransientDrawToFront
&& !aCtx->caps->useSystemBuffer
#if !defined(GL_ES_VERSION_2_0)
aCtx->SetReadDrawBuffer (aStereoMode == Graphic3d_StereoMode_QuadBuffer ? GL_BACK_LEFT : GL_BACK);
#endif
+ aCtx->SetResolution (myRenderParams.Resolution, myRenderParams.ResolutionRatio(),
+ aMainFbos[0] != NULL ? myRenderParams.RenderResolutionScale : 1.0f);
+
redraw (Graphic3d_Camera::Projection_MonoLeftEye, aMainFbos[0]);
myBackBufferRestored = Standard_True;
myIsImmediateDrawn = Standard_False;
#if !defined(GL_ES_VERSION_2_0)
aCtx->SetReadDrawBuffer (aStereoMode == Graphic3d_StereoMode_QuadBuffer ? GL_BACK_LEFT : GL_BACK);
#endif
+ aCtx->SetResolution (myRenderParams.Resolution, myRenderParams.ResolutionRatio(),
+ anImmFbos[0] != NULL ? myRenderParams.RenderResolutionScale : 1.0f);
if (!redrawImmediate (Graphic3d_Camera::Projection_MonoLeftEye, aMainFbos[0], anImmFbos[0]))
{
toSwap = false;
#if !defined(GL_ES_VERSION_2_0)
aCtx->SetReadDrawBuffer (aStereoMode == Graphic3d_StereoMode_QuadBuffer ? GL_BACK_RIGHT : GL_BACK);
#endif
+ aCtx->SetResolution (myRenderParams.Resolution, myRenderParams.ResolutionRatio(),
+ aMainFbos[1] != NULL ? myRenderParams.RenderResolutionScale : 1.0f);
+
redraw (Graphic3d_Camera::Projection_MonoRightEye, aMainFbos[1]);
myBackBufferRestored = Standard_True;
myIsImmediateDrawn = Standard_False;
+ aCtx->SetResolution (myRenderParams.Resolution, myRenderParams.ResolutionRatio(),
+ anImmFbos[1] != NULL ? myRenderParams.RenderResolutionScale : 1.0f);
if (!redrawImmediate (Graphic3d_Camera::Projection_MonoRightEye, aMainFbos[1], anImmFbos[1]))
{
toSwap = false;
if (anImmFbos[0] != NULL)
{
+ aCtx->SetResolution (myRenderParams.Resolution, myRenderParams.ResolutionRatio(), 1.0f);
drawStereoPair (aFrameBuffer);
}
}
aCtx->SetReadDrawBuffer (GL_BACK);
}
#endif
+ aCtx->SetResolution (myRenderParams.Resolution, myRenderParams.ResolutionRatio(),
+ aMainFbo != aFrameBuffer ? myRenderParams.RenderResolutionScale : 1.0f);
redraw (aProjectType, aMainFbo);
myBackBufferRestored = Standard_True;
myIsImmediateDrawn = Standard_False;
+ aCtx->SetResolution (myRenderParams.Resolution, myRenderParams.ResolutionRatio(),
+ anImmFbo != aFrameBuffer ? myRenderParams.RenderResolutionScale : 1.0f);
if (!redrawImmediate (aProjectType, aMainFbo, anImmFbo))
{
toSwap = false;
aCtx->SetReadDrawBuffer (aStereoMode == Graphic3d_StereoMode_QuadBuffer ? GL_BACK_LEFT : GL_BACK);
}
#endif
+
+ aCtx->SetResolution (myRenderParams.Resolution, myRenderParams.ResolutionRatio(),
+ anImmFbos[0] != NULL ? myRenderParams.RenderResolutionScale : 1.0f);
toSwap = redrawImmediate (Graphic3d_Camera::Projection_MonoLeftEye,
aMainFbos[0],
anImmFbos[0],
aCtx->SetReadDrawBuffer (aStereoMode == Graphic3d_StereoMode_QuadBuffer ? GL_BACK_RIGHT : GL_BACK);
}
#endif
+ aCtx->SetResolution (myRenderParams.Resolution, myRenderParams.ResolutionRatio(),
+ anImmFbos[1] != NULL ? myRenderParams.RenderResolutionScale : 1.0f);
toSwap = redrawImmediate (Graphic3d_Camera::Projection_MonoRightEye,
aMainFbos[1],
anImmFbos[1],
aCtx->SetReadDrawBuffer (GL_BACK);
}
#endif
+ aCtx->SetResolution (myRenderParams.Resolution, myRenderParams.ResolutionRatio(),
+ anImmFbo != aFrameBuffer ? myRenderParams.RenderResolutionScale : 1.0f);
toSwap = redrawImmediate (aProjectType,
aMainFbo,
anImmFbo,
const Standard_Boolean theToFlip)
{
Handle(OpenGl_Context) aCtx = myWorkspace->GetGlContext();
+ const Standard_Integer aReadSizeX = theReadFbo != NULL ? theReadFbo->GetVPSizeX() : myWindow->Width();
+ const Standard_Integer aReadSizeY = theReadFbo != NULL ? theReadFbo->GetVPSizeY() : myWindow->Height();
+ const Standard_Integer aDrawSizeX = theDrawFbo != NULL ? theDrawFbo->GetVPSizeX() : myWindow->Width();
+ const Standard_Integer aDrawSizeY = theDrawFbo != NULL ? theDrawFbo->GetVPSizeY() : myWindow->Height();
if (theReadFbo == NULL || aCtx->IsFeedback())
{
return false;
{
aCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
}
+ const Standard_Integer aViewport[4] = { 0, 0, aDrawSizeX, aDrawSizeY };
+ aCtx->ResizeViewport (aViewport);
+
#if !defined(GL_ES_VERSION_2_0)
aCtx->core20fwd->glClearDepth (1.0);
#else
}
// we don't copy stencil buffer here... does it matter for performance?
- aCtx->arbFBOBlit->glBlitFramebuffer (0, 0, theReadFbo->GetVPSizeX(), theReadFbo->GetVPSizeY(),
- 0, 0, theReadFbo->GetVPSizeX(), theReadFbo->GetVPSizeY(),
+ aCtx->arbFBOBlit->glBlitFramebuffer (0, 0, aReadSizeX, aReadSizeY,
+ 0, 0, aDrawSizeX, aDrawSizeY,
aCopyMask, GL_NEAREST);
const int anErr = ::glGetError();
if (anErr != GL_NO_ERROR)
myWorkspace->DisableTexture();
+ const Graphic3d_TypeOfTextureFilter aFilter = (aDrawSizeX == aReadSizeX && aDrawSizeY == aReadSizeY) ? Graphic3d_TOTF_NEAREST : Graphic3d_TOTF_BILINEAR;
+ const GLint aFilterGl = aFilter == Graphic3d_TOTF_NEAREST ? GL_NEAREST : GL_LINEAR;
+
OpenGl_VertexBuffer* aVerts = initBlitQuad (theToFlip);
const Handle(OpenGl_ShaderManager)& aManager = aCtx->ShaderManager();
if (aVerts->IsValid()
&& aManager->BindFboBlitProgram())
{
- theReadFbo->ColorTexture() ->Bind (aCtx, GL_TEXTURE0 + 0);
- theReadFbo->DepthStencilTexture()->Bind (aCtx, GL_TEXTURE0 + 1);
+ theReadFbo->ColorTexture()->Bind (aCtx, GL_TEXTURE0 + 0);
+ if (theReadFbo->ColorTexture()->GetParams()->Filter() != aFilter)
+ {
+ theReadFbo->ColorTexture()->GetParams()->SetFilter (aFilter);
+ aCtx->core20fwd->glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, aFilterGl);
+ aCtx->core20fwd->glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, aFilterGl);
+ }
+
+ theReadFbo->DepthStencilTexture()->Bind (aCtx, GL_TEXTURE0 + 1);
+ if (theReadFbo->DepthStencilTexture()->GetParams()->Filter() != aFilter)
+ {
+ theReadFbo->DepthStencilTexture()->GetParams()->SetFilter (aFilter);
+ aCtx->core20fwd->glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, aFilterGl);
+ aCtx->core20fwd->glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, aFilterGl);
+ }
+
aVerts->BindVertexAttrib (aCtx, Graphic3d_TOA_POS);
aCtx->core20fwd->glDrawArrays (GL_TRIANGLE_STRIP, 0, 4);
#if(defined(_MSC_VER) && (_MSC_VER < 1800))
// only Visual Studio 2013 (vc12) provides <cinttypes> header
// we do not defined all macros here - only used by OCCT framework
+ #define PRId64 "I64d"
+ #define PRIu64 "I64u"
+ #define SCNd64 "I64d"
+ #define SCNu64 "I64u"
#ifdef _WIN64
#define PRIdPTR "I64d"
#define PRIuPTR "I64u"
//function : VRepaint
//purpose :
//==============================================================================
-static int VRepaint (Draw_Interpretor& , Standard_Integer , const char** )
+static int VRepaint (Draw_Interpretor& , Standard_Integer theArgNb, const char** theArgVec)
{
- Handle(V3d_View) V = ViewerTest::CurrentView();
- if ( !V.IsNull() ) V->Redraw(); return 0;
+ Handle(V3d_View) aView = ViewerTest::CurrentView();
+ if (aView.IsNull())
+ {
+ std::cout << "Error: no active viewer!\n";
+ return 1;
+ }
+
+ Standard_Boolean isImmediateUpdate = Standard_False;
+ for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
+ {
+ TCollection_AsciiString anArg (theArgVec[anArgIter]);
+ anArg.LowerCase();
+ if (anArg == "-immediate")
+ {
+ isImmediateUpdate = Standard_True;
+ if (anArgIter + 1 < theArgNb
+ && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], isImmediateUpdate))
+ {
+ ++anArgIter;
+ }
+ }
+ else
+ {
+ std::cout << "Syntax error at '" << anArg << "'\n";
+ }
+ }
+
+ if (isImmediateUpdate)
+ {
+ aView->RedrawImmediate();
+ }
+ else
+ {
+ aView->Redraw();
+ }
+ return 0;
}
//==============================================================================
theDI << "VSync: " << aCaps->swapInterval << "\n";
theDI << "Compatible:" << (aCaps->contextCompatible ? "1" : "0") << "\n";
theDI << "Stereo: " << (aCaps->contextStereo ? "1" : "0") << "\n";
+ theDI << "WinBuffer: " << (aCaps->useSystemBuffer ? "1" : "0") << "\n";
return 0;
}
}
aCaps->contextNoAccel = toEnable;
}
+ else if (anArgCase == "-winbuffer"
+ || anArgCase == "-windowbuffer"
+ || anArgCase == "-usewinbuffer"
+ || anArgCase == "-usewindowbuffer"
+ || anArgCase == "-usesystembuffer")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->useSystemBuffer = toEnable;
+ }
else if (anArgCase == "-accel"
|| anArgCase == "-acceleration")
{
}
theDI << "\n";
theDI << "msaa: " << aParams.NbMsaaSamples << "\n";
+ theDI << "rendScale: " << aParams.RenderResolutionScale << "\n";
theDI << "rayDepth: " << aParams.RaytracingDepth << "\n";
theDI << "fsaa: " << (aParams.IsAntialiasingEnabled ? "on" : "off") << "\n";
theDI << "shadows: " << (aParams.IsShadowEnabled ? "on" : "off") << "\n";
aParams.NbMsaaSamples = aNbSamples;
}
}
+ else if (aFlag == "-rendscale"
+ || aFlag == "-renderscale"
+ || aFlag == "-renderresolutionscale")
+ {
+ if (toPrint)
+ {
+ theDI << aParams.RenderResolutionScale << " ";
+ continue;
+ }
+ else if (++anArgIter >= theArgNb)
+ {
+ std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ return 1;
+ }
+
+ const Standard_Real aScale = Draw::Atof (theArgVec[anArgIter]);
+ if (aScale < 0.01)
+ {
+ std::cerr << "Error: invalid rendering resolution scale " << aScale << ".\n";
+ return 1;
+ }
+ else
+ {
+ aParams.RenderResolutionScale = Standard_ShortReal(aScale);
+ }
+ }
else if (aFlag == "-raydepth"
|| aFlag == "-ray_depth")
{
" \"scale\" - specifies factor to scale computed z range.\n",
__FILE__, VZFit, group);
theCommands.Add("vrepaint",
- "vrepaint : vrepaint, force redraw",
+ "vrepaint [-immediate]"
+ "\n\t\t: force redraw",
__FILE__,VRepaint,group);
theCommands.Add("vclear",
"vclear : vclear"
theCommands.Add ("vcaps",
"vcaps [-vbo {0|1}] [-sprites {0|1}] [-ffp {0|1}]"
"\n\t\t: [-compatibleProfile {0|1}]"
- "\n\t\t: [-vsync {0|1}]"
+ "\n\t\t: [-vsync {0|1}] [-useWinBuffer {0|1}]"
"\n\t\t: [-quadBuffer {0|1}] [-stereo {0|1}]"
"\n\t\t: [-softMode {0|1}] [-noupdate|-update]"
"\n\t\t: Modify particular graphic driver options:"
"\n\t\t: arrays to GPU memory)"
"\n\t\t: sprite - use textured sprites instead of bitmaps"
"\n\t\t: vsync - switch VSync on or off"
+ "\n\t\t: winBuffer - allow using window buffer for rendering"
"\n\t\t: Context creation options:"
"\n\t\t: softMode - software OpenGL implementation"
"\n\t\t: compatibleProfile - backward-compatible profile"
"\n Manages rendering parameters: "
"\n '-raster' Disables GPU ray-tracing"
"\n '-msaa 0..4' Specifies number of samples for MSAA"
+ "\n '-rendScale value Rendering resolution scale factor"
"\n '-rayTrace' Enables GPU ray-tracing"
"\n '-rayDepth 0..10' Defines maximum ray-tracing depth"
"\n '-shadows on|off' Enables/disables shadows rendering"
--- /dev/null
+puts "========"
+puts "Rendering resolution scale factor"
+puts "========"
+
+set aFontFile ""
+catch { set aFontFile [locate_data_file DejaVuSans.ttf] }
+
+pload MODELING VISUALIZATION
+
+set aLabelFont "Arial"
+if { "$aFontFile" != "" } {
+ vfont add "$aFontFile" SansFont
+ set aLabelFont "SansFont"
+}
+
+box b 1 2 3
+vclear
+vinit View1
+vdisplay b
+vfit
+vpoint p 0 0 0
+vzbufftrihedron
+vdrawtext t Text2d -font $aLabelFont
+vtrihedron tt
+vdisplay -trsfPers zoom -trsfPersPos 1 0 0 tt
+text2brep ttl "Top-Left" -font $aLabelFont -height 30 -pos 0 -30 0
+vdisplay ttl -2d topLeft -dispMode 1
+vcolorscale cs -demo
+
+vrenderparams -rendScale 1
+vdump $::imagedir/${::casename}_100.png
+
+vrenderparams -rendScale 0.5
+vdump $::imagedir/${::casename}_050.png
+
+vrenderparams -rendScale 0.75
+vdump $::imagedir/${::casename}_075.png
+
+vrenderparams -rendScale 2
+vdump $::imagedir/${::casename}_200.png