00001 /* ==================================================== ======== ======= * 00002 * 00003 * uglpane.hpp: a widget for rendering OpenGL graphics (requires X11 and OpenGL) 00004 * Ubit Project 00005 * Part of the Ubit Toolkit: A Brick Construction Game Model for Creating GUIs 00006 * (C) 1999-2006 Eric Lecolinet / ENST Paris / http://www.enst.fr/~elc/ubit 00007 * 00008 * *********************************************************************** 00009 * COPYRIGHT NOTICE : 00010 * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE 00011 * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 00012 * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU 00013 * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION; 00014 * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION. 00015 * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS. 00016 * *********************************************************************** 00017 * ==================================================== [(c)Elc] ======= * 00018 * ==================================================== ======== ======= */ 00019 00020 #ifndef _uglpane_hpp_ 00021 #define _uglpane_hpp_ 00022 //pragma ident "@(#)uglpane.hpp ubit:05.05.00" 00023 # include <GL/gl.h> 00024 # include <GL/glu.h> 00025 # include <GL/glx.h> 00026 #include <ubit/uplugpane.hpp> 00027 00028 namespace ubit { 00029 00043 class UGlpane : public UPlugpane { 00044 public: 00045 UBIT_ELEMENT_CLASS(UGlpane, UPlugpane) 00046 00047 UGlpane(const UArgs& arglist = UArgs::none); 00048 virtual ~UGlpane(); 00049 00050 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00051 00052 virtual void makeCurrent(); 00058 virtual void swapBuffers(); 00066 void setAutoBufferSwap(bool state); 00068 00069 protected: 00070 virtual void initGL(UEvent&) {} 00075 virtual void resizeGL(UEvent&, int w, int h) {} 00080 virtual void paintGL(UEvent&) {} 00088 // - impl - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00089 protected: 00090 virtual void initGLImpl(UEvent&); 00092 00093 virtual void resizeGLImpl(UEvent&); 00095 00096 virtual void paintGLImpl(UEvent&); 00098 00099 GLXContext getGLContext() {return glcontext;} 00100 00101 private: 00102 GLXContext glcontext; 00103 bool is_init, is_autoswap; 00104 }; 00105 00106 } 00107 #endif 00108 /* ==================================================== [TheEnd] ======= */ 00109 /* ==================================================== [(c)Elc] ======= */ 00110