From Brandon Hamm, changed WxWindows example to use double buffering
This commit is contained in:
parent
020d7a5651
commit
b74083ad15
@ -27,15 +27,22 @@ bool wxOsgApp::OnInit()
|
|||||||
|
|
||||||
// create osg canvas
|
// create osg canvas
|
||||||
// - initialize
|
// - initialize
|
||||||
|
|
||||||
|
|
||||||
int width = 800;
|
int width = 800;
|
||||||
int height = 600;
|
int height = 600;
|
||||||
|
|
||||||
|
int *attributes = new int[6];
|
||||||
|
attributes[0] = int(WX_GL_DOUBLEBUFFER);
|
||||||
|
attributes[1] = WX_GL_RGBA;
|
||||||
|
attributes[2] = WX_GL_DEPTH_SIZE;
|
||||||
|
attributes[3] = 8;
|
||||||
|
attributes[4] = WX_GL_STENCIL_SIZE;
|
||||||
|
attributes[5] = 8;
|
||||||
|
|
||||||
GraphicsWindowWX* gw = new GraphicsWindowWX(frame, wxID_ANY, wxDefaultPosition,
|
GraphicsWindowWX* gw = new GraphicsWindowWX(frame, wxID_ANY, wxDefaultPosition,
|
||||||
wxSize(width, height), wxSUNKEN_BORDER);
|
wxSize(width, height), wxSUNKEN_BORDER, wxT("osgviewerWX"), attributes);
|
||||||
|
|
||||||
|
|
||||||
osgViewer::Viewer *viewer = new osgViewer::Viewer;
|
osgViewer::Viewer *viewer = new osgViewer::Viewer;
|
||||||
viewer->getCamera()->setGraphicsContext(gw);
|
viewer->getCamera()->setGraphicsContext(gw);
|
||||||
viewer->getCamera()->setViewport(0,0,width,height);
|
viewer->getCamera()->setViewport(0,0,width,height);
|
||||||
@ -95,8 +102,8 @@ BEGIN_EVENT_TABLE(GraphicsWindowWX, wxGLCanvas)
|
|||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
GraphicsWindowWX::GraphicsWindowWX(wxWindow *parent, wxWindowID id,
|
GraphicsWindowWX::GraphicsWindowWX(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name)
|
const wxPoint& pos, const wxSize& size, long style, const wxString& name, int *attributes)
|
||||||
: wxGLCanvas(parent, id, pos, size, style|wxFULL_REPAINT_ON_RESIZE, name)
|
: wxGLCanvas(parent, id, pos, size, style|wxFULL_REPAINT_ON_RESIZE, name, attributes)
|
||||||
{
|
{
|
||||||
// default cursor to standard
|
// default cursor to standard
|
||||||
_oldCursor = *wxSTANDARD_CURSOR;
|
_oldCursor = *wxSTANDARD_CURSOR;
|
||||||
|
@ -8,13 +8,14 @@
|
|||||||
#include <osgViewer/Viewer>
|
#include <osgViewer/Viewer>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class GraphicsWindowWX: public wxGLCanvas, public osgViewer::GraphicsWindow
|
class GraphicsWindowWX : public wxGLCanvas, public osgViewer::GraphicsWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GraphicsWindowWX(wxWindow *parent, wxWindowID id = wxID_ANY,
|
GraphicsWindowWX(wxWindow *parent, wxWindowID id = wxID_ANY,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize, long style = 0,
|
const wxSize& size = wxDefaultSize, long style = 0,
|
||||||
const wxString& name = wxT("TestGLCanvas"));
|
const wxString& name = wxT("TestGLCanvas"),
|
||||||
|
int *attributes = 0);
|
||||||
|
|
||||||
~GraphicsWindowWX();
|
~GraphicsWindowWX();
|
||||||
|
|
||||||
@ -30,7 +31,6 @@ public:
|
|||||||
//
|
//
|
||||||
// GraphicsWindow interface
|
// GraphicsWindow interface
|
||||||
//
|
//
|
||||||
|
|
||||||
void grabFocus();
|
void grabFocus();
|
||||||
void grabFocusIfPointerInWindow();
|
void grabFocusIfPointerInWindow();
|
||||||
void useCursor(bool cursorOn);
|
void useCursor(bool cursorOn);
|
||||||
|
Loading…
Reference in New Issue
Block a user