H3D r211. Qt 4.5.1. Tested on Linux x86 and x86_64. Slackware 13.0 distribution.
The simplest app does not work.
CMakeLists.txt:
Code:
PROJECT(QH)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
CMAKE_POLICY(VERSION 2.6)
# Debug, all warnings.
ADD_DEFINITIONS(-g -Wall)
# Find Qt4.
INCLUDE(FindQt4)
FIND_PACKAGE(Qt4 REQUIRED)
SET(QT_USE_QTOPENGL TRUE)
INCLUDE(${QT_USE_FILE})
INCLUDE_DIRECTORIES(${QT_INCLUDES}
/usr/local/include
/usr/include)
# Headers with Q_OBJECT macro.
SET(
QH_MOC_HDR
GLWidget.h
)
QT4_WRAP_CPP(QH_MOC_SRC ${QH_MOC_HDR})
# Sources.
SET(
QH_SRC
GLWidget.cpp
main.cpp
)
ADD_EXECUTABLE(test ${QH_MOC_SRC} ${QH_SRC})
TARGET_LINK_LIBRARIES(test ${QT_LIBRARIES} Horde3D Horde3DUtils)
GLWidget.cpp:
Code:
#include "GLWidget.h"
#include <stdexcept>
GLWidget::GLWidget() : QGLWidget() {
}
GLWidget::~GLWidget() {
}
void GLWidget::initializeGL() {
if (!h3dInit()) {
h3dutDumpMessages();
throw std::runtime_error("Could not initialize renderer");
}
}
GLWidget.h:
Code:
#ifndef GL_WIDGET_H
#define GL_WIDGET_H
#include <QtOpenGL>
#include <horde3d/Horde3D.h>
#include <horde3d/Horde3DUtils.h>
class GLWidget : public QGLWidget {
Q_OBJECT
public:
GLWidget();
~GLWidget();
QSize minimumSizeHint() const {
return QSize(640, 480);
}
QSize sizeHint() const {
return QSize(640, 480);
}
protected:
void initializeGL();
};
#endif // GL_WIDGET_H
main.cpp:
Code:
#include "GLWidget.h"
#include <QApplication>
int main(int argc, char* argv[]) {
QApplication app(argc, argv);
GLWidget glw;
glw.show();
return app.exec();
}
Full backtrace:
Code:
(gdb) run
Starting program: /home/kornerr/build/qh/test
[Thread debugging using libthread_db enabled]
[New Thread 0x7f563eadc790 (LWP 8774)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f563eadc790 (LWP 8774)]
0x00007f563e4d0c80 in glCreateShader () from /usr/lib64/libGL.so.1
(gdb) bt
#0 0x00007f563e4d0c80 in glCreateShader () from /usr/lib64/libGL.so.1
#1 0x00007f563b546270 in RendererBase::loadShader (this=0x72c3f0,
vertexShader=0x7f563b59bb38 "uniform mat4 worldMat;\nattribute vec3 vertPos;\nvoid main() {\n\tgl_Position = gl_ModelViewProjectionMatrix * worldMat * vec4( vertPos, 1.0 );\n}\n",
fragmentShader=0x7f563b59bbc8 "uniform vec4 color;\nvoid main() {\n\tgl_FragColor = color;\n}\n")
at /home/kornerr/build/horde3d/trunk/Horde3D/Source/Horde3DEngine/egRendererBase.cpp:441
#2 0x00007f563b546669 in RendererBase::createShader (this=0x72c3f0,
vertexShader=0x7f563b59bb38 "uniform mat4 worldMat;\nattribute vec3 vertPos;\nvoid main() {\n\tgl_Position = gl_ModelViewProjectionMatrix * worldMat * vec4( vertPos, 1.0 );\n}\n",
fragmentShader=0x7f563b59bbc8 "uniform vec4 color;\nvoid main() {\n\tgl_FragColor = color;\n}\n")
at /home/kornerr/build/horde3d/trunk/Horde3D/Source/Horde3DEngine/egRendererBase.cpp:522
#3 0x00007f563b55715f in Renderer::createShaderComb (this=0x72c3f0,
vertexShader=0x7f563b59bb38 "uniform mat4 worldMat;\nattribute vec3 vertPos;\nvoid main() {\n\tgl_Position = gl_ModelViewProjectionMatrix * worldMat * vec4( vertPos, 1.0 );\n}\n",
fragmentShader=0x7f563b59bbc8 "uniform vec4 color;\nvoid main() {\n\tgl_FragColor = color;\n}\n", sc=@0x72c770)
at /home/kornerr/build/horde3d/trunk/Horde3D/Source/Horde3DEngine/egRenderer.cpp:235
#4 0x00007f563b557887 in Renderer::init (this=0x72c3f0)
---Type <return> to continue, or q <return> to quit---
at /home/kornerr/build/horde3d/trunk/Horde3D/Source/Horde3DEngine/egRenderer.cpp:129
#5 0x00007f563b52f322 in Modules::init ()
at /home/kornerr/build/horde3d/trunk/Horde3D/Source/Horde3DEngine/egModules.cpp:75
#6 0x00007f563b51ed1c in h3dInit ()
at /home/kornerr/build/horde3d/trunk/Horde3D/Source/Horde3DEngine/egMain.cpp:94
#7 0x0000000000403114 in GLWidget::initializeGL (this=0x7fffd4e9c580)
at /home/kornerr/cpp/qt/horde3d/GLWidget.cpp:14
#8 0x00007f563e78beb4 in QGLWidget::glInit ()
from /usr/lib64/qt/lib/libQtOpenGL.so.4
#9 0x00007f563e7bf99c in QGLWidget::resizeEvent ()
from /usr/lib64/qt/lib/libQtOpenGL.so.4
#10 0x00007f563d8e1f9a in QWidget::event ()
from /usr/lib64/qt/lib/libQtGui.so.4
#11 0x00007f563e78efa1 in QGLWidget::event ()
from /usr/lib64/qt/lib/libQtOpenGL.so.4
#12 0x00007f563d890efd in QApplicationPrivate::notify_helper ()
from /usr/lib64/qt/lib/libQtGui.so.4
#13 0x00007f563d89917a in QApplication::notify ()
from /usr/lib64/qt/lib/libQtGui.so.4
#14 0x00007f563c167afc in QCoreApplication::notifyInternal ()
from /usr/lib64/qt/lib/libQtCore.so.4
#15 0x00007f563d8e09b3 in QWidgetPrivate::sendPendingMoveAndResizeEvents ()
from /usr/lib64/qt/lib/libQtGui.so.4
---Type <return> to continue, or q <return> to quit---
#16 0x00007f563d8e6e53 in QWidgetPrivate::show_helper ()
from /usr/lib64/qt/lib/libQtGui.so.4
#17 0x00007f563d8e751a in QWidget::setVisible ()
from /usr/lib64/qt/lib/libQtGui.so.4
#18 0x000000000040348b in QWidget::show (this=0x7fffd4e9c580)
at /usr/lib64/qt/include/QtGui/qwidget.h:473
#19 0x00000000004033ee in main (argc=1, argv=0x7fffd4e9c6a8)
at /home/kornerr/cpp/qt/horde3d/main.cpp:8
But I could successfully display Knight model within SDL. What can be the problem?