![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * G L C o n t e x t C l a s s * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 2000,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: FXGLContext.h,v 1.8 2002/01/18 22:42:53 jeroen Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXGLCONTEXT_H 00025 #define FXGLCONTEXT_H 00026 00027 ////////////////////////////// UNDER DEVELOPMENT ////////////////////////////// 00028 00029 00030 class FXApp; 00031 class FXDrawable; 00032 class FXGLVisual; 00033 00034 00035 /** 00036 * A GL context is an object representing the OpenGL state information. 00037 * Multiple GL context may share display lists to conserve memory. 00038 * When drawing multiple windows, it may be advantageous to share not only 00039 * display lists, but also GL contexts. Since the GL context is created 00040 * for a certain frame-buffer configuration, sharing of GL contexts is 00041 * only possible if the windows sharing the GL context all have the same 00042 * GL visual. 00043 * However, display lists may be shared between different GL contexts. 00044 */ 00045 class FXAPI FXGLContext : public FXId { 00046 FXDECLARE(FXGLContext) 00047 private: 00048 FXGLVisual *visual; // Visual for this context 00049 FXDrawable *surface; // Drawable context is locked on 00050 FXGLContext *sgnext; // Share group next in share list 00051 FXGLContext *sgprev; // Share group previous in share list 00052 protected: 00053 void *ctx; // GL Context 00054 protected: 00055 FXGLContext():visual(NULL),surface(NULL),sgnext(NULL),sgprev(NULL),ctx(NULL){} 00056 private: 00057 FXGLContext(const FXGLContext&); 00058 FXGLContext &operator=(const FXGLContext&); 00059 public: 00060 00061 /** 00062 * Construct an OpenGL context with its own private display list. 00063 */ 00064 FXGLContext(FXApp* a,FXGLVisual *vis); 00065 00066 /** 00067 * Construct an OpenGL context sharing display lists with an existing GL context. 00068 */ 00069 FXGLContext(FXApp* a,FXGLVisual *vis,FXGLContext *shared); 00070 00071 /// Return TRUE if it is sharing display lists 00072 FXbool isShared() const; 00073 00074 /// Get the visual 00075 FXGLVisual* getVisual() const { return visual; } 00076 00077 /// Create context 00078 virtual void create(); 00079 00080 /// Detach the server-side resources for this window 00081 virtual void detach(); 00082 00083 /// Destroy the server-side resources for this window 00084 virtual void destroy(); 00085 00086 /// Make OpenGL context current prior to performing OpenGL commands 00087 FXbool begin(FXDrawable *drawable); 00088 00089 /// Make OpenGL context non current 00090 FXbool end(); 00091 00092 /// Swap front and back buffer 00093 void swapBuffers(); 00094 00095 /// Copy part of backbuffer to front buffer [Mesa] 00096 void swapSubBuffers(FXint x,FXint y,FXint w,FXint h); 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 #endif 00110