AGL Ref examples, or 'ifreeze' (last obvious query ;) )

Moderator
Posts: 700
Joined: 2002.04
Post: #1
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...?

Mark Bishop
--
Student and freelance OS X & iOS developer
Quote this message in a reply
CMagicPoker
Unregistered
 
Post: #2
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.
Quote this message in a reply
Moderator
Posts: 700
Joined: 2002.04
Post: #3
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>'.

Mark Bishop
--
Student and freelance OS X & iOS developer
Quote this message in a reply
CMagicPoker
Unregistered
 
Post: #4
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 :-)
Quote this message in a reply
Moderator
Posts: 700
Joined: 2002.04
Post: #5
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;
}

Mark Bishop
--
Student and freelance OS X & iOS developer
Quote this message in a reply
CMagicPoker
Unregistered
 
Post: #6
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?
Quote this message in a reply
Moderator
Posts: 700
Joined: 2002.04
Post: #7
[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

Mark Bishop
--
Student and freelance OS X & iOS developer
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  query on Level Designing mchowdhury1983 1 2,942 Nov 20, 2011 12:08 PM
Last Post: sealfin
  Core Audio SDK Code Examples SparkyNZ 4 10,817 Jun 9, 2011 02:34 AM
Last Post: SparkyNZ
  Occlusion query code failing on ATI 9600 TomorrowPlusX 4 5,555 Mar 10, 2007 08:52 AM
Last Post: arekkusu
  Occlusion query failing for fogged occluders TomorrowPlusX 12 6,591 Jan 8, 2006 05:03 PM
Last Post: arekkusu
  Query regarding number of polys, and tools Lucis-Gladius 2 3,007 Aug 17, 2004 02:22 PM
Last Post: Lucis-Gladius