nV News Forums

 
 

nV News Forums (http://www.nvnews.net/vbulletin/index.php)
-   NVIDIA Linux (http://www.nvnews.net/vbulletin/forumdisplay.php?f=14)
-   -   I think I found a bug. Small sample includet (requires Qt) (http://www.nvnews.net/vbulletin/showthread.php?t=11347)

axeljaeger 05-06-03 10:32 AM

I think I found a bug. Small sample includet (requires Qt)
 
1 Attachment(s)
Yesterday I played a bit around with the QGLWidget from the Qt Toolkit from Trolltech. This widget allows it to embed an opengl context into a GUI-Application. There is a funktion renderText to render some text into the widget. But this function does not work together with my nVidia-Card. I'm very sure that the problem is in the nvidia-code and not in Trolltech's, because the same programm is working on ATI hardware. Im using Mandrake Linux 9.1 together with the newest nVidia-drivers (that one with installer). I have a Geforce 2 MX 200 with 64 MB SDRAM. I use an Pentium II on a mainboard with Intel chipset.

Here's the source:

Code:

#include <qgl.h>
#include <qapplication.h>

class W : public QGLWidget
{
 public:
  W() : QGLWidget(0,0) {}
  void paintGL();

};

void W::paintGL()
{
 glClearColor(0.0f,0.0f,0.0f,1.0f);
 glClear(GL_COLOR_BUFFER_BIT);
  renderText(0,0, "Kashmere");
}

int main(int argc, char ** argv)
{
 QApplication app(argc, argv);
 W w;
 app.setMainWidget(&w);
 w.show();
 return app.exec();
}


axeljaeger 05-06-03 10:33 AM

1 Attachment(s)
And here is what gdb says:
Code:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 9345)]
0x408cf654 in __nvsym17602 () from /usr/lib/libGL.so.1
Current language:  auto; currently c

And here is my logfile:

bwkaz 05-06-03 11:44 AM

I don't get a segfault with copied-and-pasted code.

I also don't get any text, but I have a feeling this is because you never set up your GL matrices properly (or at all).

Have you looked in the README where it talks about segfaults in GL programs?

axeljaeger 05-06-03 12:53 PM

Now it should work as exspected, but it still crashes. I also can't find any usefull informations about segfaults in the Readme file included with the driver. But programms shouldn't crash when the programmer forgot to set a correct matrix.

Here is the new code:
Code:

#include <qgl.h>
#include <qapplication.h>
#include <GL/glu.h>

class W : public QGLWidget
{
 public:
  W() : QGLWidget(0,0) {}
  void paintGL();
  void resizeGL(int w, int h);
};

void W::resizeGL(int w, int h)
{
 glViewport( 0, 0, w, h );
 glMatrixMode( GL_PROJECTION );
 glLoadIdentity( );
 gluOrtho2D( -w/2, w/2, -h/2, h/2 );
 glMatrixMode( GL_MODELVIEW );
 glLoadIdentity( );
}

void W::paintGL()
{
 glClearColor(0.0f,0.0f,0.0f,1.0f);
 glClear(GL_COLOR_BUFFER_BIT);
 glLoadIdentity();
 renderText(0,0, "Kashmere");
}

int main(int argc, char ** argv)
{
 QApplication app(argc, argv);
 W w;
 app.setMainWidget(&w);
 w.show();
 return app.exec();
}


bwkaz 05-06-03 04:45 PM

I was thinking about the wrong problem when I said that last bit. I was thinking that Qt was calling dlopen() on the GL library -- and the README does cover problems with this -- but that's not the case, I don't think.

In any case, it still doesn't crash for me, and I still don't get text. Maybe my version of renderText wasn't defined in properly? Hmm...

Well, it does work (show up, that is) if I change the renderText call to renderText(0,0,0, "Kashmere"); instead. But since the problem is a segfault, and not "the text isn't showing up", ... hmm. When you're in gdb, after catching the signal, what does bt print?

axeljaeger 05-07-03 09:43 AM

bt says nothing more than
Code:

0x408cf654 in __nvsym17602 () from /usr/lib/libGL.so.1
I think, the Qt Library from Mandrake was compiled without debugging symbols. I thought about to write to Trolltech, but they will not catch a bug in software without having the source. On the other hand, nVidia has the source from Qt. I think it's their task. The text should be shown in the first version, if you resize your window verticaly. I think, the text is not affected by any transformationmatrix, because I think its printed using XFree fontredering. We are also discussing this problem in our german linux developer board at http://www.mrunix.de/forums/showthre...threadid=31896

There is one other people who had the crash with my programm one who get this programm fine working on an ATI card

bwkaz 05-07-03 04:53 PM

Well, I'm not sure what to tell you, other than "it works for me"...

Maybe try single-stepping the code under gdb? That would at least tell you which function call is segfaulting (it may not be happening in renderText). Or, you could compile Qt yourself, with debugging symbols, and install it somewhere obscure (like /opt/qt), then explicitly link against the debug version. That'd allow you to trace into renderText...

axeljaeger 05-08-03 09:27 AM

H, compiling Qt myself will cost me one day (PII 266 Mhz). Isn't there somebody from the nvidia-team who can help?

dahunt 05-09-03 01:14 AM

same here... works fine... had to maximize the window to see it tho.... here's my compile line:

gcc test.cpp -I /usr/lib/qt3/include/ -L /usr/lib/qt3/lib/ -lqt-mt


later

bwkaz 05-09-03 07:52 AM

Oooh, that is a difference. I used -lqt on my link line, but I only have one Qt library installed, the qt-mt one (libqt.so is a symlink to libqt-mt.so), so I ended up using the multithreaded Qt library anyway.

So if you are linking against -lqt, and libqt.so is not a symlink to libqt-mt, then that might be the difference. I don't see why, but it might be. Try -lqt-mt and see if that helps, if this is the case.

axeljaeger 05-09-03 08:43 AM

I use mandrake linux 9.1. MDK 9.1 comes with qt 3 compiled as multi threaded library. I have no single threaded version of qt here


All times are GMT -5. The time now is 05:21 PM.

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.