]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/glcanvas.h
removed setup0.h artifacts
[wxWidgets.git] / include / wx / motif / glcanvas.h
CommitLineData
8b089c5e
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: glcanvas.h
3// Purpose: wxGLCanvas, for using OpenGL with wxWindows 2.0 for Motif.
4// Uses the GLX extension.
5// Author: Julian Smart and Wolfram Gloger
6// Modified by:
7// Created: 1995, 1999
8// RCS-ID: $Id$
9// Copyright: (c) Julian Smart, Wolfram Gloger
10// Licence: wxWindows licence
11/////////////////////////////////////////////////////////////////////////////
12
13#ifdef __GNUG__
14#pragma interface "glcanvas.h"
15#endif
16
17#ifndef _WX_GLCANVAS_H_
18#define _WX_GLCANVAS_H_
19
07d08a4d 20#include "wx/setup.h"
8b089c5e
JS
21
22#if wxUSE_GLCANVAS
23
07d08a4d
GD
24#include "wx/gdicmn.h"
25#include "wx/palette.h"
26#include "wx/scrolwin.h"
8b089c5e
JS
27
28#include <GL/glx.h>
29
f48d169c
UN
30enum
31{
32 WX_GL_RGBA=1, /* use true color palette */
33 WX_GL_BUFFER_SIZE, /* bits for buffer if not WX_GL_RGBA */
34 WX_GL_LEVEL, /* 0 for main buffer, >0 for overlay, <0 for underlay */
35 WX_GL_DOUBLEBUFFER, /* use doublebuffer */
36 WX_GL_STEREO, /* use stereoscopic display */
37 WX_GL_AUX_BUFFERS, /* number of auxiliary buffers */
38 WX_GL_MIN_RED, /* use red buffer with most bits (> MIN_RED bits) */
39 WX_GL_MIN_GREEN, /* use green buffer with most bits (> MIN_GREEN bits) */
40 WX_GL_MIN_BLUE, /* use blue buffer with most bits (> MIN_BLUE bits) */
41 WX_GL_MIN_ALPHA, /* use blue buffer with most bits (> MIN_ALPHA bits) */
42 WX_GL_DEPTH_SIZE, /* bits for Z-buffer (0,16,32) */
43 WX_GL_STENCIL_SIZE, /* bits for stencil buffer */
44 WX_GL_MIN_ACCUM_RED, /* use red accum buffer with most bits (> MIN_ACCUM_RED bits) */
45 WX_GL_MIN_ACCUM_GREEN, /* use green buffer with most bits (> MIN_ACCUM_GREEN bits) */
46 WX_GL_MIN_ACCUM_BLUE, /* use blue buffer with most bits (> MIN_ACCUM_BLUE bits) */
47 WX_GL_MIN_ACCUM_ALPHA /* use blue buffer with most bits (> MIN_ACCUM_ALPHA bits) */
48};
49
50//---------------------------------------------------------------------------
51// classes
52//---------------------------------------------------------------------------
53
0bc6abf1
UN
54
55class WXDLLEXPORT wxGLContext: public wxObject
56{
57public:
58 wxGLContext( bool isRGB, wxWindow *win,
59 const wxPalette& palette = wxNullPalette );
60 wxGLContext( bool WXUNUSED(isRGB), wxWindow *win,
61 const wxPalette& WXUNUSED(palette),
62 const wxGLContext *other /* for sharing display lists */
63 );
64 ~wxGLContext();
65
66 void SetCurrent();
67 void SetColour(const char *colour);
68 void SwapBuffers();
69
70 void SetupPixelFormat();
71 void SetupPalette(const wxPalette& palette);
72 wxPalette CreateDefaultPalette();
73
74 inline wxPalette* GetPalette() const { return (wxPalette*) & m_palette; }
75 inline wxWindow* GetWindow() const { return m_window; }
76 // inline GtkWidget* GetWidget() const { return m_widget; }
77 inline GLXContext GetContext() const { return m_glContext; }
78
79public:
80 GLXContext m_glContext;
81
82 // GtkWidget *m_widget;
83 wxPalette m_palette;
84 wxWindow* m_window;
85
86 DECLARE_CLASS(wxGLContext)
87};
88
89
8b089c5e
JS
90class WXDLLEXPORT wxGLCanvas: public wxScrolledWindow
91{
8b089c5e 92public:
0bc6abf1
UN
93 inline wxGLCanvas() {
94 m_glContext = (wxGLContext*) NULL;
95 m_sharedContext = (wxGLContext*) NULL;
96 // m_glWidget = (GtkWidget*) NULL;
97 m_vi = (void*) NULL;
98 // m_exposed = FALSE;
99 }
100 wxGLCanvas( wxWindow *parent, wxWindowID id = -1,
101 const wxPoint& pos = wxDefaultPosition,
102 const wxSize& size = wxDefaultSize,
103 long style = 0, const wxString& name = "GLCanvas",
104 int *attribList = (int*) NULL,
105 const wxPalette& palette = wxNullPalette );
106 wxGLCanvas( wxWindow *parent, const wxGLContext *shared = (wxGLContext *)NULL,
107 wxWindowID id = -1,
108 const wxPoint& pos = wxDefaultPosition,
109 const wxSize& size = wxDefaultSize,
110 long style = 0, const wxString& name = "GLCanvas",
111 int *attribList = (int*) NULL,
112 const wxPalette& palette = wxNullPalette );
113 wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared = (wxGLCanvas *)NULL,
114 wxWindowID id = -1,
115 const wxPoint& pos = wxDefaultPosition,
116 const wxSize& size = wxDefaultSize,
117 long style = 0, const wxString& name = "GLCanvas",
118 int *attribList = (int*) NULL,
119 const wxPalette& palette = wxNullPalette );
8b089c5e 120
0bc6abf1
UN
121 bool Create( wxWindow *parent,
122 const wxGLContext *shared = (wxGLContext*)NULL,
123 const wxGLCanvas *shared_context_of = (wxGLCanvas*)NULL,
124 wxWindowID id = -1,
125 const wxPoint& pos = wxDefaultPosition,
126 const wxSize& size = wxDefaultSize,
127 long style = 0, const wxString& name = "GLCanvas",
128 int *attribList = (int*) NULL,
129 const wxPalette& palette = wxNullPalette );
130
131 ~wxGLCanvas();
8b089c5e 132
0bc6abf1
UN
133 void SetCurrent();
134 void SetColour(const char *colour);
135 void SwapBuffers();
136
137 // void OnSize(wxSizeEvent& event);
138
139 // void OnInternalIdle();
140
141 inline wxGLContext* GetContext() const { return m_glContext; }
142
143 // implementation
144
145 wxGLContext *m_glContext,
146 *m_sharedContext;
147 wxGLCanvas *m_sharedContextOf;
148 void *m_vi;
149 // GtkWidget *m_glWidget;
150 // bool m_exposed;
151
152 DECLARE_EVENT_TABLE()
153 DECLARE_CLASS(wxGLCanvas)
8b089c5e 154
8b089c5e
JS
155};
156
157#endif
158 // wxUSE_GLCANVAS
159
160#endif
161 // _WX_GLCANVAS_H_