26#ifndef _SO_QT_GLWIDGET_
27#define _SO_QT_GLWIDGET_
29#include <Inventor/Qt/SoQtComponent.h>
31#include <Inventor/Qt/OivQtCompat.h>
32#include <Inventor/devices/SoGLFormat.h>
34#include <Inventor/Gui/SoGuiGLWidget.h>
35#include <Inventor/nodes/SoFullSceneAntialiasing.h>
40typedef std::set<int, std::less<int> > SoSamplesList;
43class SoQtRemoteRenderInfo;
47#include <QSurfaceFormat>
53#define SO_GLX_RGB (1<<0)
54#define SO_GLX_DOUBLE (1<<1)
55#define SO_GLX_ZBUFFER (1<<2)
56#define SO_GLX_STEREO (1<<4)
57#define SO_GLX_STENCIL (1<<5)
63class SoQGLContextProxy;
64class SoQGLWidgetProxy;
299#if !defined(_WIN32) && !defined(__APPLE__)
302 void setAttribList(
const int* newAttribList );
303 int* getAttribList()
const;
309 QWindow* getInternalQWindow();
317 static SbBool swapNormalBuffersCB(
void *data );
318 static SbBool bindNormalCurrentCB(
void *data );
319 static SbBool unbindNormalCurrentCB(
void *data );
320 static void* getNormalWindowCB(
void *data );
321 static void* getCurrentDisplayCB(
void *data);
328 float getPixelRatio();
334 void updateInternalOpenGLWindow(
bool immediatUpdate );
346#if !defined(__APPLE__) && !defined(_WIN32)
351 void setRemoteRenderPbufferEnable(
SbBool enable )
352 { m_remoteRenderPbufferEnable = enable; }
354 SbBool isRemoteRenderPbufferEnable()
const
355 {
return m_remoteRenderPbufferEnable; }
357 float getLowResPercent() {
return m_lowResPercent;}
363 const char* name = NULL,
364 SbBool buildInsideParent = TRUE,
365 int glModes = SO_GLX_RGB,
377#if defined(__linux__)
401 virtual void resize(
int w,
int h );
403 virtual void closeEvent( QCloseEvent* );
405 virtual void focusInEvent( QFocusEvent* );
407 virtual void focusOutEvent( QFocusEvent* );
409 virtual void showEvent( QShowEvent* );
411 virtual void hideEvent( QHideEvent* );
413 virtual void moveEvent( QMoveEvent* );
415 virtual void keyPressEvent( QKeyEvent* );
417 virtual void keyReleaseEvent( QKeyEvent* );
419 virtual void mouseMoveEvent( QMouseEvent* );
421 virtual void mousePressEvent( QMouseEvent* );
423 virtual void mouseReleaseEvent( QMouseEvent* );
425 virtual void mouseDoubleClickEvent( QMouseEvent* );
427 virtual void wheelEvent( QWheelEvent* );
429 bool eventFilter( QObject*
object, QEvent* event );
433 static void eventHandler( QWidget* w,
SoQtGLWidget* glw, QEvent* qe,
bool* b );
436 virtual void onFocusEvent(
SbBool hasFocus);
444 virtual void redraw() = 0;
446 virtual void processEvent( QEvent* anyevent );
455 virtual void initGraphic();
456 virtual void sizeChanged(
const SbVec2s& size );
458 virtual void widgetChanged( QWidget* w );
464 void setGlxSize(
SbVec2s newSize );
465 const SbVec2s& getGlxSize()
const {
return m_guiGLWidget->getGlxSize(); }
470 void setStereoBuffer(
SbBool flag );
471 SbBool isStereoBuffer() {
return (m_guiGLWidget->getGLModes() & SO_GLX_STEREO); }
474 SbBool isRGBMode() {
return (m_guiGLWidget->getGLModes() & SO_GLX_RGB); }
476#if defined(__linux__)
477 void allocCell( Display* display, Colormap cmap,
XColorPointer colorcells,
478 int ncolors,
int colorMapSize );
483 QWidget* buildWidget( QWidget* parent );
484 void changeCursor( QCursor newCursor );
485 QWidget* getGlxMgrWidget() {
return m_containerWidget; }
487 virtual void onExpose();
491 SbBool m_initialFsaaValueChanged;
493#if !defined(_WIN32) && !defined(__APPLE__)
494 enum RemoteRenderEnabled
500 RemoteRenderEnabled m_remoteRenderMode;
501 SoQtRemoteRenderInfo* m_remoteRenderInfo;
502 SbBool m_remoteRenderPbufferEnable;
504 float m_lowResLowPercent;
505 float m_lowResHighPercent;
506 float m_lowResPercent;
508 void remoteRenderInit();
509 void remoteRenderCleanup();
510 void remoteRenderGinitCB( QWidget* );
511 GLXContext remoteRenderLowResRenderGinitCB( QWidget* );
512 void remoteRenderResizeCB();
513 void remoteRenderSendImage();
514 void remoteRenderSendLowResRender();
516 void remoteRenderFatalError(
const char* methodName,
const char* message );
518 void setLowResLowPercent(
float percent ) { m_lowResLowPercent = percent; }
519 void setLowResHighPercent(
float percent ) { m_lowResHighPercent = percent; }
520 float getLowResLowPercent()
const {
return m_lowResLowPercent; }
521 float getLowResHighPercent()
const {
return m_lowResHighPercent;}
523 virtual void setLowResPercent(
float newLowres ) { m_lowResPercent = newLowres; }
528 void constructorCommon(
SbBool buildNow,
SbBool connectionType );
531 QPointer<QWidget> m_containerWidget;
532 QPointer<QVBoxLayout> m_containerLayout;
533 QPointer<QWidget> m_internalWidget;
534 QPointer<QWindow> m_internalWindow;
536 SoQGLContextProxy* m_context;
539 bool m_stereoActiveDelayed;
540 bool m_stereoBufferFlag;
542#if defined(__linux__)
546 QCursor currentCursor;
552 void buildNormalGLXWidget(
SoGLFormat* format = NULL );
554 virtual void initializeGL();
556 void destroyNormalWindows();
557 void destroyGLXWidget(
SbBool normalCall );
559 void destroyNormalWidget(
SbBool normalCall );
561 void notifyProxyDestruction( QWindow* window );
566 static void ginitCB( QWidget* w,
SoQtGLWidget* glw,
void* v );
567 static void exposeCB( QWidget* w,
SoQtGLWidget* glw,
void* v );
568 static void resizeCB( QWidget* w,
SoQtGLWidget* glw,
void* v );
570 static SbBool onGLFormatChangeCallback(
SoGLFormat& format,
void* userData );
572 SbBool remoteRenderGinitCB_pbuffer( QWidget* );
575 bool m_firstRenderSync;
576 static std::map<SoQtGLWidget*, bool> s_blackRendering;
577 static std::map<SoQtGLWidget*, bool> s_widgetRendered;
580 void destroyedQtContext();
Class for smart character strings.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Antialiasing par...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> OpenGL context m...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
AntialiasingMode
Enum which indicates the desired antialiasing algorithm.
@ AUTO
This is the default mode for antialiasing.