From e203dbfe15557d017fedd73ae898578d8d41082d Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 14 Sep 2009 08:37:23 +0000 Subject: [PATCH] adding glFrustum to compat API, supporting SetColour on OpenGL ES git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61921 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/glcanvas.h | 4 ++-- src/common/glcmn.cpp | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/include/wx/glcanvas.h b/include/wx/glcanvas.h index 3af85386d0..7c325642fc 100644 --- a/include/wx/glcanvas.h +++ b/include/wx/glcanvas.h @@ -118,11 +118,9 @@ public: // miscellaneous helper functions // ------------------------------ -#ifndef wxHAS_OPENGL_ES // call glcolor() for the colour with the given name, return false if // colour not found bool SetColour(const wxString& colour); -#endif // return true if the extension with given name is supported // @@ -231,6 +229,8 @@ public: wxGLAPI(); ~wxGLAPI(); + static void glFrustum(GLfloat left, GLfloat right, GLfloat bottom, + GLfloat top, GLfloat zNear, GLfloat zFar); static void glBegin(GLenum mode); static void glTexCoord2f(GLfloat s, GLfloat t); static void glVertex3f(GLfloat x, GLfloat y, GLfloat z); diff --git a/src/common/glcmn.cpp b/src/common/glcmn.cpp index e52e4173e8..61ad338483 100644 --- a/src/common/glcmn.cpp +++ b/src/common/glcmn.cpp @@ -63,13 +63,15 @@ bool wxGLCanvasBase::SetCurrent(const wxGLContext& context) const return context.SetCurrent(*static_cast(this)); } -#ifndef wxHAS_OPENGL_ES bool wxGLCanvasBase::SetColour(const wxString& colour) { wxColour col = wxTheColourDatabase->Find(colour); if ( !col.Ok() ) return false; +#ifdef wxHAS_OPENGL_ES + wxGLAPI::glColor3f(col.Red() / 256., col.Green() / 256., col.Blue() / 256.); +#else GLboolean isRGBA; glGetBooleanv(GL_RGBA_MODE, &isRGBA); if ( isRGBA ) @@ -87,10 +89,9 @@ bool wxGLCanvasBase::SetColour(const wxString& colour) glIndexi(pix); } - +#endif return true; } -#endif wxGLCanvasBase::~wxGLCanvasBase() { @@ -206,6 +207,17 @@ wxGLAPI::~wxGLAPI() { } +void wxGLAPI::glFrustum(GLfloat left, GLfloat right, GLfloat bottom, + GLfloat top, GLfloat zNear, GLfloat zFar) +{ +#if wxUSE_OPENGL_EMULATION + ::glFrustumf(left, right, bottom, top, zNear, zFar); +#else + ::glFrustum(left, right, bottom, top, zNear, zFar); +#endif +} + + void wxGLAPI::glBegin(GLenum mode) { #if wxUSE_OPENGL_EMULATION -- 2.45.2