Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXGLCanvas.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                G L  C a n v a s   W i n d o w   W i d g e t                   *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2009 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 *********************************************************************************
00021 * $Id: FXGLCanvas.h,v 1.47 2009/01/06 13:07:24 fox Exp $                        *
00022 ********************************************************************************/
00023 #ifndef FXGLCANVAS_H
00024 #define FXGLCANVAS_H
00025 
00026 #ifndef FXCANVAS_H
00027 #include "FXCanvas.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 class FXGLVisual;
00034 class FXGLContext;
00035 
00036 
00037 // GL Canvas options
00038 enum {
00039   GLCANVAS_OWN_CONTEXT = 0x00008000  /// Context is owned
00040   };
00041 
00042 
00043 /// GLCanvas, an area drawn by another object
00044 class FXAPI FXGLCanvas : public FXCanvas {
00045   FXDECLARE(FXGLCanvas)
00046 protected:
00047   FXGLContext *context; // Graphic context
00048 protected:
00049   FXGLCanvas();
00050 private:
00051   FXGLCanvas(const FXGLCanvas&);
00052   FXGLCanvas &operator=(const FXGLCanvas&);
00053 #ifdef WIN32
00054   virtual const void* GetClass() const;
00055 #endif
00056 public:
00057 
00058   /**
00059   * Construct a GL canvas with its private context and private display lists.
00060   */
00061   FXGLCanvas(FXComposite* p,FXGLVisual *vis,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00062 
00063   /**
00064   * Construct a GL canvas with its private context but shared display lists.
00065   */
00066   FXGLCanvas(FXComposite* p,FXGLVisual *vis,FXGLCanvas* share,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00067 
00068   /**
00069   * Construct a GL canvas with a shared context.
00070   */
00071   FXGLCanvas(FXComposite* p,FXGLContext* ctx,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00072 
00073   /// Change context
00074   void setContext(FXGLContext *ctx,FXbool owned=false);
00075 
00076   /// Get context
00077   FXGLContext* getContext() const { return context; }
00078 
00079   /// Create all of the server-side resources for this window
00080   virtual void create();
00081 
00082   /// Detach the server-side resources for this window
00083   virtual void detach();
00084 
00085   /// Destroy the server-side resources for this window
00086   virtual void destroy();
00087 
00088   /// Make OpenGL context current prior to performing OpenGL commands
00089   virtual FXbool makeCurrent();
00090 
00091   /// Make OpenGL context non current
00092   virtual FXbool makeNonCurrent();
00093 
00094   /// Return true if this window's context is current
00095   virtual FXbool isCurrent() const;
00096 
00097   /// Swap front and back buffer
00098   virtual void swapBuffers();
00099 
00100   /// Return true if it is sharing display lists
00101   FXbool isShared() const;
00102 
00103   /// Save object to stream
00104   virtual void save(FXStream& store) const;
00105 
00106   /// Load object from stream
00107   virtual void load(FXStream& store);
00108 
00109   /// Destructor
00110   virtual ~FXGLCanvas();
00111   };
00112 
00113 }
00114 
00115 #endif
00116 

Copyright © 1997-2009 Jeroen van der Zijp