Basic Image AlgorithmS Library
2.8.0
|
base class for OpenGL canvases you could derive from to get base functionality (JW) More...
#include <Gui/OpenGLCanvasBase.hh>
Public Member Functions | |
virtual void | Display () |
main display call to be overridden by child classes usually displays: -InitWithContext (must be done and must eb first because setting up context may take some time while display is not setup correctly!) -Clear -Camera/virtual view -Geometry Implements instance More... | |
virtual void | DisplayCalls () |
virtual void | DisplayClear (const GLbitfield &mask=CLEAR_DEFAULT_MASK) |
clears buffers and resets virtual camera to identity More... | |
void | DisplayCoordCross (const float &size=1.0f, const float &linewidth=1.0f) |
virtual void | DisplayRenderMode () |
display default shade model, polygon mode, More... | |
void | DisplaySelectBuffer () |
useful for quadbuffered stereo, e.g. shutetr glasses More... | |
float | GetAspectRatio () const |
GetAspectRatio is X/Y. More... | |
unsigned long | GetFrameCount () const |
unsigned int | GetHeight () const |
virtual void | GetInfoGL (std::ostream &os) |
return GL state information More... | |
wxFrame * | GetOwnerframe () |
float | GetPixelValueDepth (const wxPoint &pos2d) const |
BIAS::Vector3< float > | GetPixelValueRGB (const wxPoint &pos2d) |
BIAS::Vector4< float > | GetPixelValueRGBA (const wxPoint &pos2d) |
unsigned int | GetWidth () const |
virtual void | InitMembers () |
any constructor should call this function to initialize all data members (e.g. More... | |
virtual void | InitWithContext () |
init all things that need a context. More... | |
bool | IsContextAvailable () |
activates the current rendereing context if there is one and More... | |
virtual void | OnChar (wxKeyEvent &event) |
void | OnEraseBackground (wxEraseEvent &event) |
void | OnPaint (wxPaintEvent &event) |
EVT handlers: ---------------------------------------—. More... | |
void | OnSize (wxSizeEvent &event) |
OpenGLCanvasBase (wxFrame *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=AsciiToWx("OpenGLCanvasBase"), int *attribList=NULL, const wxPalette &palette=wxNullPalette) | |
OpenGLCanvasBase (wxFrame *parent, wxGLContext *sharedContext=NULL, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=AsciiToWx("OpenGLCanvasBase"), int *attribList=NULL, const wxPalette &palette=wxNullPalette) | |
constructor using a shared context More... | |
virtual std::ostream & | PrintHelp (std::ostream &os) |
pop up keyboard layout help. More... | |
virtual void | Reshape () |
change of size and aspect ratio. More... | |
void | ScreenShot (BIAS::ImageBase &dest, const bool &flipY=true, const GLenum &format=GL_RGB, const bool &force8Bit=false) |
void | ScreenShot (const std::string &filename, const bool &flipY=true, const GLenum &format=GL_RGB, const bool &force8Bit=false) |
void | ScreenShot () |
JW automatic screenshot to file with filename based on frame, instance etc. More... | |
void | SetFrameCount (const unsigned long &newVal) |
void | SetOwnerframe (wxFrame *ptr) |
void | SetStatusText (const wxString &text, const int c_field=0) |
let an OpenGL canvas use the status bar of the containing frame and cout as fallback (JW) More... | |
void | ShowFPS (const int &framecounter, const float &minUpdateIntervalSec, const unsigned int &minNewFrames, const unsigned int nField) |
shows FPS to status bar base don frame counter and last call to this function Measures and updates only, if two conditions ar eboth met: More... | |
void | ShowFPS () |
simple interface for the above More... | |
void | ShowValue (const wxPoint &pos) |
void | SwapBuffers () |
expands parents SwapBUffers by automatic framecount increase More... | |
void | ToggleFullScreen () |
BIAS::Vector3< float > | Unproject (const wxPoint &pos2d, double &d) |
computes 3D coordinate from 2D+Z by "unprojection" JW More... | |
virtual void | UpdateTime () |
sets the internal time param, by default based on realtime wall clock More... | |
virtual | ~OpenGLCanvasBase () |
destructor More... | |
Static Public Member Functions | |
static void | DisplaySampleScene () |
display soem very simple Gl calls to draw something at all More... | |
static bool | GetVSync () |
static void | SetVSync (const bool &trueForOn) |
vertical sync control on or off (VSYNC) JW More... | |
static void | StereoI_CaptureStereoImage (const int &format, const int &quality) |
static float | StereoI_GetConvergence () |
static void | StereoI_GetInfo (std::ostream &os=std::cout) |
query status information on current NVStereo rendering state JW More... | |
static float | StereoI_GetSeparation () |
static int | StereoI_GetStereoState () |
wrappers for StereoI interface More... | |
static int | StereoI_Init () |
interace to NVidias consumer Stereo NVStereo driver API. More... | |
static float | StereoI_SetConvergence (const float &val) |
static float | StereoI_SetSeparation (const float &val) |
static int | StereoI_SetStereoState (const int &val) |
static bool | ToggleIP (bool &value) |
helper toggling a bool value in place More... | |
static bool | ToggleVSync () |
try to toggle VSync setting. More... | |
Static Public Attributes | |
static bool | animationUpdateEnabled = OPENGLCANVASBASE_DEFAULT_animationUpdateEnabled |
static double | time = 0.0 |
Protected Attributes | |
unsigned long | framecount_ |
bool | InitWithContextDone_ |
unsigned int | instance_ |
BIAS::DrawTextGL * | p_font |
wxFrame * | p_ownerframe |
BIAS::RenderModeGL | rendermode |
Static Protected Attributes | |
static unsigned int | instancesTotalNo_ = 0 |
base class for OpenGL canvases you could derive from to get base functionality (JW)
Has minimal dependencies and minimal event interceptions, just functionality. Use a derrived class for automatic event handling. Supports shared GL context. The idea is that you usually just need to derive and reimplement the DisplayCalls() routine. This clas is -NOT writing mous epos value to status bar -NOT updating periodically. See OpenGLCanvas for an extended version.
TODO: page flipping stereo for windows mode (no fullscreen) TODO: handle multiple rendering contexts with different caabilites (e.g 2 differen GPUs) using "GLEW MX" TODO: add application controlled VSYNC enable/disable TODO: add application controlled antialiasing settings TODO: add keys for switching between 3D stereo rendering modes TODO: Rendertexture and Framebufferobject support? TODO: support for shared display lists and vertex buffer objects (VBO,VAR)?
Use the attriblist like RGBASD for setting the correct pixel formato rliek this:
int attriblist[] = { WX_GL_RGBA, WX_GL_MIN_RED, 1, WX_GL_MIN_GREEN, 1, WX_GL_MIN_BLUE, 1, WX_GL_MIN_ALPHA, 1, WX_GL_STENCIL_SIZE, 1, WX_GL_DOUBLEBUFFER, 0 };
Definition at line 149 of file OpenGLCanvasBase.hh.
|
virtual |
destructor
Definition at line 76 of file OpenGLCanvasBase.cpp.
OpenGLCanvasBase::OpenGLCanvasBase | ( | wxFrame * | parent, |
wxWindowID | id = -1 , |
||
const wxPoint & | pos = wxDefaultPosition , |
||
const wxSize & | size = wxDefaultSize , |
||
long | style = 0 , |
||
const wxString & | name = AsciiToWx("OpenGLCanvasBase") , |
||
int * | attribList = NULL , |
||
const wxPalette & | palette = wxNullPalette |
||
) |
Definition at line 85 of file OpenGLCanvasBase.cpp.
References InitMembers(), and p_ownerframe.
OpenGLCanvasBase::OpenGLCanvasBase | ( | wxFrame * | parent, |
wxGLContext * | sharedContext = NULL , |
||
wxWindowID | id = -1 , |
||
const wxPoint & | pos = wxDefaultPosition , |
||
const wxSize & | size = wxDefaultSize , |
||
long | style = 0 , |
||
const wxString & | name = AsciiToWx("OpenGLCanvasBase") , |
||
int * | attribList = NULL , |
||
const wxPalette & | palette = wxNullPalette |
||
) |
constructor using a shared context
Definition at line 108 of file OpenGLCanvasBase.cpp.
References InitMembers(), and p_ownerframe.
|
virtual |
main display call to be overridden by child classes usually displays: -InitWithContext (must be done and must eb first because setting up context may take some time while display is not setup correctly!) -Clear -Camera/virtual view -Geometry Implements instance
begin your fancy GL calls (scene like)
<<< end of your GL calls
Reimplemented in BIAS::OpenGLCanvas.
Definition at line 294 of file OpenGLCanvasBase.cpp.
References DisplayCalls(), DisplayRenderMode(), DisplaySelectBuffer(), InitWithContext(), InitWithContextDone_, IsContextAvailable(), SwapBuffers(), and UpdateTime().
Referenced by BIAS::OpenGLCanvas::Display(), OnChar(), OnPaint(), and Reshape().
|
virtual |
begin your fancy GL calls
<<< end of your GL calls
Reimplemented in BIAS::ImageCanvasGLBase, and BIAS::SimpleGLCanvas.
Definition at line 340 of file OpenGLCanvasBase.cpp.
References DisplayClear(), and DisplaySampleScene().
Referenced by Display().
|
virtual |
clears buffers and resets virtual camera to identity
Definition at line 407 of file OpenGLCanvasBase.cpp.
References BIAS::GeometryGL::DisplayClear().
Referenced by DisplayCalls().
void OpenGLCanvasBase::DisplayCoordCross | ( | const float & | size = 1.0f , |
const float & | linewidth = 1.0f |
||
) |
Definition at line 427 of file OpenGLCanvasBase.cpp.
References BIAS::GeometryGL::DisplayCoordCross(), BIAS::GeometryGL::DisplayCoordCrossAxesLabel(), and p_font.
|
virtual |
display default shade model, polygon mode,
Definition at line 414 of file OpenGLCanvasBase.cpp.
References BIAS::GeometryGL::DisplayRenderMode(), and rendermode.
Referenced by Display().
|
static |
display soem very simple Gl calls to draw something at all
Definition at line 421 of file OpenGLCanvasBase.cpp.
References BIAS::GeometryGL::DisplaySceneExampleSimple().
Referenced by DisplayCalls().
void OpenGLCanvasBase::DisplaySelectBuffer | ( | ) |
useful for quadbuffered stereo, e.g. shutetr glasses
Definition at line 353 of file OpenGLCanvasBase.cpp.
References BIAS::RenderModeGL::drawbuffermode, BIAS::MONO, rendermode, BIAS::STEREO_CONSUMER_NV, BIAS::STEREO_LEFT_RIGHT, BIAS::STEREO_QUADBUFFERED, and BIAS::STEREO_UNTOUCHED.
Referenced by Display().
float OpenGLCanvasBase::GetAspectRatio | ( | ) | const |
GetAspectRatio is X/Y.
Definition at line 474 of file OpenGLCanvasBase.cpp.
References GetHeight(), and GetWidth().
Referenced by BIAS::OpenGLCanvas::Reshape().
|
inline |
Definition at line 301 of file OpenGLCanvasBase.hh.
unsigned int OpenGLCanvasBase::GetHeight | ( | ) | const |
Definition at line 464 of file OpenGLCanvasBase.cpp.
Referenced by GetAspectRatio(), GetPixelValueDepth(), GetPixelValueRGB(), GetPixelValueRGBA(), BIAS::OpenGLCanvas::OnMouseDown(), BIAS::OpenGLCanvas::Reshape(), Reshape(), and ScreenShot().
|
virtual |
return GL state information
return GL state info
Reimplemented in BIAS::OpenGLCanvas.
Definition at line 271 of file OpenGLCanvasBase.cpp.
References BIAS::GeometryGL::GetInfoGL(), instance_, and StereoI_GetInfo().
Referenced by BIAS::OpenGLCanvas::GetInfoGL(), and OnChar().
wxFrame * OpenGLCanvasBase::GetOwnerframe | ( | ) |
Definition at line 258 of file OpenGLCanvasBase.cpp.
References p_ownerframe.
float OpenGLCanvasBase::GetPixelValueDepth | ( | const wxPoint & | pos2d | ) | const |
Definition at line 520 of file OpenGLCanvasBase.cpp.
References GetHeight().
Referenced by ShowValue().
BIAS::Vector3< float > OpenGLCanvasBase::GetPixelValueRGB | ( | const wxPoint & | pos2d | ) |
Definition at line 481 of file OpenGLCanvasBase.cpp.
References GetHeight(), IsContextAvailable(), and BIAS::Vector3< T >::Set().
BIAS::Vector4< float > OpenGLCanvasBase::GetPixelValueRGBA | ( | const wxPoint & | pos2d | ) |
Definition at line 501 of file OpenGLCanvasBase.cpp.
References GetHeight(), IsContextAvailable(), and BIAS::Vector4< T >::Set().
Referenced by ShowValue().
|
static |
@return true if vertical sync is enable,
false for free running mode JW
Definition at line 1153 of file OpenGLCanvasBase.cpp.
References BIAS::SettingsGL::GetVSyncInterval().
Referenced by InitWithContext(), OnChar(), and ToggleVSync().
unsigned int OpenGLCanvasBase::GetWidth | ( | ) | const |
Definition at line 455 of file OpenGLCanvasBase.cpp.
Referenced by GetAspectRatio(), BIAS::OpenGLCanvas::OnMouseDown(), BIAS::OpenGLCanvas::Reshape(), Reshape(), and ScreenShot().
|
virtual |
any constructor should call this function to initialize all data members (e.g.
pointers to NULL)
Reimplemented in BIAS::OpenGLCanvas, and BIAS::ImageCanvasGLBase.
Definition at line 132 of file OpenGLCanvasBase.cpp.
References animationUpdateEnabled, framecount_, InitWithContextDone_, instance_, and instancesTotalNo_.
Referenced by BIAS::OpenGLCanvas::InitMembers(), and OpenGLCanvasBase().
|
virtual |
init all things that need a context.
sets _InitWithContextDone
OK, we have a (valid) Gl Context run init with context once
Definition at line 143 of file OpenGLCanvasBase.cpp.
References BIAS::Singleton< GlutInitWrapper >::GetInstance(), GetVSync(), BIAS::GlutInitWrapper::Init(), BIAS::DrawTextGL::InitFont(), InitWithContextDone_, IsContextAvailable(), p_font, rendermode, SetVSync(), and BIAS::RenderModeGL::vsync.
Referenced by Display().
bool OpenGLCanvasBase::IsContextAvailable | ( | ) |
activates the current rendereing context if there is one and
Definition at line 224 of file OpenGLCanvasBase.cpp.
Referenced by Display(), GetPixelValueRGB(), GetPixelValueRGBA(), and InitWithContext().
|
virtual |
Definition at line 963 of file OpenGLCanvasBase.cpp.
References animationUpdateEnabled, BIAS::AsciiToWx(), BIAS::RenderModeGL::cullface, Display(), BIAS::RenderModeGL::enable_cullface, GetInfoGL(), GetVSync(), BIAS::RenderModeGL::pointsize, BIAS::RenderModeGL::polygonmodeBACK, BIAS::RenderModeGL::polygonmodeFRONT, PrintHelp(), rendermode, ScreenShot(), SetStatusText(), BIAS::RenderModeGL::shademodel, StereoI_GetInfo(), ToggleFullScreen(), and ToggleVSync().
void OpenGLCanvasBase::OnEraseBackground | ( | wxEraseEvent & | event | ) |
Definition at line 1138 of file OpenGLCanvasBase.cpp.
void OpenGLCanvasBase::OnPaint | ( | wxPaintEvent & | event | ) |
EVT handlers: ---------------------------------------—.
Definition at line 920 of file OpenGLCanvasBase.cpp.
References Display().
void OpenGLCanvasBase::OnSize | ( | wxSizeEvent & | event | ) |
Definition at line 929 of file OpenGLCanvasBase.cpp.
References Reshape().
|
virtual |
pop up keyboard layout help.
Must be virtual to let child class add their bindings
Definition at line 935 of file OpenGLCanvasBase.cpp.
Referenced by OnChar().
|
virtual |
change of size and aspect ratio.
Reimplemented in BIAS::OpenGLCanvas.
Definition at line 445 of file OpenGLCanvasBase.cpp.
References Display(), GetHeight(), and GetWidth().
Referenced by OnSize().
void OpenGLCanvasBase::ScreenShot | ( | BIAS::ImageBase & | dest, |
const bool & | flipY = true , |
||
const GLenum & | format = GL_RGB , |
||
const bool & | force8Bit = false |
||
) |
Definition at line 599 of file OpenGLCanvasBase.cpp.
References BIAS::ImageBase::Flip(), BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetDepth(), GetHeight(), BIAS::ImageBase::GetHeight(), BIAS::ImageBase::GetImageData(), GetWidth(), BIAS::ImageBase::GetWidth(), BIAS::ImageBase::Init(), BIAS::ImageBase::IsEmpty(), BIAS::ImageBase::Release(), BIAS::ImageBase::ST_float, and BIAS::ImageBase::ST_unsignedchar.
void OpenGLCanvasBase::ScreenShot | ( | const std::string & | filename, |
const bool & | flipY = true , |
||
const GLenum & | format = GL_RGB , |
||
const bool & | force8Bit = false |
||
) |
Definition at line 573 of file OpenGLCanvasBase.cpp.
References GetHeight(), GetWidth(), BIAS::ImageIO::Save(), and ScreenShot().
void OpenGLCanvasBase::ScreenShot | ( | ) |
JW automatic screenshot to file with filename based on frame, instance etc.
JW
Definition at line 687 of file OpenGLCanvasBase.cpp.
References framecount_, instance_, and BIAS::FileHandling::LeadingZeroString().
Referenced by OnChar(), and ScreenShot().
|
inline |
Definition at line 302 of file OpenGLCanvasBase.hh.
void OpenGLCanvasBase::SetOwnerframe | ( | wxFrame * | ptr | ) |
Definition at line 264 of file OpenGLCanvasBase.cpp.
References p_ownerframe.
void OpenGLCanvasBase::SetStatusText | ( | const wxString & | text, |
const int | c_field = 0 |
||
) |
let an OpenGL canvas use the status bar of the containing frame and cout as fallback (JW)
Definition at line 747 of file OpenGLCanvasBase.cpp.
References p_ownerframe.
Referenced by OnChar(), ShowFPS(), and ShowValue().
|
static |
vertical sync control on or off (VSYNC) JW
Definition at line 1144 of file OpenGLCanvasBase.cpp.
References BIAS::SettingsGL::SetVSyncInterval().
Referenced by InitWithContext(), and ToggleVSync().
void OpenGLCanvasBase::ShowFPS | ( | const int & | framecounter, |
const float & | minUpdateIntervalSec, | ||
const unsigned int & | minNewFrames, | ||
const unsigned int | nField | ||
) |
shows FPS to status bar base don frame counter and last call to this function
Measures and updates only, if two conditions ar eboth met:
Definition at line 826 of file OpenGLCanvasBase.cpp.
References BIAS::AsciiToWx(), and SetStatusText().
void OpenGLCanvasBase::ShowFPS | ( | ) |
simple interface for the above
Definition at line 906 of file OpenGLCanvasBase.cpp.
References framecount_.
Referenced by BIAS::OpenGLCanvas::OnIdle().
void OpenGLCanvasBase::ShowValue | ( | const wxPoint & | pos | ) |
Definition at line 786 of file OpenGLCanvasBase.cpp.
References BIAS::AsciiToWx(), GetPixelValueDepth(), GetPixelValueRGBA(), SetStatusText(), and Unproject().
Referenced by BIAS::OpenGLCanvas::OnMotion().
|
static |
Definition at line 1303 of file OpenGLCanvasBase.cpp.
|
static |
Definition at line 1287 of file OpenGLCanvasBase.cpp.
|
static |
query status information on current NVStereo rendering state JW
Definition at line 1222 of file OpenGLCanvasBase.cpp.
References StereoI_Init().
Referenced by GetInfoGL(), OnChar(), and StereoI_Init().
|
static |
Definition at line 1271 of file OpenGLCanvasBase.cpp.
|
static |
wrappers for StereoI interface
Definition at line 1255 of file OpenGLCanvasBase.cpp.
|
static |
interace to NVidias consumer Stereo NVStereo driver API.
to enable/disbale stereo and control convergence and separation for stereo rendering
Definition at line 1181 of file OpenGLCanvasBase.cpp.
References StereoI_GetInfo().
Referenced by StereoI_GetInfo().
|
static |
Definition at line 1295 of file OpenGLCanvasBase.cpp.
|
static |
Definition at line 1279 of file OpenGLCanvasBase.cpp.
|
static |
Definition at line 1263 of file OpenGLCanvasBase.cpp.
void OpenGLCanvasBase::SwapBuffers | ( | ) |
expands parents SwapBUffers by automatic framecount increase
Definition at line 288 of file OpenGLCanvasBase.cpp.
References framecount_.
Referenced by Display().
void OpenGLCanvasBase::ToggleFullScreen | ( | ) |
Definition at line 882 of file OpenGLCanvasBase.cpp.
References BIAS::RenderModeGL::drawbuffermode, p_ownerframe, rendermode, and BIAS::STEREO_CONSUMER_NV.
Referenced by OnChar().
|
static |
helper toggling a bool value in place
Definition at line 1173 of file OpenGLCanvasBase.cpp.
|
static |
try to toggle VSync setting.
Definition at line 1159 of file OpenGLCanvasBase.cpp.
References GetVSync(), and SetVSync().
Referenced by OnChar().
BIAS::Vector3< float > OpenGLCanvasBase::Unproject | ( | const wxPoint & | pos2d, |
double & | d | ||
) |
computes 3D coordinate from 2D+Z by "unprojection" JW
Definition at line 536 of file OpenGLCanvasBase.cpp.
Referenced by ShowValue().
|
virtual |
sets the internal time param, by default based on realtime wall clock
Reimplemented in BIAS::OpenGLCanvas.
Definition at line 1168 of file OpenGLCanvasBase.cpp.
Referenced by Display(), and BIAS::OpenGLCanvas::UpdateTime().
|
static |
Definition at line 354 of file OpenGLCanvasBase.hh.
Referenced by InitMembers(), OnChar(), and BIAS::OpenGLCanvas::UpdateTime().
|
protected |
Definition at line 359 of file OpenGLCanvasBase.hh.
Referenced by InitMembers(), ScreenShot(), ShowFPS(), and SwapBuffers().
|
protected |
Definition at line 365 of file OpenGLCanvasBase.hh.
Referenced by Display(), InitMembers(), and InitWithContext().
|
protected |
Definition at line 367 of file OpenGLCanvasBase.hh.
Referenced by GetInfoGL(), InitMembers(), and ScreenShot().
|
staticprotected |
Definition at line 368 of file OpenGLCanvasBase.hh.
Referenced by InitMembers().
|
protected |
Definition at line 376 of file OpenGLCanvasBase.hh.
Referenced by DisplayCoordCross(), and InitWithContext().
|
protected |
Definition at line 362 of file OpenGLCanvasBase.hh.
Referenced by GetOwnerframe(), OpenGLCanvasBase(), SetOwnerframe(), SetStatusText(), and ToggleFullScreen().
|
protected |
Definition at line 371 of file OpenGLCanvasBase.hh.
Referenced by DisplayRenderMode(), DisplaySelectBuffer(), InitWithContext(), OnChar(), and ToggleFullScreen().
|
static |
Definition at line 352 of file OpenGLCanvasBase.hh.
Referenced by BIAS::OpenGLCanvas::UpdateTime().