View Full Version : AGL Ref examples, or 'ifreeze' (last obvious query ;) )
sealfin
2002.05.27, 06: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...?
CMagicPoker
2002.05.27, 11: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.
sealfin
2002.05.28, 04: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>'.
CMagicPoker
2002.05.28, 04: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 :-)
sealfin
2002.05.28, 05: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 :
#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;
}
CMagicPoker
2002.05.28, 05: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?
sealfin
2002.05.28, 02:42 PM
uh, I forgot to 'DisposeWindow(win);'...
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... ;)
CMagicPoker, a pre-emptive 'get well soon' card is in the mail... ;)
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.