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,2005 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.13 2005/01/16 16:06:06 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXGLCONTEXT_H 00025 #define FXGLCONTEXT_H 00026 00027 ////////////////////////////// UNDER DEVELOPMENT ////////////////////////////// 00028 00029 namespace FX { 00030 00031 class FXApp; 00032 class FXDrawable; 00033 class FXGLVisual; 00034 00035 00036 /** 00037 * A GL context is an object representing the OpenGL state information. 00038 * Multiple GL context may share display lists to conserve memory. 00039 * When drawing multiple windows, it may be advantageous to share not only 00040 * display lists, but also GL contexts. Since the GL context is created 00041 * for a certain frame-buffer configuration, sharing of GL contexts is 00042 * only possible if the windows sharing the GL context all have the same 00043 * GL visual. 00044 * However, display lists may be shared between different GL contexts. 00045 */ 00046 class FXAPI FXGLContext : public FXId { 00047 FXDECLARE(FXGLContext) 00048 private: 00049 FXGLVisual *visual; // Visual for this context 00050 FXDrawable *surface; // Drawable context is locked on 00051 FXGLContext *sgnext; // Share group next in share list 00052 FXGLContext *sgprev; // Share group previous in share list 00053 protected: 00054 void *ctx; // GL Context 00055 protected: 00056 FXGLContext():visual(NULL),surface(NULL),sgnext(NULL),sgprev(NULL),ctx(NULL){} 00057 private: 00058 FXGLContext(const FXGLContext&); 00059 FXGLContext &operator=(const FXGLContext&); 00060 public: 00061 00062 /** 00063 * Construct an OpenGL context with its own private display list. 00064 */ 00065 FXGLContext(FXApp* a,FXGLVisual *vis); 00066 00067 /** 00068 * Construct an OpenGL context sharing display lists with an existing GL context. 00069 */ 00070 FXGLContext(FXApp* a,FXGLVisual *vis,FXGLContext *shared); 00071 00072 /// Return TRUE if it is sharing display lists 00073 FXbool isShared() const; 00074 00075 /// Get the visual 00076 FXGLVisual* getVisual() const { return visual; } 00077 00078 /// Create context 00079 virtual void create(); 00080 00081 /// Detach the server-side resources for this window 00082 virtual void detach(); 00083 00084 /// Destroy the server-side resources for this window 00085 virtual void destroy(); 00086 00087 /// Make OpenGL context current prior to performing OpenGL commands 00088 FXbool begin(FXDrawable *drawable); 00089 00090 /// Make OpenGL context non current 00091 FXbool end(); 00092 00093 /// Swap front and back buffer 00094 void swapBuffers(); 00095 00096 /// Copy part of backbuffer to front buffer [Mesa] 00097 void swapSubBuffers(FXint x,FXint y,FXint w,FXint h); 00098 00099 /// Save object to stream 00100 virtual void save(FXStream& store) const; 00101 00102 /// Load object from stream 00103 virtual void load(FXStream& store); 00104 00105 /// Destructor 00106 virtual ~FXGLContext(); 00107 }; 00108 00109 } 00110 00111 #endif 00112
Copyright © 1997-2005 Jeroen van der Zijp |