|
|
#1 | |
|
Registered User
|
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();
}
Last edited by axeljaeger; 05-06-03 at 10:51 AM. |
|
|
|
|
|
|
#2 | |
|
Registered User
|
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 Last edited by axeljaeger; 05-06-03 at 10:51 AM. |
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Sep 2002
Posts: 2,262
|
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?
__________________
Registered Linux User #219692 |
|
|
|
|
|
#4 | |
|
Registered User
|
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();
}
|
|
|
|
|
|
|
#5 |
|
Registered User
Join Date: Sep 2002
Posts: 2,262
|
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?
__________________
Registered Linux User #219692 Last edited by bwkaz; 05-06-03 at 04:49 PM. |
|
|
|
|
|
#6 | |
|
Registered User
|
bt says nothing more than
Code:
0x408cf654 in __nvsym17602 () from /usr/lib/libGL.so.1 There is one other people who had the crash with my programm one who get this programm fine working on an ATI card |
|
|
|
|
|
|
#7 |
|
Registered User
Join Date: Sep 2002
Posts: 2,262
|
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...
__________________
Registered Linux User #219692 |
|
|
|
|
|
#8 |
|
Registered User
|
H, compiling Qt myself will cost me one day (PII 266 Mhz). Isn't there somebody from the nvidia-team who can help?
|
|
|
|
|
|
#9 |
|
Registered User
Join Date: May 2003
Posts: 2
|
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 |
|
|
|
|
|
#10 |
|
Registered User
Join Date: Sep 2002
Posts: 2,262
|
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.
__________________
Registered Linux User #219692 |
|
|
|
|
|
#11 |
|
Registered User
|
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
|
|
|
|
![]() |
| Thread Tools | |
|
|