2002-02-05 11:34:33 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2006-01-26 12:20:50 -05:00
|
|
|
// Name: wx/x11/glcanvas.h
|
2004-05-23 10:56:36 -04:00
|
|
|
// Purpose: wxGLCanvas, for using OpenGL with wxWidgets 2.0 for Motif.
|
2002-02-05 11:34:33 -05:00
|
|
|
// Uses the GLX extension.
|
|
|
|
// Author: Julian Smart and Wolfram Gloger
|
|
|
|
// Modified by:
|
|
|
|
// Created: 1995, 1999
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart, Wolfram Gloger
|
2006-01-26 12:20:50 -05:00
|
|
|
// Licence: wxWindows licence
|
2002-02-05 11:34:33 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2004-07-25 12:36:51 -04:00
|
|
|
#ifndef _WX_GLCANVAS_H_
|
|
|
|
#define _WX_GLCANVAS_H_
|
|
|
|
|
2006-01-26 12:20:50 -05:00
|
|
|
#include "wx/defs.h"
|
2002-02-05 11:34:33 -05:00
|
|
|
|
|
|
|
#if wxUSE_GLCANVAS
|
|
|
|
|
|
|
|
#include "wx/gdicmn.h"
|
|
|
|
#include "wx/palette.h"
|
|
|
|
#include "wx/scrolwin.h"
|
|
|
|
|
|
|
|
#include <GL/glx.h>
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxGLContext: public wxObject
|
|
|
|
{
|
|
|
|
public:
|
2006-01-26 12:20:50 -05:00
|
|
|
wxGLContext( bool isRGB, wxWindow *win,
|
2002-02-05 11:34:33 -05:00
|
|
|
const wxPalette& palette = wxNullPalette );
|
2006-01-26 12:20:50 -05:00
|
|
|
wxGLContext( bool WXUNUSED(isRGB), wxWindow *win,
|
2002-02-05 11:34:33 -05:00
|
|
|
const wxPalette& WXUNUSED(palette),
|
|
|
|
const wxGLContext *other /* for sharing display lists */
|
|
|
|
);
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxGLContext();
|
2006-01-26 12:20:50 -05:00
|
|
|
|
2002-02-05 11:34:33 -05:00
|
|
|
void SetCurrent();
|
2003-08-20 04:39:47 -04:00
|
|
|
void SetColour(const wxChar *colour);
|
2002-02-05 11:34:33 -05:00
|
|
|
void SwapBuffers();
|
2006-01-26 12:20:50 -05:00
|
|
|
|
2002-02-05 11:34:33 -05:00
|
|
|
void SetupPixelFormat();
|
|
|
|
void SetupPalette(const wxPalette& palette);
|
|
|
|
wxPalette CreateDefaultPalette();
|
2006-01-26 12:20:50 -05:00
|
|
|
|
2002-02-05 11:34:33 -05:00
|
|
|
inline wxPalette* GetPalette() const { return (wxPalette*) & m_palette; }
|
|
|
|
inline wxWindow* GetWindow() const { return m_window; }
|
|
|
|
// inline GtkWidget* GetWidget() const { return m_widget; }
|
|
|
|
inline GLXContext GetContext() const { return m_glContext; }
|
2006-01-26 12:20:50 -05:00
|
|
|
|
2002-02-05 11:34:33 -05:00
|
|
|
public:
|
|
|
|
GLXContext m_glContext;
|
2006-01-26 12:20:50 -05:00
|
|
|
|
2002-02-05 11:34:33 -05:00
|
|
|
// GtkWidget *m_widget;
|
|
|
|
wxPalette m_palette;
|
|
|
|
wxWindow* m_window;
|
2006-01-26 12:20:50 -05:00
|
|
|
|
2002-02-05 11:34:33 -05:00
|
|
|
DECLARE_CLASS(wxGLContext)
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxGLCanvas: public wxScrolledWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
inline wxGLCanvas() {
|
|
|
|
m_glContext = (wxGLContext*) NULL;
|
|
|
|
m_sharedContext = (wxGLContext*) NULL;
|
|
|
|
// m_glWidget = (GtkWidget*) NULL;
|
|
|
|
m_vi = (void*) NULL;
|
|
|
|
// m_exposed = FALSE;
|
|
|
|
}
|
2006-01-26 12:20:50 -05:00
|
|
|
wxGLCanvas( wxWindow *parent, wxWindowID id = wxID_ANY,
|
2002-02-05 11:34:33 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2006-01-26 12:20:50 -05:00
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0, const wxString& name = wxT("GLCanvas"),
|
|
|
|
int *attribList = (int*) NULL,
|
2002-02-05 11:34:33 -05:00
|
|
|
const wxPalette& palette = wxNullPalette );
|
2005-02-20 20:52:23 -05:00
|
|
|
wxGLCanvas( wxWindow *parent, const wxGLContext *shared,
|
2006-01-26 12:20:50 -05:00
|
|
|
wxWindowID id = wxID_ANY,
|
2002-02-05 11:34:33 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2006-01-26 12:20:50 -05:00
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0, const wxString& name = wxT("GLCanvas"),
|
|
|
|
int *attribList = (int*) NULL,
|
2002-02-05 11:34:33 -05:00
|
|
|
const wxPalette& palette = wxNullPalette );
|
2005-02-20 20:52:23 -05:00
|
|
|
wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared,
|
2006-01-26 12:20:50 -05:00
|
|
|
wxWindowID id = wxID_ANY,
|
2002-02-05 11:34:33 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2006-01-26 12:20:50 -05:00
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0, const wxString& name = wxT("GLCanvas"),
|
|
|
|
int *attribList = (int*) NULL,
|
2002-02-05 11:34:33 -05:00
|
|
|
const wxPalette& palette = wxNullPalette );
|
2006-01-26 12:20:50 -05:00
|
|
|
|
|
|
|
bool Create( wxWindow *parent,
|
2002-02-05 11:34:33 -05:00
|
|
|
const wxGLContext *shared = (wxGLContext*)NULL,
|
|
|
|
const wxGLCanvas *shared_context_of = (wxGLCanvas*)NULL,
|
2006-01-26 12:20:50 -05:00
|
|
|
wxWindowID id = wxID_ANY,
|
2002-02-05 11:34:33 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2006-01-26 12:20:50 -05:00
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0, const wxString& name = wxT("GLCanvas"),
|
2002-02-05 11:34:33 -05:00
|
|
|
int *attribList = (int*) NULL,
|
|
|
|
const wxPalette& palette = wxNullPalette );
|
2006-01-26 12:20:50 -05:00
|
|
|
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxGLCanvas();
|
2006-01-26 12:20:50 -05:00
|
|
|
|
2002-02-05 11:34:33 -05:00
|
|
|
void SetCurrent();
|
2003-08-20 04:39:47 -04:00
|
|
|
void SetColour(const wxChar *colour);
|
2002-02-05 11:34:33 -05:00
|
|
|
void SwapBuffers();
|
2006-01-26 12:20:50 -05:00
|
|
|
|
2002-02-05 11:34:33 -05:00
|
|
|
// void OnSize(wxSizeEvent& event);
|
2006-01-26 12:20:50 -05:00
|
|
|
|
2002-02-05 11:34:33 -05:00
|
|
|
// void OnInternalIdle();
|
2006-01-26 12:20:50 -05:00
|
|
|
|
|
|
|
inline wxGLContext* GetContext() const { return m_glContext; }
|
|
|
|
|
2002-02-05 11:34:33 -05:00
|
|
|
// implementation
|
2006-01-26 12:20:50 -05:00
|
|
|
|
2002-02-05 11:34:33 -05:00
|
|
|
wxGLContext *m_glContext,
|
|
|
|
*m_sharedContext;
|
|
|
|
wxGLCanvas *m_sharedContextOf;
|
|
|
|
void *m_vi;
|
|
|
|
// GtkWidget *m_glWidget;
|
|
|
|
// bool m_exposed;
|
2006-01-26 12:20:50 -05:00
|
|
|
|
2002-02-05 11:34:33 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
DECLARE_CLASS(wxGLCanvas)
|
2006-01-26 12:20:50 -05:00
|
|
|
|
2002-02-05 11:34:33 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// wxUSE_GLCANVAS
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_GLCANVAS_H_
|