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