[Qt-interest] paintGL and qDebug()

Richard S. Wright Jr. rwright at starstonesoftware.com
Sun Sep 12 18:13:39 CEST 2010


Your using a 3x3 matrix for both a rotation and a translation. Use M3DMatrix44f instead. The M3DMatrix33f is only 9 elements long and you are writing past the end of the array.

Richard

On Sep 12, 2010, at 10:20 AM, Sajjad wrote:

> Hello forum,
> 
> 
> I am having a  strage behavior using the QGLWidget . In the paintGL() i have the following code snippet:
> 
> 
> ****************************************************************************************************
>     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
> 
>     M3DMatrix33f  transformationMatrix;
> 
>     qDebug() << "So far fine here";
> 
>     //build the rotation matrix
>     m3dRotationMatrix44(transformationMatrix,m3dDegToRad(yRot),0.0f,1.0f,0.0f);
> 
>     transformationMatrix[12] = 0.0f;
>     transformationMatrix[13] = 0.0f;
>     transformationMatrix[14] = -2.5f;
> 
>     drawTorus(transformationMatrix);
> 
> 
> 
> ****************************************************************************************************
> 
> 
> It runs fine and show the torus in the wired frame mode. But it crashes if i comment the above qDebug() line.
> 
> 
> Any idea why it is happening?
> 
> 
> Regards
> Sajjad
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest





More information about the Qt-interest-old mailing list