--- /dev/null
+lib/dummy
+src/win/*.cpp
+src/win/*.h
+src/win/make*.*
+samples/cube/*.cpp
+samples/cube/*.h
+samples/cube/*.rc
+samples/cube/*.ico
+samples/cube/*.xbm
+samples/cube/make*.*
+samples/isosurf/*.cpp
+samples/isosurf/*.h
+samples/isosurf/*.rc
+samples/isosurf/*.ico
+samples/isosurf/*.xbm
+samples/isosurf/*.dat
+samples/isosurf/make*.*
+wx/*.h
+wx/*.cpp
+distrib/*.*
+
--- /dev/null
+@echo off
+rem Zip up an external source distribution of GLCanvas
+set src=%1
+set dest=%2
+if "%src" == "" set src=%WXWIN\utils\glcanvas
+if "%dest" == "" set dest=%WXWIN\utils\glcanvas\deliver
+echo About to archive an external GLCanvas distribution:
+echo From %src
+echo To %dest\glcanvas.zip
+echo CTRL-C if this is not correct.
+inkey /W10 `Press any key to continue...` %%input
+
+erase %dest\glcanvas.zip
+cd %src
+
+zip32 -@ %dest\glcanvas.zip < %src\distrib\glcanvas.rsp
+
+echo GLCanvas archived.
+goto end
+
+:usage
+echo GLCanvas distribution.
+echo Usage: zipsrc source destination
+
+:end
+
+
--- /dev/null
+Problems with wxGLCanvas, 29/8/98
+
+Only the cube example compiles under wxWin 2 so far.
+
+Major problem: OpenGL seems to do something strange to the
+event loop, because wxApp::OnIdle never gets a chance to be
+called, and therefore delayed deletion (and all other
+idle-related processing) doesn't get done. This is why closing
+the app doesn't work.
+
+What does OpenGL do to message processing, and what can be done
+about it? Why did it work OK for wxWin 1.xx? It's as if
+there's _always_ a message in the queue (PeekMessage always
+returns non-zero). Perhaps we need to discover what the message
+is it's always returning.
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: cube.cpp
+// Purpose: wxGLCanvas demo program
+// Author: Julian Smart
+// Modified by:
+// Created: 04/01/98
+// RCS-ID: $Id$
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation
+#pragma interface
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include "wx/log.h"
+
+#include "cube.h"
+
+// This statement initializes the whole application and calls OnInit
+MyApp myApp;
+
+IMPLEMENT_APP(MyApp)
+
+// `Main program' equivalent, creating windows and returning main app frame
+bool MyApp::OnInit(void)
+{
+ wxLog::SetTraceMask(wxTraceMessages);
+
+ // Create the main frame window
+ MyFrame *frame = new MyFrame(NULL, "Cube OpenGL Demo", wxPoint(50, 50), wxSize(400, 300));
+
+ // Give it an icon
+#ifdef wx_msw
+ frame->SetIcon(wxIcon("mondrian"));
+#endif
+
+ // Make a menubar
+ wxMenu *fileMenu = new wxMenu;
+
+ fileMenu->Append(wxID_EXIT, "E&xit");
+ wxMenuBar *menuBar = new wxMenuBar;
+ menuBar->Append(fileMenu, "&File");
+ frame->SetMenuBar(menuBar);
+
+ frame->m_canvas = new TestGLCanvas(frame, -1, wxPoint(0, 0), wxSize(200, 200));
+
+ InitGL();
+
+ // Show the frame
+ frame->Show(TRUE);
+
+ return TRUE;
+}
+
+void MyApp::InitGL(void)
+{
+ /* set viewing projection */
+ glMatrixMode(GL_PROJECTION);
+ glFrustum(-0.5F, 0.5F, -0.5F, 0.5F, 1.0F, 3.0F);
+
+ /* position viewer */
+ glMatrixMode(GL_MODELVIEW);
+ glTranslatef(0.0F, 0.0F, -2.0F);
+
+ /* position object */
+ glRotatef(30.0F, 1.0F, 0.0F, 0.0F);
+ glRotatef(30.0F, 0.0F, 1.0F, 0.0F);
+
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_LIGHTING);
+ glEnable(GL_LIGHT0);
+}
+
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+ EVT_MENU(wxID_EXIT, MyFrame::OnExit)
+END_EVENT_TABLE()
+
+// My frame constructor
+MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos,
+ const wxSize& size, long style):
+ wxFrame(frame, -1, title, pos, size, style)
+{
+ m_canvas = NULL;
+}
+
+// Intercept menu commands
+void MyFrame::OnExit(wxCommandEvent& event)
+{
+ Destroy();
+}
+
+bool MyFrame::OnClose(void)
+{
+ return TRUE;
+}
+
+BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)
+ EVT_SIZE(TestGLCanvas::OnSize)
+ EVT_PAINT(TestGLCanvas::OnPaint)
+ EVT_ERASE_BACKGROUND(TestGLCanvas::OnEraseBackground)
+END_EVENT_TABLE()
+
+TestGLCanvas::TestGLCanvas(wxWindow *parent, wxWindowID id,
+ const wxPoint& pos, const wxSize& size, long style, const wxString& name):
+ wxGLCanvas(parent, id, pos, size, style, name)
+{
+}
+
+TestGLCanvas::~TestGLCanvas(void)
+{
+}
+
+void TestGLCanvas::OnPaint( wxPaintEvent& event )
+{
+ if ( !GetContext() )
+ return;
+
+ SetCurrent();
+
+ /* clear color and depth buffers */
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ /* draw six faces of a cube */
+ glBegin(GL_QUADS);
+ glNormal3f( 0.0F, 0.0F, 1.0F);
+ glVertex3f( 0.5F, 0.5F, 0.5F); glVertex3f(-0.5F, 0.5F, 0.5F);
+ glVertex3f(-0.5F,-0.5F, 0.5F); glVertex3f( 0.5F,-0.5F, 0.5F);
+
+ glNormal3f( 0.0F, 0.0F,-1.0F);
+ glVertex3f(-0.5F,-0.5F,-0.5F); glVertex3f(-0.5F, 0.5F,-0.5F);
+ glVertex3f( 0.5F, 0.5F,-0.5F); glVertex3f( 0.5F,-0.5F,-0.5F);
+
+ glNormal3f( 0.0F, 1.0F, 0.0F);
+ glVertex3f( 0.5F, 0.5F, 0.5F); glVertex3f( 0.5F, 0.5F,-0.5F);
+ glVertex3f(-0.5F, 0.5F,-0.5F); glVertex3f(-0.5F, 0.5F, 0.5F);
+
+ glNormal3f( 0.0F,-1.0F, 0.0F);
+ glVertex3f(-0.5F,-0.5F,-0.5F); glVertex3f( 0.5F,-0.5F,-0.5F);
+ glVertex3f( 0.5F,-0.5F, 0.5F); glVertex3f(-0.5F,-0.5F, 0.5F);
+
+ glNormal3f( 1.0F, 0.0F, 0.0F);
+ glVertex3f( 0.5F, 0.5F, 0.5F); glVertex3f( 0.5F,-0.5F, 0.5F);
+ glVertex3f( 0.5F,-0.5F,-0.5F); glVertex3f( 0.5F, 0.5F,-0.5F);
+
+ glNormal3f(-1.0F, 0.0F, 0.0F);
+ glVertex3f(-0.5F,-0.5F,-0.5F); glVertex3f(-0.5F,-0.5F, 0.5F);
+ glVertex3f(-0.5F, 0.5F, 0.5F); glVertex3f(-0.5F, 0.5F,-0.5F);
+ glEnd();
+
+ SwapBuffers();
+}
+
+void TestGLCanvas::OnSize(wxSizeEvent& event)
+{
+ int width, height;
+ GetClientSize(& width, & height);
+
+ if ( GetContext() )
+ glViewport(0, 0, width, height);
+}
+
+void TestGLCanvas::OnEraseBackground(wxEraseEvent& event)
+{
+ // Do nothing, to avoid flashing.
+}
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: cube.h
+// Purpose: wxGLCanvas demo program
+// Author: Julian Smart
+// Modified by:
+// Created: 04/01/98
+// RCS-ID: $Id$
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CUBE_H_
+#define _WX_CUBE_H_
+
+#include "glcanvas.h"
+
+// Define a new application type
+class MyApp: public wxApp
+{
+public:
+ bool OnInit(void);
+ void InitGL(void);
+};
+
+// Define a new frame type
+class TestGLCanvas;
+class MyFrame: public wxFrame
+{ public:
+ MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size,
+ long style = wxDEFAULT_FRAME_STYLE);
+
+ void OnExit(wxCommandEvent& event);
+
+ bool OnClose(void);
+
+ TestGLCanvas* m_canvas;
+
+DECLARE_EVENT_TABLE()
+};
+
+class TestGLCanvas: public wxGLCanvas
+{
+ public:
+ TestGLCanvas(wxWindow *parent, const wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "TestGLCanvas");
+ ~TestGLCanvas(void);
+
+ void OnPaint(wxPaintEvent& event);
+ void OnSize(wxSizeEvent& event);
+ void OnEraseBackground(wxEraseEvent& event);
+
+DECLARE_EVENT_TABLE()
+};
+
+#endif
+
--- /dev/null
+mondrian ICON "mondrian.ico"
+#include "wx/msw/wx.rc"
+
--- /dev/null
+#
+# File: makefile.unx
+# Author: Julian Smart
+# Created: 1993
+# Updated:
+# Copyright: (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile for cube example (UNIX).
+
+WXDIR = ../..
+
+# All common UNIX compiler flags and options are now in
+# this central makefile.
+include $(WXDIR)/src/makeg95.env
+
+OBJECTS = $(OBJDIR)/cube.$(OBJSUFF)
+
+all: $(OBJDIR) cube$(GUISUFFIX)$(EXESUFF)
+
+wx:
+
+$(OBJDIR):
+ mkdir $(OBJDIR)
+
+cube$(GUISUFFIX)$(EXESUFF): $(OBJDIR)/cube.$(OBJSUFF) cube.res $(WXLIB)
+ $(CC) $(LDFLAGS) -o cube$(GUISUFFIX)$(EXESUFF) $(OBJDIR)/cube.$(OBJSUFF) $(LDLIBS)
+ $(RSRC) cube.$(RESSUFF) cube.exe
+
+$(OBJDIR)/cube.$(OBJSUFF): cube.$(SRCSUFF)
+ $(CC) -c $(CPPFLAGS) -o $@ cube.$(SRCSUFF)
+
+cube.res: cube.rc
+
+clean:
+ rm -f $(OBJECTS) cube$(GUISUFFIX).exe core *.rsc *.res
--- /dev/null
+#
+# File: makefile.nt
+# Author: Julian Smart
+# Created: 1997
+# Updated:
+#
+# "%W% %G%"
+#
+# Makefile : Builds cube example (MS VC++).
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+WXUSINGDLL=0
+
+EXTRAINC=-I..\..\win
+EXTRALIBS=$(WXDIR)\lib\glcanvas.lib glu.lib opengl.lib
+
+!include $(WXDIR)\src\ntwxwin.mak
+
+THISDIR = $(WXDIR)\utils\glcanvas\samples\cube
+PROGRAM=cube
+
+OBJECTS = $(PROGRAM).obj
+
+$(PROGRAM): $(PROGRAM).exe
+
+all: wx $(PROGRAM).exe
+
+wx:
+ cd $(WXDIR)\src\msw
+ nmake -f makefile.nt FINAL=$(FINAL)
+ cd $(THISDIR)
+
+wxclean:
+ cd $(WXDIR)\src\msw
+ nmake -f makefile.nt clean
+ cd $(THISDIR)
+
+$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
+ $(link) @<<
+-out:$(PROGRAM).exe
+$(LINKFLAGS)
+$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
+$(LIBS)
+<<
+
+
+$(PROGRAM).obj: $(PROGRAM).$(SRCSUFF) $(PROGRAM).h $(DUMMYOBJ)
+ $(cc) @<<
+$(CPPFLAGS2) /c /Tp $*.$(SRCSUFF)
+<<
+
+$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
+ $(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
+
+
+clean:
+ -erase *.obj
+ -erase *.exe
+ -erase *.res
+ -erase *.map
+ -erase *.sbr
+ -erase *.pdb
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: glcanvas.cpp
+// Purpose: wxGLCanvas, for using OpenGL with wxWindows under MS Windows
+// Author: Julian Smart
+// Modified by:
+// Created: 04/01/98
+// RCS-ID: $Id$
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation "glcanvas.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#if defined(__BORLANDC__)
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include <wx/frame.h>
+#endif
+
+#include "GL/gl.h"
+
+#include "glcanvas.h"
+
+/*
+ * GLContext implementation
+ */
+
+wxGLContext::wxGLContext(bool isRGB, wxWindow *win, const wxPalette& palette)
+{
+ m_window = win;
+
+ m_hDC = (WXHDC) ::GetDC((HWND) win->GetHWND());
+
+ SetupPixelFormat();
+ SetupPalette(palette);
+
+ m_glContext = wglCreateContext((HDC) m_hDC);
+ wglMakeCurrent((HDC) m_hDC, m_glContext);
+}
+
+wxGLContext::~wxGLContext()
+{
+ if (m_glContext)
+ {
+ wglMakeCurrent(NULL, NULL);
+ wglDeleteContext(m_glContext);
+ }
+
+ ::ReleaseDC((HWND) m_window->GetHWND(), (HDC) m_hDC);
+}
+
+void wxGLContext::SwapBuffers()
+{
+ if (m_glContext)
+ {
+ wglMakeCurrent((HDC) m_hDC, m_glContext);
+ ::SwapBuffers((HDC) m_hDC); //blits the backbuffer into DC
+ }
+}
+
+void wxGLContext::SetCurrent()
+{
+ if (m_glContext)
+ {
+ wglMakeCurrent((HDC) m_hDC, m_glContext);
+ }
+
+/*
+ setupPixelFormat(hDC);
+ setupPalette(hDC);
+*/
+}
+
+void wxGLContext::SetColour(const char *colour)
+{
+ float r = 0.0;
+ float g = 0.0;
+ float b = 0.0;
+ wxColour *col = wxTheColourDatabase->FindColour(colour);
+ if (col)
+ {
+ r = (float)(col->Red()/256.0);
+ g = (float)(col->Green()/256.0);
+ b = (float)(col->Blue()/256.0);
+ glColor3f( r, g, b);
+ }
+}
+
+void wxGLContext::SetupPixelFormat() // (HDC hDC)
+{
+ PIXELFORMATDESCRIPTOR pfd = {
+ sizeof(PIXELFORMATDESCRIPTOR), /* size */
+ 1, /* version */
+ PFD_SUPPORT_OPENGL |
+ PFD_DRAW_TO_WINDOW |
+ PFD_DOUBLEBUFFER, /* support double-buffering */
+ PFD_TYPE_RGBA, /* color type */
+ 16, /* prefered color depth */
+ 0, 0, 0, 0, 0, 0, /* color bits (ignored) */
+ 0, /* no alpha buffer */
+ 0, /* alpha bits (ignored) */
+ 0, /* no accumulation buffer */
+ 0, 0, 0, 0, /* accum bits (ignored) */
+ 16, /* depth buffer */
+ 0, /* no stencil buffer */
+ 0, /* no auxiliary buffers */
+ PFD_MAIN_PLANE, /* main layer */
+ 0, /* reserved */
+ 0, 0, 0, /* no layer, visible, damage masks */
+ };
+ int pixelFormat;
+
+ pixelFormat = ChoosePixelFormat((HDC) m_hDC, &pfd);
+ if (pixelFormat == 0) {
+ MessageBox(WindowFromDC((HDC) m_hDC), "ChoosePixelFormat failed.", "Error",
+ MB_ICONERROR | MB_OK);
+ exit(1);
+ }
+
+ if (SetPixelFormat((HDC) m_hDC, pixelFormat, &pfd) != TRUE) {
+ MessageBox(WindowFromDC((HDC) m_hDC), "SetPixelFormat failed.", "Error",
+ MB_ICONERROR | MB_OK);
+ exit(1);
+ }
+}
+
+void wxGLContext::SetupPalette(const wxPalette& palette)
+{
+ int pixelFormat = GetPixelFormat((HDC) m_hDC);
+ PIXELFORMATDESCRIPTOR pfd;
+
+ DescribePixelFormat((HDC) m_hDC, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
+
+ if (pfd.dwFlags & PFD_NEED_PALETTE)
+ {
+ }
+ else
+ {
+ return;
+ }
+
+ m_palette = palette;
+
+ if ( !m_palette.Ok() )
+ {
+ m_palette = CreateDefaultPalette();
+ }
+
+ if (m_palette.Ok())
+ {
+ SelectPalette((HDC) m_hDC, (HPALETTE) m_palette.GetHPALETTE(), FALSE);
+ RealizePalette((HDC) m_hDC);
+ }
+}
+
+wxPalette wxGLContext::CreateDefaultPalette()
+{
+ PIXELFORMATDESCRIPTOR pfd;
+ int paletteSize;
+ int pixelFormat = GetPixelFormat((HDC) m_hDC);
+
+ DescribePixelFormat((HDC) m_hDC, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
+
+ paletteSize = 1 << pfd.cColorBits;
+
+ LOGPALETTE* pPal =
+ (LOGPALETTE*) malloc(sizeof(LOGPALETTE) + paletteSize * sizeof(PALETTEENTRY));
+ pPal->palVersion = 0x300;
+ pPal->palNumEntries = paletteSize;
+
+ /* build a simple RGB color palette */
+ {
+ int redMask = (1 << pfd.cRedBits) - 1;
+ int greenMask = (1 << pfd.cGreenBits) - 1;
+ int blueMask = (1 << pfd.cBlueBits) - 1;
+ int i;
+
+ for (i=0; i<paletteSize; ++i) {
+ pPal->palPalEntry[i].peRed =
+ (((i >> pfd.cRedShift) & redMask) * 255) / redMask;
+ pPal->palPalEntry[i].peGreen =
+ (((i >> pfd.cGreenShift) & greenMask) * 255) / greenMask;
+ pPal->palPalEntry[i].peBlue =
+ (((i >> pfd.cBlueShift) & blueMask) * 255) / blueMask;
+ pPal->palPalEntry[i].peFlags = 0;
+ }
+ }
+
+ HPALETTE hPalette = CreatePalette(pPal);
+ free(pPal);
+
+ wxPalette palette;
+ palette.SetHPALETTE((WXHPALETTE) hPalette);
+
+ return palette;
+}
+
+/*
+ * wxGLCanvas implementation
+ */
+
+IMPLEMENT_CLASS(wxGLCanvas, wxScrolledWindow)
+
+BEGIN_EVENT_TABLE(wxGLCanvas, wxScrolledWindow)
+ EVT_SIZE(wxGLCanvas::OnSize)
+ EVT_PALETTE_CHANGED(wxGLCanvas::OnPaletteChanged)
+ EVT_QUERY_NEW_PALETTE(wxGLCanvas::OnQueryNewPalette)
+END_EVENT_TABLE()
+
+wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id,
+ const wxPoint& pos, const wxSize& size, long style, const wxString& name,
+ int *attribList /* not used yet! */, const wxPalette& palette):
+ wxScrolledWindow(parent, id, pos, size, style, name)
+{
+ m_glContext = new wxGLContext(TRUE, this, palette);
+}
+
+wxGLCanvas::~wxGLCanvas()
+{
+ if (m_glContext)
+ delete m_glContext;
+}
+
+void wxGLCanvas::SwapBuffers()
+{
+ if (m_glContext)
+ m_glContext->SwapBuffers();
+}
+
+void wxGLCanvas::OnSize(wxSizeEvent& event)
+{
+ int width, height;
+ GetClientSize(& width, & height);
+
+ if (m_glContext)
+ {
+ m_glContext->SetCurrent();
+
+ glViewport(0, 0, (GLint)width, (GLint)height);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 );
+ glMatrixMode(GL_MODELVIEW);
+ }
+}
+
+void wxGLCanvas::SetCurrent()
+{
+ if (m_glContext)
+ {
+ m_glContext->SetCurrent();
+ }
+}
+
+void wxGLCanvas::SetColour(const char *colour)
+{
+ if (m_glContext)
+ m_glContext->SetColour(colour);
+}
+
+// TODO: Have to have this called by parent frame (?)
+// So we need wxFrame to call OnQueryNewPalette for all children...
+void wxGLCanvas::OnQueryNewPalette(wxQueryNewPaletteEvent& event)
+{
+ /* realize palette if this is the current window */
+ if (m_glContext && m_glContext->GetPalette()->Ok()) {
+ ::UnrealizeObject((HPALETTE) m_glContext->GetPalette()->GetHPALETTE());
+ ::SelectPalette((HDC) m_glContext->GetHDC(), (HPALETTE) m_glContext->GetPalette()->GetHPALETTE(), FALSE);
+ ::RealizePalette((HDC) m_glContext->GetHDC());
+ Refresh();
+ event.SetPaletteRealized(TRUE);
+ }
+ else
+ event.SetPaletteRealized(FALSE);
+}
+
+// I think this doesn't have to be propagated to child windows.
+void wxGLCanvas::OnPaletteChanged(wxPaletteChangedEvent& event)
+{
+ /* realize palette if this is *not* the current window */
+ if ( m_glContext &&
+ m_glContext->GetPalette() &&
+ m_glContext->GetPalette()->Ok() &&
+ (this != event.GetChangedWindow()) )
+ {
+ ::UnrealizeObject((HPALETTE) m_glContext->GetPalette()->GetHPALETTE());
+ ::SelectPalette((HDC) m_glContext->GetHDC(), (HPALETTE) m_glContext->GetPalette()->GetHPALETTE(), FALSE);
+ ::RealizePalette((HDC) m_glContext->GetHDC());
+ Refresh();
+ }
+}
+
+/* Give extensions proper function names. */
+
+/* EXT_vertex_array */
+void glArrayElementEXT(GLint i)
+{
+}
+
+void glColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)
+{
+}
+
+void glDrawArraysEXT(GLenum mode, GLint first, GLsizei count)
+{
+#ifdef GL_EXT_vertex_array
+ static PFNGLDRAWARRAYSEXTPROC proc = 0;
+
+ if ( !proc )
+ {
+ proc = (PFNGLDRAWARRAYSEXTPROC) wglGetProcAddress("glDrawArraysEXT");
+ }
+
+ if ( proc )
+ (* proc) (mode, first, count);
+#endif
+}
+
+void glEdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *pointer)
+{
+}
+
+void glGetPointervEXT(GLenum pname, GLvoid* *params)
+{
+}
+
+void glIndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)
+{
+}
+
+void glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)
+{
+#ifdef GL_EXT_vertex_array
+ static PFNGLNORMALPOINTEREXTPROC proc = 0;
+
+ if ( !proc )
+ {
+ proc = (PFNGLNORMALPOINTEREXTPROC) wglGetProcAddress("glNormalPointerEXT");
+ }
+
+ if ( proc )
+ (* proc) (type, stride, count, pointer);
+#endif
+}
+
+void glTexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)
+{
+}
+
+void glVertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)
+{
+#ifdef GL_EXT_vertex_array
+ static PFNGLVERTEXPOINTEREXTPROC proc = 0;
+
+ if ( !proc )
+ {
+ proc = (PFNGLVERTEXPOINTEREXTPROC) wglGetProcAddress("glVertexPointerEXT");
+ }
+
+ if ( proc )
+ (* proc) (size, type, stride, count, pointer);
+#endif
+}
+
+/* EXT_color_subtable */
+void glColorSubtableEXT(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table)
+{
+}
+
+/* EXT_color_table */
+void glColorTableEXT(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)
+{
+}
+
+void glCopyColorTableEXT(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
+{
+}
+
+void glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid *table)
+{
+}
+
+void glGetColorTableParamaterfvEXT(GLenum target, GLenum pname, GLfloat *params)
+{
+}
+
+void glGetColorTavleParameterivEXT(GLenum target, GLenum pname, GLint *params)
+{
+}
+
+/* SGI_compiled_vertex_array */
+void glLockArraysSGI(GLint first, GLsizei count)
+{
+}
+
+void glUnlockArraysSGI()
+{
+}
+
+
+/* SGI_cull_vertex */
+void glCullParameterdvSGI(GLenum pname, GLdouble* params)
+{
+}
+
+void glCullParameterfvSGI(GLenum pname, GLfloat* params)
+{
+}
+
+/* SGI_index_func */
+void glIndexFuncSGI(GLenum func, GLclampf ref)
+{
+}
+
+/* SGI_index_material */
+void glIndexMaterialSGI(GLenum face, GLenum mode)
+{
+}
+
+/* WIN_swap_hint */
+void glAddSwapHintRectWin(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+}
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: glcanvas.h
+// Purpose: wxGLCanvas, for using OpenGL with wxWindows under Windows
+// Author: Julian Smart
+// Modified by:
+// Created: 04/01/98
+// RCS-ID: $Id$
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma interface "glcanvas.h"
+#endif
+
+#ifndef _WX_GLCANVAS_H_
+#define _WX_GLCANVAS_H_
+
+#include <wx/scrolwin.h>
+
+#include "gl/gl.h"
+
+class wxGLContext: public wxObject
+{
+public:
+ wxGLContext(bool isRGB, wxWindow *win, const wxPalette& palette = wxNullPalette);
+ ~wxGLContext();
+
+ void SetCurrent();
+ void SetColour(const char *colour);
+ void SwapBuffers();
+
+ void SetupPixelFormat();
+ void SetupPalette(const wxPalette& palette);
+ wxPalette CreateDefaultPalette();
+
+ inline wxPalette* GetPalette() const { return (wxPalette*) & m_palette; }
+ inline wxWindow* GetWindow() const { return m_window; }
+ inline WXHDC GetHDC() const { return m_hDC; }
+ inline HGLRC GetGLRC() const { return m_glContext; }
+
+public:
+ HGLRC m_glContext;
+ WXHDC m_hDC;
+ wxPalette m_palette;
+ wxWindow* m_window;
+};
+
+class wxGLCanvas: public wxScrolledWindow
+{
+ DECLARE_CLASS(wxGLCanvas)
+ public:
+ wxGLCanvas(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette);
+ ~wxGLCanvas();
+
+ void SetCurrent();
+ void SetColour(const char *colour);
+ void SwapBuffers();
+
+ void OnSize(wxSizeEvent& event);
+
+ void OnQueryNewPalette(wxQueryNewPaletteEvent& event);
+ void OnPaletteChanged(wxPaletteChangedEvent& event);
+
+ inline wxGLContext* GetContext() const { return m_glContext; }
+
+protected:
+ wxGLContext* m_glContext; // this is typedef-ed ptr, in fact
+
+DECLARE_EVENT_TABLE()
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Give extensions proper function names. */
+
+/* N.B. - this is not completely implemented as yet */
+
+/* EXT_vertex_array */
+void glArrayElementEXT(GLint i);
+void glColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+void glDrawArraysEXT(GLenum mode, GLint first, GLsizei count);
+void glEdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *pointer);
+void glGetPointervEXT(GLenum pname, GLvoid* *params);
+void glIndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+void glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+void glTexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+void glVertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+
+/* EXT_color_subtable */
+void glColorSubtableEXT(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table);
+
+/* EXT_color_table */
+void glColorTableEXT(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
+void glCopyColorTableEXT(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+void glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid *table);
+void glGetColorTableParamaterfvEXT(GLenum target, GLenum pname, GLfloat *params);
+void glGetColorTavleParameterivEXT(GLenum target, GLenum pname, GLint *params);
+
+/* SGI_compiled_vertex_array */
+void glLockArraysSGI(GLint first, GLsizei count);
+void glUnlockArraysSGI();
+
+/* SGI_cull_vertex */
+void glCullParameterdvSGI(GLenum pname, GLdouble* params);
+void glCullParameterfvSGI(GLenum pname, GLfloat* params);
+
+/* SGI_index_func */
+void glIndexFuncSGI(GLenum func, GLclampf ref);
+
+/* SGI_index_material */
+void glIndexMaterialSGI(GLenum face, GLenum mode);
+
+/* WIN_swap_hint */
+void glAddSwapHintRectWin(GLint x, GLint y, GLsizei width, GLsizei height);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+#
+# File: makefile.nt
+# Author: Julian Smart
+# Created: 1993
+# Updated:
+# Copyright: (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds GLCanvas class library (MS VC++).
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+GLDIR = $(WXDIR)\utils\glcanvas
+THISDIR = $(GLDIR)\win
+EXTRALIBS=$(WXDIR)\lib\glcanvas.lib
+DOCDIR=$(WXDIR)\docs
+LOCALDOCDIR=$(WXDIR)\utils\glcanvas\docs
+
+!include $(WXDIR)\src\ntwxwin.mak
+
+PROGRAM=test
+
+OBJECTS = glcanvas.obj
+LIBTARGET=$(WXDIR)\lib\glcanvas.lib
+
+all: $(LIBTARGET)
+
+wx:
+ cd $(WXDIR)\src\msw
+ nmake -f makefile.nt FINAL=$(FINAL)
+ cd $(THISDIR)
+
+wxclean:
+ cd $(WXDIR)\src\msw
+ nmake -f makefile.nt clean
+ cd $(THISDIR)
+
+$(LIBTARGET): $(OBJECTS)
+ -erase $(LIBTARGET)
+ $(implib) @<<
+-out:$(LIBTARGET)
+-machine:$(CPU)
+$(OBJECTS)
+<<
+
+glcanvas.obj: glcanvas.h glcanvas.$(SRCSUFF) $(DUMMYOBJ)
+ $(cc) @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+clean:
+ -erase *.obj
+ -erase *.sbr
+ -erase *.exe
+ -erase *.res
+ -erase *.map
+ -erase *.pdb
+ -erase $(LIBTARGET)
+
+DOCSOURCES=$(LOCALDOCDIR)\manual.tex $(LOCALDOCDIR)\classes.tex
+
+html: $(DOCDIR)\html\glcanvas\glcanvas.htm
+hlp: $(DOCDIR)\winhelp\glcanvas.hlp
+ps: $(WXDIR)\docs\ps\glcanvas.ps
+
+$(DOCDIR)\winhelp\glcanvas.hlp: $(LOCALDOCDIR)\glcanvas.rtf $(LOCALDOCDIR)\glcanvas.hpj
+ cd $(LOCALDOCDIR)
+ -erase glcanvas.ph
+ hc glcanvas
+ move glcanvas.hlp $(DOCDIR)\winhelp\glcanvas.hlp
+ move glcanvas.cnt $(DOCDIR)\winhelp\glcanvas.cnt
+ cd $(THISDIR)
+
+$(LOCALDOCDIR)\glcanvas.rtf: $(DOCSOURCES)
+ cd $(LOCALDOCDIR)
+ -start /w tex2rtf $(LOCALDOCDIR)\manual.tex $(LOCALDOCDIR)\glcanvas.rtf -twice -winhelp
+ cd $(THISDIR)
+
+$(DOCDIR)\html\glcanvas\glcanvas.htm: $(DOCSOURCES)
+ cd $(LOCALDOCDIR)
+ -mkdir $(DOCDIR)\html\glcanvas
+ -start /w tex2rtf $(LOCALDOCDIR)\manual.tex $(DOCDIR)\html\glcanvas\glcanvas.htm -twice -html
+ -erase $(DOCDIR)\html\glcanvas\*.con
+ -erase $(DOCDIR)\html\glcanvas\*.ref
+ cd $(THISDIR)
+
+$(LOCALDOCDIR)\manual.dvi: $(DOCSOURCES)
+ cd $(LOCALDOCDIR)
+ -latex manual
+ -latex manual
+ -makeindx manual
+ -bibtex manual
+ -latex manual
+ -latex manual
+ cd $(THISDIR)
+
+$(WXDIR)\docs\ps\glcanvas.ps: $(LOCALDOCDIR)\manual.dvi
+ cd $(LOCALDOCDIR)
+ -dvips32 -o glcanvas.ps manual
+ move glcanvas.ps $(WXDIR)\docs\ps\glcanvas.ps
+ cd $(THISDIR)
+
+