View Single Post
Old 05-06-03, 12:53 PM   #4
axeljaeger
Registered User
 
Join Date: May 2003
Location: Frankfurt/Germany
Posts: 8
Send a message via ICQ to axeljaeger
Default

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();
}
axeljaeger is offline   Reply With Quote