wxCocoa: Added (mostly) stubs for wxGLCanvas and friends.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29594 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1162,6 +1162,7 @@ COND_WXUSE_EXPAT_BUILTIN___wxexpat___depname = \
|
|||||||
@COND_TOOLKIT_WINCE@BASE_WINCE_HDR = wx/msw/wince/time.h
|
@COND_TOOLKIT_WINCE@BASE_WINCE_HDR = wx/msw/wince/time.h
|
||||||
@COND_TOOLKIT_WINCE@NET_WINCE_SRC = src/msw/wince/net.cpp
|
@COND_TOOLKIT_WINCE@NET_WINCE_SRC = src/msw/wince/net.cpp
|
||||||
@COND_TOOLKIT_WINCE@NET_WINCE_HDR = wx/msw/wince/net.h
|
@COND_TOOLKIT_WINCE@NET_WINCE_HDR = wx/msw/wince/net.h
|
||||||
|
@COND_TOOLKIT_COCOA@OPENGL_HDR = wx/cocoa/glcanvas.h
|
||||||
@COND_TOOLKIT_GTK@OPENGL_HDR = wx/gtk/glcanvas.h
|
@COND_TOOLKIT_GTK@OPENGL_HDR = wx/gtk/glcanvas.h
|
||||||
@COND_TOOLKIT_MAC@OPENGL_HDR = wx/mac/carbon/glcanvas.h
|
@COND_TOOLKIT_MAC@OPENGL_HDR = wx/mac/carbon/glcanvas.h
|
||||||
@COND_TOOLKIT_MOTIF@OPENGL_HDR = wx/x11/glcanvas.h
|
@COND_TOOLKIT_MOTIF@OPENGL_HDR = wx/x11/glcanvas.h
|
||||||
@@ -6393,6 +6394,7 @@ COND_USE_SOSYMLINKS_1___gldll___so_symlinks_inst_cmd = rm -f \
|
|||||||
$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf2) \
|
$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf2) \
|
||||||
$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX)
|
$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX)
|
||||||
@COND_USE_SOSYMLINKS_1@__gldll___so_symlinks_inst_cmd = $(COND_USE_SOSYMLINKS_1___gldll___so_symlinks_inst_cmd)
|
@COND_USE_SOSYMLINKS_1@__gldll___so_symlinks_inst_cmd = $(COND_USE_SOSYMLINKS_1___gldll___so_symlinks_inst_cmd)
|
||||||
|
@COND_TOOLKIT_COCOA@__OPENGL_SRC_OBJECTS = gldll_glcanvas.o
|
||||||
@COND_TOOLKIT_GTK@__OPENGL_SRC_OBJECTS = gldll_glcanvas.o
|
@COND_TOOLKIT_GTK@__OPENGL_SRC_OBJECTS = gldll_glcanvas.o
|
||||||
@COND_TOOLKIT_MAC@__OPENGL_SRC_OBJECTS = gldll_glcanvas.o
|
@COND_TOOLKIT_MAC@__OPENGL_SRC_OBJECTS = gldll_glcanvas.o
|
||||||
@COND_TOOLKIT_MOTIF@__OPENGL_SRC_OBJECTS = gldll_glcanvas.o
|
@COND_TOOLKIT_MOTIF@__OPENGL_SRC_OBJECTS = gldll_glcanvas.o
|
||||||
@@ -6417,6 +6419,7 @@ COND_SHARED_0_USE_GUI_1_USE_OPENGL_1___gllib___depname = \
|
|||||||
@COND_GCC_PCH_1@__gllib_PCH_INC = -I.pch/wxprec_gllib
|
@COND_GCC_PCH_1@__gllib_PCH_INC = -I.pch/wxprec_gllib
|
||||||
@COND_GCC_PCH_1@___pch_wxprec_gllib_wx_wxprec_h_gch___depname \
|
@COND_GCC_PCH_1@___pch_wxprec_gllib_wx_wxprec_h_gch___depname \
|
||||||
@COND_GCC_PCH_1@ = .pch/wxprec_gllib/wx/wxprec.h.gch
|
@COND_GCC_PCH_1@ = .pch/wxprec_gllib/wx/wxprec.h.gch
|
||||||
|
@COND_TOOLKIT_COCOA@__OPENGL_SRC_OBJECTS_1 = gllib_glcanvas.o
|
||||||
@COND_TOOLKIT_GTK@__OPENGL_SRC_OBJECTS_1 = gllib_glcanvas.o
|
@COND_TOOLKIT_GTK@__OPENGL_SRC_OBJECTS_1 = gllib_glcanvas.o
|
||||||
@COND_TOOLKIT_MAC@__OPENGL_SRC_OBJECTS_1 = gllib_glcanvas.o
|
@COND_TOOLKIT_MAC@__OPENGL_SRC_OBJECTS_1 = gllib_glcanvas.o
|
||||||
@COND_TOOLKIT_MOTIF@__OPENGL_SRC_OBJECTS_1 = gllib_glcanvas.o
|
@COND_TOOLKIT_MOTIF@__OPENGL_SRC_OBJECTS_1 = gllib_glcanvas.o
|
||||||
@@ -20865,6 +20868,9 @@ xrclib_xmlrsall.o: $(srcdir)/src/xrc/xmlrsall.cpp $(XRCLIB_ODEP)
|
|||||||
@COND_TOOLKIT_MAC@gldll_glcanvas.o: $(srcdir)/src/mac/carbon/glcanvas.cpp $(GLDLL_ODEP)
|
@COND_TOOLKIT_MAC@gldll_glcanvas.o: $(srcdir)/src/mac/carbon/glcanvas.cpp $(GLDLL_ODEP)
|
||||||
@COND_TOOLKIT_MAC@ $(CXXC) -c -o $@ $(GLDLL_CXXFLAGS) $<
|
@COND_TOOLKIT_MAC@ $(CXXC) -c -o $@ $(GLDLL_CXXFLAGS) $<
|
||||||
|
|
||||||
|
@COND_TOOLKIT_COCOA@gldll_glcanvas.o: $(srcdir)/src/cocoa/glcanvas.mm $(GLDLL_ODEP)
|
||||||
|
@COND_TOOLKIT_COCOA@ $(CXXC) -c -o $@ $(GLDLL_CXXFLAGS) $<
|
||||||
|
|
||||||
@COND_TOOLKIT_GTK@gldll_glcanvas.o: $(srcdir)/src/gtk/glcanvas.cpp $(GLDLL_ODEP)
|
@COND_TOOLKIT_GTK@gldll_glcanvas.o: $(srcdir)/src/gtk/glcanvas.cpp $(GLDLL_ODEP)
|
||||||
@COND_TOOLKIT_GTK@ $(CXXC) -c -o $@ $(GLDLL_CXXFLAGS) $<
|
@COND_TOOLKIT_GTK@ $(CXXC) -c -o $@ $(GLDLL_CXXFLAGS) $<
|
||||||
|
|
||||||
@@ -20886,6 +20892,9 @@ xrclib_xmlrsall.o: $(srcdir)/src/xrc/xmlrsall.cpp $(XRCLIB_ODEP)
|
|||||||
@COND_TOOLKIT_MAC@gllib_glcanvas.o: $(srcdir)/src/mac/carbon/glcanvas.cpp $(GLLIB_ODEP)
|
@COND_TOOLKIT_MAC@gllib_glcanvas.o: $(srcdir)/src/mac/carbon/glcanvas.cpp $(GLLIB_ODEP)
|
||||||
@COND_TOOLKIT_MAC@ $(CXXC) -c -o $@ $(GLLIB_CXXFLAGS) $<
|
@COND_TOOLKIT_MAC@ $(CXXC) -c -o $@ $(GLLIB_CXXFLAGS) $<
|
||||||
|
|
||||||
|
@COND_TOOLKIT_COCOA@gllib_glcanvas.o: $(srcdir)/src/cocoa/glcanvas.mm $(GLLIB_ODEP)
|
||||||
|
@COND_TOOLKIT_COCOA@ $(CXXC) -c -o $@ $(GLLIB_CXXFLAGS) $<
|
||||||
|
|
||||||
@COND_TOOLKIT_GTK@gllib_glcanvas.o: $(srcdir)/src/gtk/glcanvas.cpp $(GLLIB_ODEP)
|
@COND_TOOLKIT_GTK@gllib_glcanvas.o: $(srcdir)/src/gtk/glcanvas.cpp $(GLLIB_ODEP)
|
||||||
@COND_TOOLKIT_GTK@ $(CXXC) -c -o $@ $(GLLIB_CXXFLAGS) $<
|
@COND_TOOLKIT_GTK@ $(CXXC) -c -o $@ $(GLLIB_CXXFLAGS) $<
|
||||||
|
|
||||||
|
@@ -2406,6 +2406,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
|
|
||||||
<set var="OPENGL_SRC" hints="files">
|
<set var="OPENGL_SRC" hints="files">
|
||||||
<if cond="TOOLKIT=='MAC'">src/mac/carbon/glcanvas.cpp</if>
|
<if cond="TOOLKIT=='MAC'">src/mac/carbon/glcanvas.cpp</if>
|
||||||
|
<if cond="TOOLKIT=='COCOA'">src/cocoa/glcanvas.mm</if>
|
||||||
<if cond="TOOLKIT=='GTK'">src/gtk/glcanvas.cpp</if>
|
<if cond="TOOLKIT=='GTK'">src/gtk/glcanvas.cpp</if>
|
||||||
<if cond="TOOLKIT=='MSW'">src/msw/glcanvas.cpp</if>
|
<if cond="TOOLKIT=='MSW'">src/msw/glcanvas.cpp</if>
|
||||||
<if cond="TOOLKIT=='WINCE'">src/msw/glcanvas.cpp</if>
|
<if cond="TOOLKIT=='WINCE'">src/msw/glcanvas.cpp</if>
|
||||||
@@ -2416,6 +2417,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
|
|
||||||
<set var="OPENGL_HDR" hints="files">
|
<set var="OPENGL_HDR" hints="files">
|
||||||
<if cond="TOOLKIT=='MAC'">wx/mac/carbon/glcanvas.h</if>
|
<if cond="TOOLKIT=='MAC'">wx/mac/carbon/glcanvas.h</if>
|
||||||
|
<if cond="TOOLKIT=='COCOA'">wx/cocoa/glcanvas.h</if>
|
||||||
<if cond="TOOLKIT=='GTK'">wx/gtk/glcanvas.h</if>
|
<if cond="TOOLKIT=='GTK'">wx/gtk/glcanvas.h</if>
|
||||||
<if cond="TOOLKIT=='MSW'">wx/msw/glcanvas.h</if>
|
<if cond="TOOLKIT=='MSW'">wx/msw/glcanvas.h</if>
|
||||||
<if cond="TOOLKIT=='WINCE'">wx/msw/glcanvas.h</if>
|
<if cond="TOOLKIT=='WINCE'">wx/msw/glcanvas.h</if>
|
||||||
|
123
include/wx/cocoa/glcanvas.h
Normal file
123
include/wx/cocoa/glcanvas.h
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: wx/cocoa/glcanvas.h
|
||||||
|
// Purpose: wxGLCanvas class
|
||||||
|
// Author: David Elliott
|
||||||
|
// Modified by:
|
||||||
|
// Created: 2004/09/29
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2004 David Elliott
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _WX_COCOA_GLCANVAS_H__
|
||||||
|
#define _WX_COCOA_GLCANVAS_H__
|
||||||
|
|
||||||
|
// #include "wx/cocoa/NSOpenGLView.h"
|
||||||
|
// Include gl.h from the OpenGL framework
|
||||||
|
#include <OpenGL/gl.h>
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_GL wxGLCanvas;
|
||||||
|
DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext);
|
||||||
|
//DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLView);
|
||||||
|
|
||||||
|
// ========================================================================
|
||||||
|
// wxGLContext
|
||||||
|
// ========================================================================
|
||||||
|
class WXDLLIMPEXP_GL wxGLContext: public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxGLContext(bool isRGB, wxGLCanvas *win, const wxPalette& palette = wxNullPalette);
|
||||||
|
|
||||||
|
wxGLContext( bool isRGB, wxGLCanvas *win,
|
||||||
|
const wxPalette& WXUNUSED(palette),
|
||||||
|
const wxGLContext *other /* for sharing display lists */ );
|
||||||
|
|
||||||
|
~wxGLContext();
|
||||||
|
|
||||||
|
|
||||||
|
void SetCurrent();
|
||||||
|
|
||||||
|
void SetColour(const wxChar *colour);
|
||||||
|
|
||||||
|
void SwapBuffers();
|
||||||
|
|
||||||
|
|
||||||
|
inline wxWindow* GetWindow() const
|
||||||
|
{ return m_window; }
|
||||||
|
|
||||||
|
inline WX_NSOpenGLContext GetNSOpenGLContext() const
|
||||||
|
{ return m_cocoaNSOpenGLContext; }
|
||||||
|
|
||||||
|
public:
|
||||||
|
WX_NSOpenGLContext m_cocoaNSOpenGLContext;
|
||||||
|
wxWindow* m_window;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ========================================================================
|
||||||
|
// wxGLCanvas
|
||||||
|
// ========================================================================
|
||||||
|
class WXDLLIMPEXP_GL wxGLCanvas: public wxWindow// , protected wxCocoaNSOpenGLView
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxGLCanvas)
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
// WX_DECLARE_COCOA_OWNER(NSOpenGLView,NSView,NSView)
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// initialization
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
public:
|
||||||
|
wxGLCanvas()
|
||||||
|
: m_glContext(NULL)
|
||||||
|
{ }
|
||||||
|
wxGLCanvas(wxWindow *parent, wxWindowID winid = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0, const wxString& name = wxGLCanvasName,
|
||||||
|
int *attribList = NULL, const wxPalette& palette = wxNullPalette);
|
||||||
|
|
||||||
|
wxGLCanvas(wxWindow *parent,
|
||||||
|
const wxGLContext *shared = NULL,
|
||||||
|
wxWindowID winid = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0, const wxString& name = wxGLCanvasName,
|
||||||
|
int *attribList = NULL, const wxPalette& palette = wxNullPalette);
|
||||||
|
|
||||||
|
wxGLCanvas(wxWindow *parent,
|
||||||
|
const wxGLCanvas *shared = NULL,
|
||||||
|
wxWindowID winid = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0, const wxString& name = wxGLCanvasName,
|
||||||
|
int *attribList = NULL, const wxPalette& palette = wxNullPalette);
|
||||||
|
|
||||||
|
bool Create(wxWindow *parent, wxWindowID winid,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0, const wxString& name = wxGLCanvasName);
|
||||||
|
virtual ~wxGLCanvas();
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// Cocoa callbacks
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
protected:
|
||||||
|
// NSOpenGLView cannot be enabled/disabled
|
||||||
|
virtual void CocoaSetEnabled(bool enable) { }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// Implementation
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
public:
|
||||||
|
void SetCurrent();
|
||||||
|
void SwapBuffers();
|
||||||
|
|
||||||
|
void OnSize(wxSizeEvent& event)
|
||||||
|
{}
|
||||||
|
inline wxGLContext* GetContext() const
|
||||||
|
{ return m_glContext; }
|
||||||
|
protected:
|
||||||
|
wxGLContext *m_glContext;
|
||||||
|
wxPalette m_palette;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //ndef _WX_COCOA_GLCANVAS_H__
|
@@ -17,6 +17,8 @@
|
|||||||
#include "wx/x11/glcanvas.h"
|
#include "wx/x11/glcanvas.h"
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
#include "wx/mac/glcanvas.h"
|
#include "wx/mac/glcanvas.h"
|
||||||
|
#elif defined(__WXCOCOA__)
|
||||||
|
#include "wx/cocoa/glcanvas.h"
|
||||||
#elif defined(__WXPM__)
|
#elif defined(__WXPM__)
|
||||||
#include "wx/os2/glcanvas.h"
|
#include "wx/os2/glcanvas.h"
|
||||||
#endif
|
#endif
|
||||||
|
82
src/cocoa/glcanvas.mm
Normal file
82
src/cocoa/glcanvas.mm
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: cocoa/glcanvas.mm
|
||||||
|
// Purpose: wxGLContext, wxGLCanvas
|
||||||
|
// Author: David Elliott
|
||||||
|
// Modified by:
|
||||||
|
// Created: 2004/09/29
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2004 David Elliott
|
||||||
|
// Licence: wxWidgets licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#if wxUSE_GLCANVAS
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/app.h"
|
||||||
|
#endif //WX_PRECOMP
|
||||||
|
#include "wx/glcanvas.h"
|
||||||
|
|
||||||
|
#include "wx/cocoa/autorelease.h"
|
||||||
|
|
||||||
|
#import <AppKit/NSOpenGL.h>
|
||||||
|
#import <AppKit/NSOpenGLView.h>
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxGLCanvas, wxWindow)
|
||||||
|
BEGIN_EVENT_TABLE(wxGLCanvas, wxWindow)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
// WX_IMPLEMENT_COCOA_OWNER(wxGLCanvas,NSOpenGLView,NSView,NSView)
|
||||||
|
|
||||||
|
wxGLCanvas::wxGLCanvas(wxWindow *parent,
|
||||||
|
const wxGLContext *shared,
|
||||||
|
wxWindowID winid, const wxPoint& pos, const wxSize& size,
|
||||||
|
long style, const wxString& name,
|
||||||
|
int *attribList, const wxPalette& palette)
|
||||||
|
{
|
||||||
|
Create(parent,winid,pos,size,style,name);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxGLCanvas::wxGLCanvas(wxWindow *parent,
|
||||||
|
const wxGLCanvas *shared,
|
||||||
|
wxWindowID winid, const wxPoint& pos, const wxSize& size,
|
||||||
|
long style, const wxString& name,
|
||||||
|
int *attribList, const wxPalette& palette)
|
||||||
|
{
|
||||||
|
Create(parent,winid,pos,size,style,name);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxGLCanvas::Create(wxWindow *parent, wxWindowID winid,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
|
const wxString& name)
|
||||||
|
{
|
||||||
|
wxAutoNSAutoreleasePool pool;
|
||||||
|
if(!CreateBase(parent,winid,pos,size,style,wxDefaultValidator,name))
|
||||||
|
return false;
|
||||||
|
SetNSView([[NSOpenGLView alloc] initWithFrame: MakeDefaultNSRect(size)
|
||||||
|
pixelFormat:[NSOpenGLView defaultPixelFormat]]);
|
||||||
|
[m_cocoaNSView release];
|
||||||
|
if(m_parent)
|
||||||
|
m_parent->CocoaAddChild(this);
|
||||||
|
SetInitialFrameRect(pos,size);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxGLCanvas::~wxGLCanvas()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGLCanvas::SetCurrent()
|
||||||
|
{
|
||||||
|
[[(NSOpenGLView*)m_cocoaNSView openGLContext] makeCurrentContext];
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGLCanvas::SwapBuffers()
|
||||||
|
{
|
||||||
|
[[(NSOpenGLView*)m_cocoaNSView openGLContext] flushBuffer];
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_GLCANVAS
|
Reference in New Issue
Block a user