When you declare a variable as static like this, it only gets initialized
the once (at compilation, conceptually). It looks like (from the snippet
alone) that once your bool became false, it never gets set to true. Your
solution is OK, you could also have separated the definition and
initialization of the bool.
Bruce
On 12/30/04 9:37 AM, "Howard Shere" <email@hidden> wrote:
>
> OK. Some progress and some results and a fix.
>
> I used sample (as Chris Hanson suggested) while ssh'd into my machine
> when it was in its frozen state and that got me a stack trace so I
> could see what the app was doing.
>
> The app has a number of threads and the sound threads were still in
> operation so things were not entirely frozen, just the screen.
>
> Using that I dug into the code and removed sections of rendering code
> until the crash stopped happenning. Then I put things back until I
> found the bit of code which was causing the problem.
>
> At first I thought I was a vertex program or something like that (as it
> was in some custom shader code in the app) but that is not what it
> turned out to be.
>
> The culprit is this block of safe looking (psuedo) code here:
>
> static bool usingTextureMatrixIdentity = true;
>
> if (animatingTextureCoords) {
> glMatrixMode(GL_TEXTURE);
> glLoadIdentity();
> loop for each thing that modifies the texture matrix {
> some code here which modified the texture matrix
> }
> glMatrixMode(GL_MODELVIEW);
> usingTextureMatrixIdentity = false;
> } else {
> if (usingTextureMatrixIdentity == false) {
> glMatrixMode(GL_TEXTURE);
> glLoadIdentity();
> glMatrixMode(GL_MODELVIEW);
> }
> }
>
> This code gets called for each object being drawn each frame. I have no
> idea why this would cause a crash, but it was. The fixed code has just
> one new line:
>
> static bool usingTextureMatrixIdentity = true;
>
> if (animatingTextureCoords) {
> glMatrixMode(GL_TEXTURE);
> glLoadIdentity();
> loop for each thing that modifies the texture matrix {
> some code here which modified the texture matrix
> }
> usingTextureMatrixIdentity = false;
> glMatrixMode(GL_MODELVIEW);
> } else {
> if (usingTextureMatrixIdentity == false) {
> glMatrixMode(GL_TEXTURE);
> glLoadIdentity();
> usingTextureMatrixIdentity = true; // HMS - keep this code for
> crashing the machine
> glMatrixMode(GL_MODELVIEW);
> }
> }
>
> I can't explain why this was causing the crash, but it was and it is
> fixed now. On to more coding...
>
> bug report filed. 3935936
>
> Howard Shere
> http://blogs.greendragon.com/index.php/gdc
> Altair 8800a to Mac OS X so far...
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Mac-opengl mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/mac-opengl/email@hidden
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden
This email sent to email@hidden