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