iDevGames Forums
AGL Ref examples, or 'ifreeze' (last obvious query ;) ) - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: AGL Ref examples, or 'ifreeze' (last obvious query ;) ) (/thread-7736.html)



AGL Ref examples, or 'ifreeze' (last obvious query ;) ) - sealfin - May 27, 2002 03:05 PM

as ever, I've got a query which will be really obvious by this time tommorrow. but, til then...

I can't seem to get the examples, such as the first (p. 7-8), in the AGL reference pdf to quit gracefully; as soon as they reach 'return 0;' they lock up, and with them everything else. probably I need to dispose or similar of something, somewhere, but...?


AGL Ref examples, or 'ifreeze' (last obvious query ;) ) - CMagicPoker - May 27, 2002 08:43 PM

AGL 1.2?

When I quit, I always do that:

<code>
aglSetCurrentContext(nil);
aglSetDrawable(ctx, nil);
aglDestroyContext(ctx);
</code>


I don't know if it does that automatically. It's an habit Ive got.


AGL Ref examples, or 'ifreeze' (last obvious query ;) ) - sealfin - May 28, 2002 01:09 AM

yep, AGL 1.2 tried your code, hasn't made any noticable difference. shall I post the source-code or the .make file? the only change I've made to the source-code is to replace '#include <MacWindows.h>' with '#include <Carbon.h>'.


AGL Ref examples, or 'ifreeze' (last obvious query ;) ) - CMagicPoker - May 28, 2002 01:33 AM

I don't know for the .make file, but the source code, yeah, would be useful.

Just a tought I got.
Did you make your stack at least 256kb?
On OSX I think it'd done automatically, but just to be sure.

Do you have MacsBug installed? What does it says when the holy thing freezes?

I dont know Carbon well, does it ask some special housekeepign when the program finish?

Why im still not in my bed, right now?
Why why?

Eh, ps: theres a cool fotosho contest at Fark.com , cool yeah :-)


AGL Ref examples, or 'ifreeze' (last obvious query ;) ) - sealfin - May 28, 2002 02:06 AM

the source-code, courtesy of the AGL Ref 1.2 pdf, plus a one-line fix to make it Carbon minus your suggested fix :

Code:
#include <Carbon.h>
#include <agl.h>
#include <gl.h>
#include <glu.h>


int main(void)
{
    unsigned long temp;
    Rect rect;
    WindowPtr win;
    GLint attrib[] = { AGL_RGBA, AGL_NONE };
    AGLPixelFormat fmt;
    AGLContext ctx;


        /* Initialize Mac OS */
    InitCursor();
        /* Create a window */
    SetRect(&rect, 50, 50, 450, 450);
    win = NewCWindow (0L, &rect, "\pAGL intro", true,
    plainDBox, (WindowPtr) -1L, true, 0L);
    SetPortWindowPort(win);
        /* Choose pixel format */
    fmt = aglChoosePixelFormat(NULL, 0, attrib);
        /* Create an AGL context */
    ctx = aglCreateContext(fmt, NULL);
        /* Attach the context to the window */
    aglSetDrawable(ctx, GetWindowPort (win));
    aglSetCurrentContext(ctx);
        /* Clear buffer */
        // nice hue ;)
    glClearColor(0.43, 0.47, 0.65, 1.0);
    glClear(GL_COLOR_BUFFER_BIT);
    glFinish();
    Delay (60, &temp);
    return 0;
}



AGL Ref examples, or 'ifreeze' (last obvious query ;) ) - CMagicPoker - May 28, 2002 02:46 AM

Damn to me, I dont find time for exercise, I will need to find some time for illness :-(


Well, try your code, but without any of the gl code.
If not using OpenGL at all still get you the freeze, that would mean the problem is not in OpenGL.

Do you run it in OSEX or CLASSIC the taste we prefer?


AGL Ref examples, or 'ifreeze' (last obvious query ;) ) - sealfin - May 28, 2002 11:42 AM

[embarassed] uh, I forgot to 'DisposeWindow(win);'... [/embarassed]

Quote:as ever, I've got a query which will be really obvious by this time tommorrow. but, til then...
ah, the joys of pre-cognitive powers... Wink

CMagicPoker, a pre-emptive 'get well soon' card is in the mail... Wink