image update
listbox fix iODBC fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1378 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -52,33 +52,12 @@ bool MyApp::OnInit(void)
|
||||
|
||||
frame->m_canvas = new TestGLCanvas(frame, -1, wxPoint(0, 0), wxSize(200, 200));
|
||||
|
||||
// InitGL();
|
||||
|
||||
// Show the frame
|
||||
frame->Show(TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void MyApp::InitGL(void)
|
||||
{
|
||||
/* set viewing projection */
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glFrustum(-0.5F, 0.5F, -0.5F, 0.5F, 1.0F, 3.0F);
|
||||
|
||||
/* position viewer */
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glTranslatef(0.0F, 0.0F, -2.0F);
|
||||
|
||||
/* position object */
|
||||
glRotatef(30.0F, 1.0F, 0.0F, 0.0F);
|
||||
glRotatef(30.0F, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
}
|
||||
|
||||
IMPLEMENT_APP(MyApp)
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
@@ -114,6 +93,7 @@ TestGLCanvas::TestGLCanvas(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name):
|
||||
wxGLCanvas(parent, id, pos, size, style, name)
|
||||
{
|
||||
m_init = FALSE;
|
||||
}
|
||||
|
||||
TestGLCanvas::~TestGLCanvas(void)
|
||||
@@ -126,11 +106,17 @@ void TestGLCanvas::OnPaint( wxPaintEvent& event )
|
||||
// OnPaint handlers must always create a wxPaintDC.
|
||||
wxPaintDC dc(this);
|
||||
|
||||
if ( !GetContext() )
|
||||
return;
|
||||
if (!GetContext()) return;
|
||||
|
||||
SetCurrent();
|
||||
|
||||
/* init OpenGL once, but after SetCurrent */
|
||||
if (!m_init)
|
||||
{
|
||||
InitGL();
|
||||
m_init = TRUE;
|
||||
}
|
||||
|
||||
/* clear color and depth buffers */
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
@@ -181,3 +167,22 @@ void TestGLCanvas::OnEraseBackground(wxEraseEvent& event)
|
||||
// Do nothing, to avoid flashing.
|
||||
}
|
||||
|
||||
void TestGLCanvas::InitGL(void)
|
||||
{
|
||||
/* set viewing projection */
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glFrustum(-0.5F, 0.5F, -0.5F, 0.5F, 1.0F, 3.0F);
|
||||
|
||||
/* position viewer */
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glTranslatef(0.0F, 0.0F, -2.0F);
|
||||
|
||||
/* position object */
|
||||
glRotatef(30.0F, 1.0F, 0.0F, 0.0F);
|
||||
glRotatef(30.0F, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user