Applied patch [ 802596 ] warning and error free Open GL samples
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23491 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -36,6 +36,8 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#if wxUSE_GLCANVAS
|
||||
|
||||
#define MK_ID(a,b,c,d) ((((wxUint32)(a))<<24)| \
|
||||
(((wxUint32)(b))<<16)| \
|
||||
(((wxUint32)(c))<< 8)| \
|
||||
@@ -435,4 +437,5 @@ void lw_object_scale(lwObject *lwo, GLfloat scale)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -61,6 +61,7 @@ typedef struct {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if wxUSE_GLCANVAS
|
||||
int lw_is_lwobject(const char *lw_file);
|
||||
lwObject *lw_object_read(const char *lw_file);
|
||||
void lw_object_free( lwObject *lw_object);
|
||||
@@ -68,6 +69,7 @@ void lw_object_show(const lwObject *lw_object);
|
||||
|
||||
GLfloat lw_object_radius(const lwObject *lw_object);
|
||||
void lw_object_scale (lwObject *lw_object, GLfloat scale);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -25,10 +25,6 @@
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#if !wxUSE_GLCANVAS
|
||||
#error Please set wxUSE_GLCANVAS to 1 in setup.h.
|
||||
#endif
|
||||
|
||||
#include "penguin.h"
|
||||
#ifdef __WXMAC__
|
||||
# ifdef __DARWIN__
|
||||
@@ -57,6 +53,7 @@ bool MyApp::OnInit()
|
||||
menuBar->Append(fileMenu, wxT("&File"));
|
||||
frame->SetMenuBar(menuBar);
|
||||
|
||||
#if wxUSE_GLCANVAS
|
||||
frame->SetCanvas( new TestGLCanvas(frame, -1, wxPoint(0, 0), wxSize(200, 200), wxSUNKEN_BORDER) );
|
||||
|
||||
/* Load file wiht mesh data */
|
||||
@@ -66,6 +63,13 @@ bool MyApp::OnInit()
|
||||
frame->Show(TRUE);
|
||||
|
||||
return TRUE;
|
||||
#else
|
||||
|
||||
wxMessageBox( _T("This sample has to be compiled with wxUSE_GLCANVAS"), _T("Building error"), wxOK);
|
||||
|
||||
return FALSE;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
IMPLEMENT_APP(MyApp)
|
||||
@@ -79,15 +83,19 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos,
|
||||
const wxSize& size, long style):
|
||||
wxFrame(frame, -1, title, pos, size, style)
|
||||
{
|
||||
#if wxUSE_GLCANVAS
|
||||
m_canvas = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Intercept menu commands */
|
||||
void MyFrame::OnExit(wxCommandEvent& event)
|
||||
void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
#if wxUSE_GLCANVAS
|
||||
|
||||
BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)
|
||||
EVT_SIZE(TestGLCanvas::OnSize)
|
||||
EVT_PAINT(TestGLCanvas::OnPaint)
|
||||
@@ -108,7 +116,7 @@ TestGLCanvas::~TestGLCanvas(void)
|
||||
lw_object_free(info.lwobject);
|
||||
}
|
||||
|
||||
void TestGLCanvas::OnPaint( wxPaintEvent& event )
|
||||
void TestGLCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) )
|
||||
{
|
||||
/* must always be here */
|
||||
wxPaintDC dc(this);
|
||||
@@ -170,7 +178,7 @@ void TestGLCanvas::OnSize(wxSizeEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
void TestGLCanvas::OnEraseBackground(wxEraseEvent& event)
|
||||
void TestGLCanvas::OnEraseBackground(wxEraseEvent& WXUNUSED(event))
|
||||
{
|
||||
/* Do nothing, to avoid flashing on MSW */
|
||||
}
|
||||
@@ -249,3 +257,4 @@ void TestGLCanvas::InitGL(void)
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -55,15 +55,19 @@ public:
|
||||
|
||||
void OnExit(wxCommandEvent& event);
|
||||
|
||||
#if wxUSE_GLCANVAS
|
||||
void SetCanvas( TestGLCanvas *canvas ) { m_canvas = canvas; }
|
||||
TestGLCanvas *GetCanvas() { return m_canvas; }
|
||||
|
||||
private:
|
||||
TestGLCanvas* m_canvas;
|
||||
#endif
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#if wxUSE_GLCANVAS
|
||||
|
||||
class TestGLCanvas: public wxGLCanvas
|
||||
{
|
||||
public:
|
||||
@@ -87,3 +91,5 @@ private:
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user