git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29830
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#include "wx/wx.h"
#endif
#include "wx/wx.h"
#endif
+#if !wxUSE_GLCANVAS
+ #error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"
+#endif
+
#include "cube.h"
#ifndef __WXMSW__ // for wxStopWatch, see remark below
#include "cube.h"
#ifndef __WXMSW__ // for wxStopWatch, see remark below
Implementation of Test-GLCanvas
-----------------------------------------------------------------*/
Implementation of Test-GLCanvas
-----------------------------------------------------------------*/
BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)
EVT_SIZE(TestGLCanvas::OnSize)
EVT_PAINT(TestGLCanvas::OnPaint)
BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)
EVT_SIZE(TestGLCanvas::OnSize)
EVT_PAINT(TestGLCanvas::OnPaint)
-#endif // wxUSE_GLCANVAS
-
/* -----------------------------------------------------------------------
Main Window
-------------------------------------------------------------------------*/
/* -----------------------------------------------------------------------
Main Window
-------------------------------------------------------------------------*/
frame->SetMenuBar(menuBar);
frame->SetMenuBar(menuBar);
if (parentFrame)
{
frame->m_canvas = new TestGLCanvas( frame, parentFrame->m_canvas,
if (parentFrame)
{
frame->m_canvas = new TestGLCanvas( frame, parentFrame->m_canvas,
frame->m_canvas = new TestGLCanvas(frame, wxID_ANY,
wxDefaultPosition, wxDefaultSize);
}
frame->m_canvas = new TestGLCanvas(frame, wxID_ANY,
wxDefaultPosition, wxDefaultSize);
}
// Show the frame
frame->Show(true);
// Show the frame
frame->Show(true);
void MyFrame::OnDefRotateLeftKey( wxCommandEvent& WXUNUSED(event) )
{
void MyFrame::OnDefRotateLeftKey( wxCommandEvent& WXUNUSED(event) )
{
ScanCodeDialog dial( this, wxID_ANY, m_canvas->m_rleft,
wxString(_T("Left")), _T("Define key") );
ScanCodeDialog dial( this, wxID_ANY, m_canvas->m_rleft,
wxString(_T("Left")), _T("Define key") );
if( result == wxID_OK )
m_canvas->m_rleft = dial.GetValue();
if( result == wxID_OK )
m_canvas->m_rleft = dial.GetValue();
}
void MyFrame::OnDefRotateRightKey( wxCommandEvent& WXUNUSED(event) )
{
}
void MyFrame::OnDefRotateRightKey( wxCommandEvent& WXUNUSED(event) )
{
ScanCodeDialog dial( this, wxID_ANY, m_canvas->m_rright,
wxString(_T("Right")), _T("Define key") );
ScanCodeDialog dial( this, wxID_ANY, m_canvas->m_rright,
wxString(_T("Right")), _T("Define key") );
if( result == wxID_OK )
m_canvas->m_rright = dial.GetValue();
if( result == wxID_OK )
m_canvas->m_rright = dial.GetValue();
}
/*------------------------------------------------------------------
}
/*------------------------------------------------------------------
-#if wxUSE_LOG
- wxLog::SetTraceMask(wxTraceMessages);
-#endif
-
// Create the main frame window
(void) MyFrame::Create(NULL);
// Create the main frame window
(void) MyFrame::Create(NULL);
-
-#else
-
- wxMessageBox( _T("This sample has to be compiled with wxUSE_GLCANVAS"),
- _T("Building error"), wxOK);
-
- return false;
-
-#endif
-
#include "wx/wx.h"
#endif
#include "wx/wx.h"
#endif
+#if !wxUSE_GLCANVAS
+ #error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"
+#endif
+
#include "wx/timer.h"
#include "wx/glcanvas.h"
#include "wx/timer.h"
#include "wx/glcanvas.h"
doubleBuffer = GL_FALSE;
}
doubleBuffer = GL_FALSE;
}
frame->m_canvas = new TestGLCanvas(frame, wxID_ANY, wxDefaultPosition,
wxDefaultSize, 0, _T("TestGLCanvas"), gl_attrib );
frame->m_canvas = new TestGLCanvas(frame, wxID_ANY, wxDefaultPosition,
wxDefaultSize, 0, _T("TestGLCanvas"), gl_attrib );
-
-#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)
const wxSize& size, long style)
: wxFrame(frame, wxID_ANY, title, pos, size, style)
{
const wxSize& size, long style)
: wxFrame(frame, wxID_ANY, title, pos, size, style)
{
-#if wxUSE_GLCANVAS
- if (m_canvas)
- {
- delete m_canvas; m_canvas = NULL;
- }
-#endif
}
// Intercept menu commands
}
// Intercept menu commands
* TestGLCanvas implementation
*/
* TestGLCanvas implementation
*/
BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)
EVT_SIZE(TestGLCanvas::OnSize)
EVT_PAINT(TestGLCanvas::OnPaint)
BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)
EVT_SIZE(TestGLCanvas::OnSize)
EVT_PAINT(TestGLCanvas::OnPaint)
// Do nothing, to avoid flashing.
}
// Do nothing, to avoid flashing.
}
-#endif // #if wxUSE_GLCANVAS
-
#include "wx/wx.h"
#endif
#include "wx/wx.h"
#endif
+#if !wxUSE_GLCANVAS
+ #error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"
+#endif
+
#include "penguin.h"
#ifdef __WXMAC__
# ifdef __DARWIN__
#include "penguin.h"
#ifdef __WXMAC__
# ifdef __DARWIN__
menuBar->Append(fileMenu, wxT("&File"));
frame->SetMenuBar(menuBar);
menuBar->Append(fileMenu, wxT("&File"));
frame->SetMenuBar(menuBar);
frame->SetCanvas( new TestGLCanvas(frame, wxID_ANY, wxDefaultPosition,
wxSize(200, 200), wxSUNKEN_BORDER) );
frame->SetCanvas( new TestGLCanvas(frame, wxID_ANY, wxDefaultPosition,
wxSize(200, 200), wxSUNKEN_BORDER) );
frame->Show(true);
return true;
frame->Show(true);
return true;
-#else
-
- wxMessageBox( _T("This sample has to be compiled with wxUSE_GLCANVAS"),
- _T("Building error"), wxOK);
-
- return false;
-
-#endif
const wxSize& size, long style)
: wxFrame(frame, wxID_ANY, title, pos, size, style)
{
const wxSize& size, long style)
: wxFrame(frame, wxID_ANY, title, pos, size, style)
{
}
/* Intercept menu commands */
}
/* Intercept menu commands */
BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)
EVT_SIZE(TestGLCanvas::OnSize)
EVT_PAINT(TestGLCanvas::OnPaint)
BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)
EVT_SIZE(TestGLCanvas::OnSize)
EVT_PAINT(TestGLCanvas::OnPaint)
glEnable(GL_COLOR_MATERIAL);
}
glEnable(GL_COLOR_MATERIAL);
}
-
-#endif // #if wxUSE_GLCANVAS