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

FXGLCanvas.h

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,2002 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.24 2002/01/18 22:42:53 jeroen Exp $                     *
00023 ********************************************************************************/
00024 #ifndef FXGLCANVAS_H
00025 #define FXGLCANVAS_H
00026 
00027 #ifndef FXCANVAS_H
00028 #include "FXCanvas.h"
00029 #endif
00030 
00031 
00032 
00033 /// GLCanvas, an area drawn by another object
00034 class FXAPI FXGLCanvas : public FXCanvas {
00035   FXDECLARE(FXGLCanvas)
00036 private:
00037   FXGLCanvas  *sgnext;  // Share group next in share list
00038   FXGLCanvas  *sgprev;  // Share group previous in share list
00039 protected:
00040   void        *ctx;     // GL Context
00041 protected:
00042   FXGLCanvas();
00043 private:
00044   FXGLCanvas(const FXGLCanvas&);
00045   FXGLCanvas &operator=(const FXGLCanvas&);
00046 #ifdef WIN32
00047   virtual const char* GetClass() const;
00048 #endif
00049 public:
00050 
00051   /**
00052   * Construct an OpenGL-capable canvas, with its own private display list.
00053   */
00054   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);
00055 
00056   /**
00057   * Construct an OpenGL-capable canvas, sharing display
00058   * list with another GL canvas.  This canvas becomes a member
00059   * of a display list share group.  All members of the display
00060   * list share group have to have the same visual.
00061   */
00062   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);
00063 
00064   /// Return TRUE if it is sharing display lists
00065   FXbool isShared() const;
00066 
00067   /// Create all of the server-side resources for this window
00068   virtual void create();
00069 
00070   /// Detach the server-side resources for this window
00071   virtual void detach();
00072 
00073   /// Destroy the server-side resources for this window
00074   virtual void destroy();
00075 
00076   /// Make OpenGL context current prior to performing OpenGL commands
00077   virtual FXbool makeCurrent();
00078 
00079   /// Make OpenGL context non current
00080   virtual FXbool makeNonCurrent();
00081 
00082   /// Return TRUE if context is current
00083   virtual FXbool isCurrent() const;
00084 
00085   /// Get GL context handle
00086   void* getContext() const { return ctx; }
00087 
00088   /// Swap front and back buffer
00089   virtual void swapBuffers();
00090 
00091   /// Save object to stream
00092   virtual void save(FXStream& store) const;
00093 
00094   /// Load object from stream
00095   virtual void load(FXStream& store);
00096 
00097   /// Destructor
00098   virtual ~FXGLCanvas();
00099   };
00100 
00101 
00102 
00103 #endif
00104