give an #error if wxUSE_GLCANVAS == 0 instead of building empty samples
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29830 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -25,6 +25,10 @@
|
|||||||
#include "wx/wx.h"
|
#include "wx/wx.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !wxUSE_GLCANVAS
|
||||||
|
#error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "cube.h"
|
#include "cube.h"
|
||||||
|
|
||||||
#ifndef __WXMSW__ // for wxStopWatch, see remark below
|
#ifndef __WXMSW__ // for wxStopWatch, see remark below
|
||||||
@@ -162,8 +166,6 @@ unsigned long wxStopWatch( unsigned long *sec_base )
|
|||||||
Implementation of Test-GLCanvas
|
Implementation of Test-GLCanvas
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
|
|
||||||
#if wxUSE_GLCANVAS
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)
|
BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)
|
||||||
EVT_SIZE(TestGLCanvas::OnSize)
|
EVT_SIZE(TestGLCanvas::OnSize)
|
||||||
EVT_PAINT(TestGLCanvas::OnPaint)
|
EVT_PAINT(TestGLCanvas::OnPaint)
|
||||||
@@ -421,8 +423,6 @@ void TestGLCanvas::Rotate( GLfloat deg )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // wxUSE_GLCANVAS
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------
|
/* -----------------------------------------------------------------------
|
||||||
Main Window
|
Main Window
|
||||||
-------------------------------------------------------------------------*/
|
-------------------------------------------------------------------------*/
|
||||||
@@ -477,7 +477,6 @@ void MyFrame::OnExit( wxCommandEvent& WXUNUSED(event) )
|
|||||||
|
|
||||||
frame->SetMenuBar(menuBar);
|
frame->SetMenuBar(menuBar);
|
||||||
|
|
||||||
#if wxUSE_GLCANVAS
|
|
||||||
if (parentFrame)
|
if (parentFrame)
|
||||||
{
|
{
|
||||||
frame->m_canvas = new TestGLCanvas( frame, parentFrame->m_canvas,
|
frame->m_canvas = new TestGLCanvas( frame, parentFrame->m_canvas,
|
||||||
@@ -488,7 +487,6 @@ void MyFrame::OnExit( wxCommandEvent& WXUNUSED(event) )
|
|||||||
frame->m_canvas = new TestGLCanvas(frame, wxID_ANY,
|
frame->m_canvas = new TestGLCanvas(frame, wxID_ANY,
|
||||||
wxDefaultPosition, wxDefaultSize);
|
wxDefaultPosition, wxDefaultSize);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Show the frame
|
// Show the frame
|
||||||
frame->Show(true);
|
frame->Show(true);
|
||||||
@@ -503,7 +501,6 @@ void MyFrame::OnNewWindow( wxCommandEvent& WXUNUSED(event) )
|
|||||||
|
|
||||||
void MyFrame::OnDefRotateLeftKey( wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::OnDefRotateLeftKey( wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
#if wxUSE_GLCANVAS
|
|
||||||
ScanCodeDialog dial( this, wxID_ANY, m_canvas->m_rleft,
|
ScanCodeDialog dial( this, wxID_ANY, m_canvas->m_rleft,
|
||||||
wxString(_T("Left")), _T("Define key") );
|
wxString(_T("Left")), _T("Define key") );
|
||||||
|
|
||||||
@@ -511,12 +508,10 @@ void MyFrame::OnDefRotateLeftKey( wxCommandEvent& WXUNUSED(event) )
|
|||||||
|
|
||||||
if( result == wxID_OK )
|
if( result == wxID_OK )
|
||||||
m_canvas->m_rleft = dial.GetValue();
|
m_canvas->m_rleft = dial.GetValue();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnDefRotateRightKey( wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::OnDefRotateRightKey( wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
#if wxUSE_GLCANVAS
|
|
||||||
ScanCodeDialog dial( this, wxID_ANY, m_canvas->m_rright,
|
ScanCodeDialog dial( this, wxID_ANY, m_canvas->m_rright,
|
||||||
wxString(_T("Right")), _T("Define key") );
|
wxString(_T("Right")), _T("Define key") );
|
||||||
|
|
||||||
@@ -524,7 +519,6 @@ void MyFrame::OnDefRotateRightKey( wxCommandEvent& WXUNUSED(event) )
|
|||||||
|
|
||||||
if( result == wxID_OK )
|
if( result == wxID_OK )
|
||||||
m_canvas->m_rright = dial.GetValue();
|
m_canvas->m_rright = dial.GetValue();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------------
|
/*------------------------------------------------------------------
|
||||||
@@ -535,24 +529,8 @@ IMPLEMENT_APP(MyApp)
|
|||||||
|
|
||||||
bool MyApp::OnInit()
|
bool MyApp::OnInit()
|
||||||
{
|
{
|
||||||
#if wxUSE_LOG
|
|
||||||
wxLog::SetTraceMask(wxTraceMessages);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Create the main frame window
|
// Create the main frame window
|
||||||
(void) MyFrame::Create(NULL);
|
(void) MyFrame::Create(NULL);
|
||||||
|
|
||||||
#if wxUSE_GLCANVAS
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
wxMessageBox( _T("This sample has to be compiled with wxUSE_GLCANVAS"),
|
|
||||||
_T("Building error"), wxOK);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -25,6 +25,10 @@
|
|||||||
#include "wx/wx.h"
|
#include "wx/wx.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !wxUSE_GLCANVAS
|
||||||
|
#error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "wx/timer.h"
|
#include "wx/timer.h"
|
||||||
#include "wx/glcanvas.h"
|
#include "wx/glcanvas.h"
|
||||||
|
|
||||||
@@ -288,8 +292,6 @@ bool MyApp::OnInit()
|
|||||||
doubleBuffer = GL_FALSE;
|
doubleBuffer = GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_GLCANVAS
|
|
||||||
|
|
||||||
frame->m_canvas = new TestGLCanvas(frame, wxID_ANY, wxDefaultPosition,
|
frame->m_canvas = new TestGLCanvas(frame, wxID_ANY, wxDefaultPosition,
|
||||||
wxDefaultSize, 0, _T("TestGLCanvas"), gl_attrib );
|
wxDefaultSize, 0, _T("TestGLCanvas"), gl_attrib );
|
||||||
|
|
||||||
@@ -302,13 +304,6 @@ bool MyApp::OnInit()
|
|||||||
Init();
|
Init();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
wxMessageBox( _T("This sample has to be compiled with wxUSE_GLCANVAS"), _T("Building error"), wxOK);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||||
@@ -320,19 +315,12 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos,
|
|||||||
const wxSize& size, long style)
|
const wxSize& size, long style)
|
||||||
: wxFrame(frame, wxID_ANY, title, pos, size, style)
|
: wxFrame(frame, wxID_ANY, title, pos, size, style)
|
||||||
{
|
{
|
||||||
#if wxUSE_GLCANVAS
|
|
||||||
m_canvas = NULL;
|
m_canvas = NULL;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MyFrame::~MyFrame()
|
MyFrame::~MyFrame()
|
||||||
{
|
{
|
||||||
#if wxUSE_GLCANVAS
|
delete m_canvas;
|
||||||
if (m_canvas)
|
|
||||||
{
|
|
||||||
delete m_canvas; m_canvas = NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Intercept menu commands
|
// Intercept menu commands
|
||||||
@@ -346,8 +334,6 @@ void MyFrame::OnExit( wxCommandEvent& WXUNUSED(event) )
|
|||||||
* TestGLCanvas implementation
|
* TestGLCanvas implementation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if wxUSE_GLCANVAS
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)
|
BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)
|
||||||
EVT_SIZE(TestGLCanvas::OnSize)
|
EVT_SIZE(TestGLCanvas::OnSize)
|
||||||
EVT_PAINT(TestGLCanvas::OnPaint)
|
EVT_PAINT(TestGLCanvas::OnPaint)
|
||||||
@@ -493,5 +479,3 @@ void TestGLCanvas::OnEraseBackground( wxEraseEvent& WXUNUSED(event) )
|
|||||||
// Do nothing, to avoid flashing.
|
// Do nothing, to avoid flashing.
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // #if wxUSE_GLCANVAS
|
|
||||||
|
|
||||||
|
@@ -25,6 +25,10 @@
|
|||||||
#include "wx/wx.h"
|
#include "wx/wx.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !wxUSE_GLCANVAS
|
||||||
|
#error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "penguin.h"
|
#include "penguin.h"
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
# ifdef __DARWIN__
|
# ifdef __DARWIN__
|
||||||
@@ -54,7 +58,6 @@ bool MyApp::OnInit()
|
|||||||
menuBar->Append(fileMenu, wxT("&File"));
|
menuBar->Append(fileMenu, wxT("&File"));
|
||||||
frame->SetMenuBar(menuBar);
|
frame->SetMenuBar(menuBar);
|
||||||
|
|
||||||
#if wxUSE_GLCANVAS
|
|
||||||
frame->SetCanvas( new TestGLCanvas(frame, wxID_ANY, wxDefaultPosition,
|
frame->SetCanvas( new TestGLCanvas(frame, wxID_ANY, wxDefaultPosition,
|
||||||
wxSize(200, 200), wxSUNKEN_BORDER) );
|
wxSize(200, 200), wxSUNKEN_BORDER) );
|
||||||
|
|
||||||
@@ -65,14 +68,6 @@ bool MyApp::OnInit()
|
|||||||
frame->Show(true);
|
frame->Show(true);
|
||||||
|
|
||||||
return 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)
|
IMPLEMENT_APP(MyApp)
|
||||||
@@ -86,9 +81,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos,
|
|||||||
const wxSize& size, long style)
|
const wxSize& size, long style)
|
||||||
: wxFrame(frame, wxID_ANY, title, pos, size, style)
|
: wxFrame(frame, wxID_ANY, title, pos, size, style)
|
||||||
{
|
{
|
||||||
#if wxUSE_GLCANVAS
|
|
||||||
m_canvas = NULL;
|
m_canvas = NULL;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Intercept menu commands */
|
/* Intercept menu commands */
|
||||||
@@ -98,8 +91,6 @@ void MyFrame::OnExit( wxCommandEvent& WXUNUSED(event) )
|
|||||||
Close(true);
|
Close(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_GLCANVAS
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)
|
BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)
|
||||||
EVT_SIZE(TestGLCanvas::OnSize)
|
EVT_SIZE(TestGLCanvas::OnSize)
|
||||||
EVT_PAINT(TestGLCanvas::OnPaint)
|
EVT_PAINT(TestGLCanvas::OnPaint)
|
||||||
@@ -267,5 +258,3 @@ void TestGLCanvas::InitGL()
|
|||||||
glEnable(GL_COLOR_MATERIAL);
|
glEnable(GL_COLOR_MATERIAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // #if wxUSE_GLCANVAS
|
|
||||||
|
Reference in New Issue
Block a user