August 11, 2011

Vijaeendra Vijaeendra
Lab Rat
63 posts

[solved] OpenGL Examples in Qt on Solaris not running.

 

I m working on OpenSolaris. I have installed qt and building applications which runs fine. But even the basic examples of OpenGL are not running(But getting compiled fine) What might have gone wrong??

The error message says (Segmentation Fault(Core Dumped))

Edit : marked as solved by Eddy

11 replies

August 16, 2011

Vijaeendra Vijaeendra
Lab Rat
63 posts

What are requirements/libraries that I should have in my system (Solaris) to run OpenGL applications?

Not jus the Qt/openGL applications but the FreeGult and other applications.

Please help Me ..

Awaiting Your reply!!

August 16, 2011

mlong mlong
Robot Herder
1551 posts

You’re really asking two separate questions, I think. If your code compiles and links without errors, then chances are the libraries and things you need are there.

Can you post a very small compilable sample of some OpenGL code that is crashing? That might help determine whether it’s a library issue or an implementation issue.

 Signature 

Senior Software Engineer
AccuWeather Enterprise Solutions
/* My views and opinions do not necessarily reflect those of my employer.  Void where prohibited. */

August 17, 2011

Vijaeendra Vijaeendra
Lab Rat
63 posts

I think its more of implementation issue. the code that i tried is as follows…

  1. #include <QtOpenGL/qgl.h>
  2. #include <QtCore/qvector.h>
  3. #include <QtGui/qmatrix4x4.h>
  4. #include <QtGui/qvector3d.h>
  5. #include <QtGui/qvector2d.h>
  6. #include <QApplication>
  7.  
  8. #include "mainwindow.h"
  9.  
  10. int main(int argc, char *argv[])
  11. {
  12.     QApplication a(argc, argv);
  13.     OGLPort w;
  14.     w.resize(640,480);
  15.     w.show();
  16.     return a.exec();
  17. }

  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. #include <QPushButton>
  5. #include <QGridLayout>
  6. #include <QtOpenGL>
  7. #include <QDialog>
  8.  
  9. class OGLPort : public QGLWidget
  10. {
  11.     Q_OBJECT
  12.  
  13. public:
  14.      OGLPort(QWidget *parent = 0);
  15.  
  16. protected:
  17.      void paintGL();
  18.      void resizeGL(int w,int h);
  19.      void timerEvent(QTimerEvent *);
  20.  
  21. private:
  22.      QPushButton *button;
  23.      QGLFramebufferObject *render_fbo;
  24.      QGLFramebufferObject *texture_fbo;
  25. };
  26.  
  27. #endif // MAINWINDOW_H

  1. #include "mainwindow.h"
  2. #include <GL/glut.h>
  3.  
  4. OGLPort::OGLPort(QWidget *parent) :
  5.     QGLWidget(parent)
  6. {
  7.     setWindowTitle("My OpenGL Trial");
  8. }
  9.  
  10. void OGLPort::paintGL()
  11. {
  12.     glColor3f (1.0, 1.0, 1.0);
  13.     glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
  14.  
  15.     glBegin(GL_POLYGON);
  16.     {
  17.         glVertex3f (0.25, 0.25, 0.0);
  18.         glVertex3f (0.75, 0.25, 0.0);
  19.         glVertex3f (0.75, 0.75, 0.0);
  20.         glVertex3f (0.25, 0.75, 0.0);
  21.     }
  22.     glEnd();
  23. }
  24.  
  25. void OGLPort::resizeGL(int w, int h)
  26. {
  27.     int side = qMin(w, h);
  28.     glViewport(((w - side)/2), ((h -side)/2), side, side);
  29. }
  30.  
  31. void OGLPort::timerEvent(QTimerEvent *)
  32. {
  33.     update();
  34. }

August 17, 2011

Vijaeendra Vijaeendra
Lab Rat
63 posts

But why is it that the Qt-OpenGL examples not running.., though its compiling fine??

August 17, 2011

VitorAMJ VitorAMJ
Lab Rat
89 posts

Hello Again Vijaeendra,

As you know I might not be the best person to answer that to you. I am only answering this, because I was waiting for the other guys with Unix knowledge to answer.

First and of Ultimate Importance:
Please provide us the Video Card you are using and also the driver version.
Maybe the thing is that your card really does not support these features.
Man, in openGL one thing is always true, keep everything current, really :-) , this is important.

Last: Libs and libs
Another thing, some OS provided OpenGL lib versions are really old (like 1.1). OpenGL itself, as I told you, is really moving forward fast. Also, several board manufacturers use extensions that are registered with the name _EXT (functions, defines, etc.). Sometimes these features, such as Framebuffer Object, Geometry Shader, Mesh refinement, OpenGL 3.0, OpenGL 4.0 (yeah, crazy huh?), etc. are only available through these special packages. That is, programming with new features (openGL 3 and 4) sometimes might require these these special libs.

pBuffer itself is really old (Approved by ARB on December 7, 2004.), however, you are using a system that is not directed to Graphics. Thus, I believe your openGL version is indeed old (old defines, old functions, etc.). Try to use glew, The OpenGL Extension Wrangler Library [glew.sourceforge.net] . It overwrite old stuff with new stuff. There is Also something called GLEE, but I never used it.

You can download the source code and compile it to your system. Take a good look at the documentation, but some advises:
-Include glew header before any opengl include
-in the initializeGL the first thing you must call is glewInit()

  1.  //Starting GLEW
  2.  GLenum err = glewInit();
  3.  if (GLEW_OK != err)
  4.   Q_ASSERT(true);

If your problem is not old hardware and drivers, this might solve your problem.

Otherwise… time to go shopping :-) . I will explain you why: old video cards were only prepared to use a fixed pipeline, newer cards now use a programmable pipe line with shaders and stuff, if your card is old, you will never be able to do the actual heavy metal stuff available with OpenGL.

Use newer cards such as NVidia GeForce 6 and up, for ATI I don’t remember the first one to use programmable pipeline, but you can use any of the HD series.

Regards,

August 18, 2011

Vijaeendra Vijaeendra
Lab Rat
63 posts

I totally appreciate your help VitorAMJ !!

Well, I dont have a separate video card as such. Its Intel® 4 Series Interface Chip and driver version (6.14.10.5082) on windows…. But solaris i m running on VirtualBox. I m not sure how to get the Graphic info on solaris.

But what is baffling me is that if its a Graphic card issue, why is it that the applications are running fine on Ubuntu(On VirualBox) and Windows( On the same system)

I also learnt that there is no OpenGL support on Solaris/x86 systems.., but its there only for Solaris/Sparc systems… But yes, there is 3rd party support like Mesa3D , Xi etc. have to try with that…

http://www.sunshack.org/data/sh/2.1.2/infoserver.central/data/syshbk/collections/intinfodoc/22171.html

August 18, 2011

VitorAMJ VitorAMJ
Lab Rat
89 posts

Because there is no problem with the program, it is even telling you that it cannot do anything with the tools it has.

There are ways for the OpenGL backend to know when a call leads to unavailable driver/hardware features. For instance, there is the very basic glGetError, and even the glew library I just mentioned comes with two executable files that show you the tricks your board support, its called glewinfo or something,…they generate a txt that you can read to understand your hardware/driver limitations.

In your program you declare QGLFramebufferObject, which is a somewhat new feature (fast backstage screen processsing), it somewhat replaces pBuffer with restrictions of size and context change modifications.

However, you are saying that these programs run on Ubuntu and Windows using VirtualBox (from Solaris, right?). I am no VirtualBox user, but this adds complications, since we don’t know which driver each OS is using (software emulation/direct driver access). But since Solaris is the base OS, it is certainly using its own, possibly faulty/old, driver.

Anyway, from your info, your board seems to support the things you do (with good drivers), and it leads me to think that you have a driver problem on Solaris only. I have seen from Intel, that OpenSolaris/Solaris is not in the list of supported OSs. You have to obtain the driver version used by your Solaris and almost for sure download and install a better one. Unfortunately, I am less than a newbie to help you on that :-(

Vijaeendra wrote:
I also learnt that there is no OpenGL support on Solaris/x86 systems.., but its there only for Solaris/Sparc systems… But yes, there is 3rd party support like Mesa3D , Xi etc. have to try with that…

Not optimistic about mesa3D, but remember to test that with and without glew. And also glew alone with Qt.

Regards,

August 18, 2011

VitorAMJ VitorAMJ
Lab Rat
89 posts

Do the things we have been discussing. If those do not work, I’ve been thinking:
Download or compile glew for your Solaris
Download or compile glew for your Ubuntu
Download or compile glew for your Windows

Using the glew info, compare if there are differences between the supported driver features such as the framebuffer_object for each of your systems. Run them natively (not on Virtualbox). After this test, run all of them from Virtualbox (including Solaris from another OS). This way you will get a clearer picture of your systems and limitations with and without the Virtualbox

Finally, but again I am not that optimistic:
If you are lucky, your Solaris, when run from other OS inside the Virtualbox, might use the driver of Windows/Ubuntu to access the Graphics Card instead of its own. If that works, it might be a workaround for you.

Regards,
VitorAMJ

August 26, 2011

Vijaeendra Vijaeendra
Lab Rat
63 posts

Mesa 3D worked…, and That was all it needed… Sorry had fixed it long back :P

Thanks for all the help VitorAMJ

August 26, 2011

Eddy Eddy
Area 51 Engineer
1609 posts

Vijaendra,

Please mark your topic as solved the next time! so we can avoid putting efforts that are no longer needed.

Sharing your solution with the community is well appreciated also. ;)

 Signature 

Moderator
Qt Certified Specialist
Nokia Qt Ambassador

August 26, 2011

Vijaeendra Vijaeendra
Lab Rat
63 posts

I have alreday shared the solution Eddy.., :-)

 
  ‹‹ [SOLVED] currentIndex() in QTreeView      using Webcam ››

You must log in to post a reply. Not a member yet? Register here!