![]() |
http://www.sim.no http://www.coin3d.org |
00001 #ifndef SOQT_GLWIDGET_H 00002 #define SOQT_GLWIDGET_H 00003 00004 // src/Inventor/Qt/SoQtGLWidget.h. Generated from SoGuiGLWidget.h.in by configure. 00005 00006 /**************************************************************************\ 00007 * 00008 * This file is part of the Coin 3D visualization library. 00009 * Copyright (C) by Kongsberg Oil & Gas Technologies. 00010 * 00011 * This library is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU General Public License 00013 * ("GPL") version 2 as published by the Free Software Foundation. 00014 * See the file LICENSE.GPL at the root directory of this source 00015 * distribution for additional information about the GNU GPL. 00016 * 00017 * For using Coin with software that can not be combined with the GNU 00018 * GPL, and for taking advantage of the additional benefits of our 00019 * support services, please contact Kongsberg Oil & Gas Technologies 00020 * about acquiring a Coin Professional Edition License. 00021 * 00022 * See http://www.coin3d.org/ for more information. 00023 * 00024 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY. 00025 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org 00026 * 00027 \**************************************************************************/ 00028 00029 #include <Inventor/SbBasic.h> 00030 #include <Inventor/Qt/SoQtBasic.h> 00031 #include <Inventor/Qt/SoQtComponent.h> 00032 00033 #ifdef __COIN_SOQT__ 00034 class QEvent; 00035 #endif // __COIN_SOQT__ 00036 #ifdef __COIN_SOXT__ 00037 /* 00038 * GL/glx.h includes X11/Xmd.h which contains typedefs for BOOL and 00039 * INT32 that conflict with the definitions in windef.h (which is 00040 * included from windows.h, which may be included from 00041 * Inventor/system/gl.h). To avoid this conflict, we rename the 00042 * typedefs done in X11/Xmd.h to use other names (tempbool and 00043 * tempint32), and try to clean up the hack after the header has been 00044 * parsed. 2003-06-25 larsa 00045 */ 00046 #ifndef BOOL 00047 #define BOOL tempbool 00048 #define COIN_DEFINED_BOOL 00049 #endif /* !BOOL */ 00050 #ifndef INT32 00051 #define INT32 tempint32 00052 #define COIN_DEFINED_INT32 00053 #endif /* !INT32 */ 00054 #include <GL/glx.h> 00055 /* 00056 * This is the cleanup part of the X11/Xmd.h conflict fix hack set up 00057 * above. 2003-06-25 larsa 00058 */ 00059 #ifdef COIN_DEFINED_BOOL 00060 #undef BOOL 00061 #undef COIN_DEFINED_BOOL 00062 #endif /* COIN_DEFINED_BOOL */ 00063 #ifdef COIN_DEFINED_INT32 00064 #undef INT32 00065 #undef COIN_DEFINED_INT32 00066 #endif /* COIN_DEFINED_INT32 */ 00067 #endif // __COIN_SOXT__ 00068 #ifdef __COIN_SOGTK__ 00069 #include <gtk/gtk.h> 00070 #endif // __COIN_SOGTK__ 00071 00072 // ************************************************************************* 00073 00074 enum GLModes { 00075 SO_GL_RGB = 0x01, SO_GLX_RGB = SO_GL_RGB, 00076 SO_GL_DOUBLE = 0x02, SO_GLX_DOUBLE = SO_GL_DOUBLE, 00077 SO_GL_ZBUFFER = 0x04, SO_GLX_ZBUFFER = SO_GL_ZBUFFER, 00078 SO_GL_OVERLAY = 0x08, SO_GLX_OVERLAY = SO_GL_OVERLAY, 00079 SO_GL_STEREO = 0x10, SO_GLX_STEREO = SO_GL_STEREO 00080 }; 00081 00082 // ************************************************************************* 00083 00084 class SOQT_DLL_API SoQtGLWidget : public SoQtComponent { 00085 SOQT_OBJECT_ABSTRACT_HEADER(SoQtGLWidget, SoQtComponent); 00086 00087 public: 00088 00089 void setBorder(const SbBool enable); 00090 SbBool isBorder(void) const; 00091 00092 virtual void setDoubleBuffer(const SbBool enable); 00093 SbBool isDoubleBuffer(void) const; 00094 00095 void setDrawToFrontBufferEnable(const SbBool enable); 00096 SbBool isDrawToFrontBufferEnable(void) const; 00097 00098 void setQuadBufferStereo(const SbBool enable); 00099 SbBool isQuadBufferStereo(void) const; 00100 00101 void setAccumulationBuffer(const SbBool enable); 00102 SbBool getAccumulationBuffer(void) const; 00103 00104 void setStencilBuffer(const SbBool enable); 00105 SbBool getStencilBuffer(void) const; 00106 00107 void setAlphaChannel(const SbBool enable); 00108 SbBool getAlphaChannel(void) const; 00109 00110 void setOverlayRender(const SbBool onoff); 00111 SbBool isOverlayRender(void) const; 00112 00113 void setSampleBuffers(const int numsamples); 00114 int getSampleBuffers(void) const; 00115 00116 void setStealFocus(SbBool enable); 00117 SbBool isStealFocus(void) const; 00118 00119 QWidget * getGLWidget(void) const; 00120 QWidget * getNormalWidget(void) const; 00121 QWidget * getOverlayWidget(void) const; 00122 00123 SbBool hasOverlayGLArea(void) const; 00124 SbBool hasNormalGLArea(void) const; 00125 00126 unsigned long getOverlayTransparentPixel(void); 00127 00128 // OpenGL query functions. 00129 void getPointSizeLimits(SbVec2f & range, float & granularity); 00130 void getLineWidthLimits(SbVec2f & range, float & granularity); 00131 00132 protected: 00133 SoQtGLWidget(QWidget * const parent = NULL, 00134 const char * const name = NULL, 00135 const SbBool embed = TRUE, 00136 const int glmodes = SO_GL_RGB, 00137 const SbBool build = TRUE); 00138 ~SoQtGLWidget(); 00139 00140 virtual void processEvent(QEvent * event); 00141 00142 QWidget * buildWidget(QWidget * parent); 00143 00144 virtual void redraw(void) = 0; 00145 virtual void redrawOverlay(void); 00146 00147 virtual void initGraphic(void); 00148 virtual void initOverlayGraphic(void); 00149 00150 virtual void sizeChanged(const SbVec2s & size); 00151 virtual void widgetChanged(QWidget * w); 00152 00153 void setGLSize(const SbVec2s size); 00154 SbVec2s getGLSize(void) const; 00155 float getGLAspectRatio(void) const; 00156 00157 // old aliases 00158 void setGlxSize(const SbVec2s size) { this->setGLSize(size); } 00159 SbVec2s getGlxSize(void) const { return this->getGLSize(); } 00160 float getGlxAspectRatio(void) const { return this->getGLAspectRatio(); } 00161 00162 void setStereoBuffer(SbBool flag); 00163 SbBool isStereoBuffer(void) const; 00164 00165 SbBool isRGBMode(void); 00166 00167 SbBool waitForExpose; 00168 SbBool drawToFrontBuffer; 00169 00170 void glLockNormal(void); 00171 void glUnlockNormal(void); 00172 00173 void glLockOverlay(void); 00174 void glUnlockOverlay(void); 00175 00176 void glSwapBuffers(void); 00177 void glFlushBuffer(void); 00178 00179 virtual SbBool glScheduleRedraw(void); 00180 00181 private: 00182 class SoQtGLWidgetP * pimpl; 00183 friend class SoGuiGLWidgetP; 00184 friend class SoQtGLWidgetP; 00185 00186 // FIXME: get rid of toolkit-specific stuff below. 20020613 mortene. 00187 00188 #ifdef __COIN_SOXT__ 00189 public: 00190 GLXContext getNormalContext(void); 00191 GLXContext getOverlayContext(void); 00192 00193 Window getNormalWindow(void); 00194 Window getOverlayWindow(void); 00195 00196 int getOverlayColorMapSize(void); 00197 int getColorMapSize(void); 00198 00199 virtual void setNormalVisual(XVisualInfo * visual); 00200 XVisualInfo * getNormalVisual(void); 00201 virtual void setOverlayVisual(XVisualInfo * visual); 00202 XVisualInfo * getOverlayVisual(void); 00203 00204 protected: 00205 static void eventHandler(Widget, SoXtGLWidget *, XAnyEvent *, Boolean *); 00206 00207 int getDisplayListShareGroup(GLXContext context); 00208 Widget getGlxMgrWidget(void); 00209 #endif // __COIN_SOXT__ 00210 00211 #ifdef __COIN_SOGTK__ 00212 protected: 00213 virtual SbBool eventFilter(GtkWidget * object, GdkEvent * event); 00214 #endif // __COIN_SOGTK__ 00215 00216 }; 00217 00218 // ************************************************************************* 00219 00220 #endif // ! SOQT_GLWIDGET_H
Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.
Generated on Thu Sep 15 2011 16:20:16 for SoQt by Doxygen 1.7.3.