Hello forum,
I am trying to create UI for a third party API - H3D and while doing
it i am getting the following error:
Code:
0-Source/HAPI/include -I/usr/X11R6/include -I. -I. -o H3DGLCanvas.o H3DGLCanvas.cpp In file included from /usr/local/include/H3D/H3DDisplayListObject.h:32, from /usr/local/include/H3D/X3DAppearanceNode.h:33, from /usr/local/include/H3D/Appearance.h:32, from /usr/local/include/H3D/DefaultAppearance.h:33, from /usr/local/include/H3D/H3DWindowNode.h:35, from MyH3DCanvasWindow.h:4, from H3DGLCanvas.cpp:3: /usr/include/GL/glew.h:84:2: error: #error gl.h included before glew.h /usr/include/GL/glew.h:87:2: error: #error glext.h included before glew.h In file included from /usr/local/include/H3D/H3DDisplayListObject.h:32, from /usr/local/include/H3D/X3DAppearanceNode.h:33, from /usr/local/include/H3D/Appearance.h:32, from /usr/local/include/H3D/DefaultAppearance.h:33, from /usr/local/include/H3D/H3DWindowNode.h:35, from MyH3DCanvasWindow.h:4, from H3DGLCanvas.cpp:3: /usr/include/GL/glew.h:8422: error: conflicting declaration ‘typedef void (* PFNGLFRAGMENTLIGHTMODELFVSGIXPROC)(GLenum, GLfloat*)’ /usr/include/GL/glext.h:5570: error: ‘PFNGLFRAGMENTLIGHTMODELFVSGIXPROC’ has a previous declaration as ‘typedef void (* PFNGLFRAGMENTLIGHTMODELFVSGIXPROC)(GLenum, const GLfloat*)’ /usr/include/GL/glew.h:8424: error: conflicting declaration ‘typedef void (* PFNGLFRAGMENTLIGHTMODELIVSGIXPROC)(GLenum, GLint*)’ /usr/include/GL/glext.h:5572: error: ‘PFNGLFRAGMENTLIGHTMODELIVSGIXPROC’ has a previous declaration as ‘typedef void (* PFNGLFRAGMENTLIGHTMODELIVSGIXPROC)(GLenum, const GLint*)’ /usr/include/GL/glew.h:8426: error: conflicting declaration ‘typedef void (* PFNGLFRAGMENTLIGHTFVSGIXPROC)(GLenum, GLenum, GLfloat*)’ /usr/include/GL/glext.h:5566: error: ‘PFNGLFRAGMENTLIGHTFVSGIXPROC’ has a previous declaration as ‘typedef void (* PFNGLFRAGMENTLIGHTFVSGIXPROC)(GLenum, GLenum, const GLfloat*)’ /usr/include/GL/glew.h:8428: error: conflicting declaration ‘typedef void (* PFNGLFRAGMENTLIGHTIVSGIXPROC)(GLenum, GLenum, GLint*)’ /usr/include/GL/glext.h:5568: error: ‘PFNGLFRAGMENTLIGHTIVSGIXPROC’ has a previous declaration as ‘typedef void (* PFNGLFRAGMENTLIGHTIVSGIXPROC)(GLenum, GLenum, const GLint*)’ /usr/include/GL/glew.h:8435: error: conflicting declaration ‘typedef void (* PFNGLGETFRAGMENTMATERIALFVSGIXPROC)(GLenum, GLenum, const GLfloat*)’ /usr/include/GL/glext.h:5579: error: ‘PFNGLGETFRAGMENTMATERIALFVSGIXPROC’ has a previous declaration as ‘typedef void (* PFNGLGETFRAGMENTMATERIALFVSGIXPROC)(GLenum, GLenum, GLfloat*)’ /usr/include/GL/glew.h:8436: error: conflicting declaration ‘typedef void (* PFNGLGETFRAGMENTMATERIALIVSGIXPROC)(GLenum, GLenum, const GLint*)’ /usr/include/GL/glext.h:5580: error: ‘PFNGLGETFRAGMENTMATERIALIVSGIXPROC’ has a previous declaration as ‘typedef void (* PFNGLGETFRAGMENTMATERIALIVSGIXPROC)(GLenum, GLenum, GLint*)’ /usr/include/GL/glew.h:9866: error: ‘PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC’ does not name a type /usr/include/GL/glew.h:9867: error: ‘PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC’ does not name a type H3DGLCanvas.cpp:8: warning: unused parameter ‘attribute_list’ H3DGLCanvas.cpp:17: warning: unused parameter ‘attribute_list’ H3DGLCanvas.cpp:34: warning: unused parameter ‘width’ H3DGLCanvas.cpp:34: warning: unused parameter ‘height’ make: *** [H3DGLCanvas.o] Error 1 sajjad@sajjad:~/Documents/X3D/H3DViewer$
I have sub-classed the QGLWidget which contains the reference to the
another class that is the subclass of the third party class. It may be
clashing with the glew initialization.
The following snippet shows the sub-classed qglwidget
Code:
#ifndef H3DGLCANVAS_H #define H3DGLCANVAS_H #include <QGLWidget> class MyH3DCanvasWindow; class QMainWindow; //this class is similar to the subclass of wxGLCanvas { Q_OBJECT public: H3DGLCanvas(MyH3DCanvasWindow *owner, QGLContext *shared_context, int *attribute_list = 0, H3DGLCanvas(MyH3DCanvasWindow *owner, int *attribute_list = 0, ~H3DGLCanvas(); /*! \sa sets up the opengl rendering context,defines the display list. gets called once before the first time resizeGL() or paintGL() is called. */ void initializeGL(); /*! \sa sets up the opengl viewport,projection. gets called whenever the widgets gets resized. */ void resizeGL(int width, int height); /*! \sa renders the opengl scene . gets called wehnever the widget needs to be updated */ void paintGL(); protected: MyH3DCanvasWindow *m_owner; }; #endif // H3DGLCANVAS_H ............................................................ #include "H3DGLCanvas.h" #include "MyH3DCanvasWindow.h" H3DGLCanvas::H3DGLCanvas(MyH3DCanvasWindow *owner, QGLContext *shared_context, int *attribute_list, m_owner(owner) { } H3DGLCanvas::H3DGLCanvas(MyH3DCanvasWindow *owner, int *attribute_list, m_owner(owner) { } H3DGLCanvas::~H3DGLCanvas() { } void H3DGLCanvas::initializeGL() { } void H3DGLCanvas::resizeGL(int width, int height) { } void H3DGLCanvas::paintGL() { }
And i have another class that is the subclass of the API's class. Here is goes:
Code:
#include "MyH3DCanvasWindow.h" #include <QGLFormat> #include <vector> #include <H3D/Viewpoint.h> #include <H3D/INIFile.h> #include "H3DGLCanvas.h" //first of add the node to the H3DNodeDatabase system H3DNodeDatabase MyH3DCanvasWindow::database("MyH3DCanvasWindow", &(newInstance<MyH3DCanvasWindow>), typeid(MyH3DCanvasWindow), &(H3D::H3DWindowNode::database)); H3D::Inst<SFInt32> _width , H3D::Inst<SFInt32> _height, H3D::Inst<SFBool> _fullScreen , H3D::Inst<SFBool> _mirrored, H3D::Inst<RenderMode> _renderMode, H3D::Inst<SFViewpoint> _viewpoint, H3D::Inst<SFInt32> _posX, H3D::Inst<SFInt32> _posY, H3D::Inst<SFBool> _manualCursorControl, H3D::Inst<SFString> _cursorType) : H3DWindowNode(_width,_height,_fullScreen,_mirrored, _renderMode,_viewpoint,_posX,_posY,_manualCursorControl, _cursorType), m_parent(parent), m_isInitialized(false), m_useH3DSettings(true), m_glCanvas(0) { database.initFields(this); m_haveParent = m_parent != NULL; vector<string> valid_values; getSupportedCursorsTypes(valid_values); cursorType->addValidValues(valid_values.begin(),valid_values.end()); //THE FOLLOWING WILL NOT BE HAPENING HERE WHICH HAS BEEN HANDLED IN wxWidget //SO COMMENT IT OUT!!! // if(!m_parent) // { // m_parent = new QMainWindow(); // } } MyH3DCanvasWindow::~MyH3DCanvasWindow() { } void MyH3DCanvasWindow::swapBuffers() { RenderMode::Mode stereo_mode = renderMode->getRenderMode(); int attributeList[8]; //initialize the opengl format // QGLFormat glformat; attributeList[0] = QGL::Rgba; attributeList[1] = QGL::DoubleBuffer; attributeList[3] = 24; attributeList[5] = 8; if(stereo_mode == RenderMode::QUAD_BUFFERED_STEREO) { attributeList[6] = QGL::StereoBuffers; } attributeList[7] = 0; } void MyH3DCanvasWindow::initWindow() { } void MyH3DCanvasWindow::initWindowHandler() { } void MyH3DCanvasWindow::setFullscreen(bool fullscreen) { } void MyH3DCanvasWindow::makeWindowActive() { } int MyH3DCanvasWindow::setCursorType(const std::string &cursor_type) { } /// Return the cursor type to use for given modes. This should /// be implemented for each subclass to choose appropriate cursors. /// The standard modes are: /// "DEFAULT" - normal mode /// "ON_SENSOR_OVER" - when mouse pointer is over a pointing device /// sensor. /// "ON_SENSOR_ACTIVE" - when a sensor node is active /// "ON_NAV_LOOKAT" - when lookat mode is chosen string MyH3DCanvasWindow::getCursorForMode(const string &) { } void MyH3DCanvasWindow::getSupportedCursorsTypes(vector<string> &types) { }
Any idea to resolve this ?
Thanks
Sajjad