39#include <qapplication.h>
40#include <qtabwidget.h>
42#ifdef G4OPENGL_VERSION_2
43#include <qglshaderprogram.h>
50 G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (),
name),
57 setFocusPolicy(Qt::StrongFocus);
63#ifdef G4OPENGL_VERSION_2
64 setVboDrawer(
new G4OpenGLVboDrawer(
this,
"OGL-VBO"));
82 glDrawBuffer (GL_BACK);
85 if (QGLWidget::parentWidget()) {
86 QTabWidget *parentTab =
dynamic_cast<QTabWidget*
> (QGLWidget::parentWidget()->parent()) ;
88 parentTab->setCurrentIndex(parentTab->count()-1);
97#ifndef G4OPENGL_VERSION_2
100 QGLShaderProgram *aQGLShaderProgram =
new QGLShaderProgram (
context());
101 fShaderProgram = aQGLShaderProgram->programId ();
103 aQGLShaderProgram->addShaderFromSourceCode(QGLShader::Vertex,
104 fVboDrawer->getVertexShaderSrc());
106 aQGLShaderProgram->addShaderFromSourceCode(QGLShader::Fragment,
107 fVboDrawer->getFragmentShaderSrc());
109 aQGLShaderProgram->link();
110 aQGLShaderProgram->bind();
112 fVertexPositionAttribute = glGetAttribLocation(fShaderProgram,
"aVertexPosition");
113 fcMatrixUniform = glGetUniformLocation(fShaderProgram,
"uCMatrix");
114 fpMatrixUniform = glGetUniformLocation(fShaderProgram,
"uPMatrix");
115 ftMatrixUniform = glGetUniformLocation(fShaderProgram,
"uTMatrix");
116 fmvMatrixUniform = glGetUniformLocation(fShaderProgram,
"uMVMatrix");
119 float identity[16] = {
125 glUniformMatrix4fv (fcMatrixUniform, 1, 0, identity);
126 glUniformMatrix4fv (fpMatrixUniform, 1, 0, identity);
127 glUniformMatrix4fv (ftMatrixUniform, 1, 0, identity);
128 glUniformMatrix4fv(fmvMatrixUniform, 1, 0, identity);
130 glUseProgram(fShaderProgram);
155#ifdef G4MULTITHREADED
202 if ((aWidth > 0) && (aHeight > 0)) {
230 if (!isMaximized() && !isFullScreen()) {
231 sw = normalGeometry().width();
232 sh = normalGeometry().height();
234 sw = frameGeometry().width();
235 sh = frameGeometry().height();
240 }
else if ((sw == 0) && (sh == 0)) {
void G4MouseReleaseEvent(QMouseEvent *evnt)
void G4MouseMoveEvent(QMouseEvent *event)
void G4keyPressEvent(QKeyEvent *event)
void updateViewerPropertiesTableWidget()
void G4MousePressEvent(QMouseEvent *event)
void G4wheelEvent(QWheelEvent *event)
void G4MouseDoubleClickEvent()
void updateSceneTreeWidget()
void G4manageContextMenuEvent(QContextMenuEvent *e)
bool fQGLWidgetInitialiseCompleted
void updateToolbarAndMouseContextMenu()
void G4keyReleaseEvent(QKeyEvent *event)
virtual void CreateMainWindow(QGLWidget *, const QString &)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
bool setExportImageFormat(std::string format, bool quiet=false)
unsigned int getWinHeight() const
void ResizeWindow(unsigned int, unsigned int)
unsigned int getWinWidth() const
G4bool isFramebufferReady()
G4Scene * GetScene() const
const G4String & GetName() const
const G4ViewParameters & GetViewParameters() const
G4VSceneHandler & fSceneHandler
DrawingStyle GetDrawingStyle() const
const char * name(G4int ptype)