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

FXGLContext.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                     G L  R e n d e r i n g   C o n t e x t                    *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2000,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: FXGLContext.h,v 1.47 2009/01/06 13:07:24 fox Exp $                       *
00022 ********************************************************************************/
00023 #ifndef FXGLCONTEXT_H
00024 #define FXGLCONTEXT_H
00025 
00026 #ifndef FXID_H
00027 #include "FXId.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 /// OpenGL context
00034 class FXAPI FXGLContext : public FXId {
00035   FXDECLARE(FXGLContext)
00036 private:
00037   FXDrawable  *surface;         // Drawable surface
00038   FXGLVisual  *visual;          // Visual for this window
00039   FXGLContext *shared;          // Shared with other
00040 private:
00041   FXGLContext(const FXGLContext&);
00042   FXGLContext &operator=(const FXGLContext&);
00043 protected:
00044   FXGLContext();
00045 public:
00046 
00047   /**
00048   * Construct an GL Context with given GL Visual.  Optionally
00049   * share a display list with another GL Context shr.
00050   */
00051   FXGLContext(FXApp *a,FXGLVisual *vis,FXGLContext* shr=NULL);
00052 
00053   /// Create context
00054   virtual void create();
00055 
00056   /// Detach context
00057   virtual void detach();
00058 
00059   /// Destroy context
00060   virtual void destroy();
00061 
00062   /// Change visual
00063   void setVisual(FXGLVisual* vis);
00064 
00065   /// Get the visual
00066   FXGLVisual* getVisual() const { return visual; }
00067 
00068   /// Change share context
00069   void setShared(FXGLContext *ctx);
00070 
00071   /// Get share context
00072   FXGLContext* getShared() const { return shared; }
00073 
00074   /// Return active drawable
00075   FXDrawable *drawable() const { return surface; }
00076 
00077   /// Make context current on drawable
00078   FXbool begin(FXDrawable *draw);
00079 
00080   /// Make context non current
00081   FXbool end();
00082 
00083   /// Swap front and back buffer
00084   void swapBuffers();
00085 
00086   /// Return true if THIS context is current
00087   FXbool isCurrent() const;
00088 
00089   /// Return true if thread has ANY current context
00090   static FXbool hasCurrent();
00091 
00092   /// Has double buffering
00093   FXbool isDoubleBuffer() const;
00094 
00095   /// Has stereo buffering
00096   FXbool isStereo() const;
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 ~FXGLContext();
00106   };
00107 
00108 
00109 
00110 /// Create a display list of bitmaps from font glyphs in a font
00111 extern FXAPI FXbool glUseFXFont(FXFont* font,int first,int count,int list);
00112 
00113 }
00114 
00115 #endif
00116 

Copyright © 1997-2009 Jeroen van der Zijp