1 #ifndef __RENDER_CONTEXT_BASE_HH__
2 #define __RENDER_CONTEXT_BASE_HH__
4 #include <bias_config.h>
6 #ifndef BIAS_HAVE_OPENGL
7 # error You need BIAS with USE_OpenGL Please recompile BIAS.
8 #endif // BUILD_GLviewer
12 #include <Base/Common/W32Compat.hh>
13 #include <Base/Image/Image.hh>
15 #include <GLviewer/Scenes/SceneBase.hh>
16 #include <GLviewer/GLProjectionParametersInterface.hh>
17 #include <GLviewer/Controller/ControlInterface.hh>
18 #include <GLviewer/View.hh>
20 #ifdef BIAS_HAVE_PTHREADS
21 #include <Utils/MutexSingleton.hh>
46 virtual void Redisplay() = 0;
49 virtual void MakeGLContextCurrent() = 0;
51 #ifdef BIAS_HAVE_PTHREADS
52 int LockContextSwitch();
53 int ReleaseContextSwitch();
84 void AppendScene(
SceneBase* scene,
bool push_front =
false);
86 void RemoveScene(
SceneBase* scene,
bool noWarning =
false);
89 void InsertSceneAt(
SceneBase* scene,
unsigned int index);
91 void DeleteSceneAt(
unsigned int index);
93 SceneBase* GetSceneAt(
unsigned int index);
98 void SetBackgroundImageScene(
SceneBGImage* backgroundImageScene);
101 void DeleteBackgroundImageScene();
125 {
if(listener!=NULL) additionalListeners_.push_back(listener); }
150 bool LeftMouseDoubleClicked(
int x,
int y,
int m);
151 bool LeftMouseSingleClicked(
int x,
int y);
152 bool LeftMouseDown(
int x,
int y);
153 bool LeftMouseUp(
int x,
int y);
154 bool LeftMouseMoved(
int x1,
int x2,
int y1,
int y2);
155 bool RightMouseSingleClicked(
int x,
int y);
156 bool RightMouseDoubleClicked(
int x,
int y);
157 bool RightMouseMoved(
int x1,
int x2,
int y1,
int y2);
158 bool RightMouseDown(
int x,
int y);
159 bool RightMouseUp(
int x,
int y);
160 bool MiddleMouseMoved(
int x1,
int x2,
int y1,
int y2);
161 bool MiddleMouseDown(
int x,
int y);
162 bool MiddleMouseUp(
int x,
int y);
163 bool LeftAndRightMouseMoved(
int x1,
int x2,
int y1,
int y2);
164 bool MouseLeftWindow();
165 bool SpecialKeyPressed(
int key);
166 bool SpecialKeyUp(
int key);
167 bool StandardKeyPressed(
unsigned char ,
int ,
int );
168 bool StandardKeyUp(
unsigned char ,
int ,
int );
171 bool WindowReshape(
int width,
int height);
172 bool MouseWheelUsed(
double stepsize);
173 bool MouseMoved(
int x,
int y);
177 virtual void SetTimer(
unsigned int interval) =0;
179 virtual void DeactivateTimer() =0;
186 BIASWARN(
"Deprecated Use GetGLProjectionParametersInterface() instead");
193 BIASWARN(
"Deprecated Use DeleteGLProjectionParametersInterface() instead");
194 delete camera_; camera_ = NULL;}
215 { AutoMinZNear_ = znear; };
230 if (camera_) camera_->SetClearColor(ClearColor_);
235 bool SetBlending(
bool blend=
true);
237 bool SetBackfaceCulling(
bool cull=
true);
239 void CenterViewport(
bool center =
true);
242 void AppendView(
View* view);
246 for (
unsigned int i=0; i<scenes_.size(); i++) {
247 scenes_[i]->SetRenderBoundingBox(theswitch);
252 void EnableStencilUsage(
bool enable);
258 { bSelectionMode_ = selectionmode; };
286 #ifdef BIAS_HAVE_PTHREADS
289 #endif //BIAS_HAVE_PTHREADS
291 std::vector<View*> views_;
const GLProjectionParametersInterface * GetCamera()
get the camera
void GlobalBoundingBoxSwitch(bool theswitch)
switches rendering of bounding boxes for all scenes
void DeleteCamera()
Delete the camera.
Scene that renders a background image behind all other scenes.
const GLProjectionParametersInterface * GetGLProjectionParametersInterface()
get the camera parameters
SceneBGImage * backgroundImageScene_
Wrapper for pthread mutex for use with 'automatic' initialization.
class BIASGLviewer_EXPORT SceneBGImage
ControlInterface * control_
Abstract interface class to handle changes in rendering parameters by controllers and in rendering co...
void AppendAdditionalListener(ControlInterface *listener)
additional control listeners can be attached, or removed here
unsigned int TimerInterval_
std::vector< ControlInterface * > additionalListeners_
Listening for special keys only.
A view is a rectangular part of a render context in which a set of scenes is rendered using a GLProje...
void SetAutoClipMinZNear(double znear)
sets minimum znear for autoclipping if autoclpiing is enabled the z-near and z-far plane are computed...
Base class for all scenes.
void DeleteControl()
delete the current controller
GLProjectionParametersInterface * camera_
virtual void SetSelectionMode(bool selectionmode)
Enable or disable selection mode.
void SetClearColor(const BIAS::Vector4< float > &cc)
set the opengl clear color for color buffer
void SetAutoClipping(bool on)
Turn AutoClipping on, now the near and far clipping plane is automatically derived and set...
std::vector< SceneBase * > scenes_
class BIASGLviewer_EXPORT RenderContextBase
BIAS::Vector4< float > ClearColor_
Defines the common interface used for communication between rendering components. ...
virtual ~RenderContextBase()
const std::vector< SceneBase * > & GetScenes() const
return a vector with pointers to all attached scenes
void ClearAdditionalListeners()
virtual bool GetSelectionMode()
Get the selectinmode.
Base for all classes creating interface between GL and "window manager".