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,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (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 GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXGLCanvas.h,v 1.33 2006/01/22 17:58:02 fox Exp $                        *
00023 ********************************************************************************/
00024 #ifndef FXGLCANVAS_H
00025 #define FXGLCANVAS_H
00026 
00027 #ifndef FXCANVAS_H
00028 #include "FXCanvas.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 class FXGLVisual;
00035 
00036 
00037 /// GLCanvas, an area drawn by another object
00038 class FXAPI FXGLCanvas : public FXCanvas {
00039   FXDECLARE(FXGLCanvas)
00040 private:
00041   FXGLCanvas  *sgnext;  // Share group next in share list
00042   FXGLCanvas  *sgprev;  // Share group previous in share list
00043 protected:
00044   void        *ctx;     // GL Context
00045 protected:
00046   FXGLCanvas();
00047 private:
00048   FXGLCanvas(const FXGLCanvas&);
00049   FXGLCanvas &operator=(const FXGLCanvas&);
00050 #ifdef WIN32
00051   virtual const char* GetClass() const;
00052 #endif
00053 public:
00054 
00055   /**
00056   * Construct an OpenGL-capable canvas, with its own private display list.
00057   */
00058   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);
00059 
00060   /**
00061   * Construct an OpenGL-capable canvas, sharing display
00062   * list with another GL canvas.  This canvas becomes a member
00063   * of a display list share group.  All members of the display
00064   * list share group have to have the same visual.
00065   */
00066   FXGLCanvas(FXComposite* p,FXGLVisual *vis,FXGLCanvas* sharegroup,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00067 
00068   /// Return TRUE if it is sharing display lists
00069   FXbool isShared() const;
00070 
00071   /// Create all of the server-side resources for this window
00072   virtual void create();
00073 
00074   /// Detach the server-side resources for this window
00075   virtual void detach();
00076 
00077   /// Destroy the server-side resources for this window
00078   virtual void destroy();
00079 
00080   /// Make OpenGL context current prior to performing OpenGL commands
00081   virtual FXbool makeCurrent();
00082 
00083   /// Make OpenGL context non current
00084   virtual FXbool makeNonCurrent();
00085 
00086   /// Return TRUE if this window's context is current
00087   virtual FXbool isCurrent() const;
00088 
00089   /// Return current context, if any
00090   static void* getCurrentContext();
00091 
00092   /// Get GL context handle
00093   void* getContext() const { return ctx; }
00094 
00095   /// Swap front and back buffer
00096   virtual void swapBuffers();
00097 
00098   /// Save object to stream
00099   virtual void save(FXStream& store) const;
00100 
00101   /// Load object from stream
00102   virtual void load(FXStream& store);
00103 
00104   /// Destructor
00105   virtual ~FXGLCanvas();
00106   };
00107 
00108 }
00109 
00110 #endif
00111 

Copyright © 1997-2005 Jeroen van der Zijp