The Vish Visualization Shell 0.3
Vish
Background.cpp

A very simplistic implementation of rendering a homogeneous background.

A very simplistic implementation of rendering a homogeneous background.

See also
QuadDemo.cpp for rendering geometries using OpenGL 1.
#include <ocean/plankton/VPipeline.hpp>
#include <ocean/GLvish/VGLRenderObject.hpp>
using namespace Wizt;
namespace
{
class DefaultBackground : public VGLRenderObject
{
// Defining input parameters of type double
in<double> Red, Green, Blue, Alpha;
// The render callback function
bool renderGL(VGLRenderContext&Context) const override
{
double red = 1, green = 1, blue = 1, alpha=1;
Red << Context >> red;
Green << Context >> green;
Blue << Context >> blue;
Alpha << Context >> alpha;
glClearDepth(1.0);
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClearColor( red, green, blue, alpha );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Context.number_of_depthbuffer_clearance_objects++;
return true;
}
public:
DefaultBackground(const string&name, int, const RefPtr<VCreationPreferences>&VP)
// Each input parameter is initialized with its GUI name and default value
, Red (this, "red" , 1.0)
, Green(this, "green", 1.0)
, Blue (this, "blue" , 1.0 )
, Alpha(this, "alpha", 1.0 )
{
// Setting the parameters as local is optional,
// in general this would not be the case, but for
// the background it can make sense such that we
// can have a different background color in each viewer
Red ->Localize();
Green->Localize();
Blue ->Localize();
Alpha->Localize();
}
};
using namespace Panthalassa;
myBackground( Category("Backgrounds") + VIdentifier("Background"), ObjectQuality::DEMO);
}
A set of variable names, with indices associated to each type.
Definition Context.hpp:18
A reference counting pointer class which keeps objects alive as long as strong pointers to these obje...
Definition RefPtr.hpp:405
A set of property elements for VCreator objects.
Definition VCreatorProperties.hpp:258
Base class for objects that implement a drawing routine using OpenGL.
Definition VGLRenderObject.hpp:20
The Panthalassa namespace allows to conveniently specify the properties of a VCreator object during c...
Definition VCreatorProperties.hpp:385
The Vish namespace.
Definition Anemone.cpp:17
@ BACKGROUND_OBJECT
Background objects are fixed with respect to the viewer.
Definition RenderCategory.hpp:25
A special vish context that is passed to VGLRenderObjects when rendering.
Definition VGLRenderContext.hpp:35
Implements a data sink.
Definition VPipeline.hpp:73