From: Gregory P. <gre...@us...> - 2002-09-08 06:20:22
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory usw-pr-cvs1:/tmp/cvs-serv6403 Added Files: RenderingContext.cpp Log Message: RenderingContext - OpenGL context --- NEW FILE: RenderingContext.cpp --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/RenderingContext.cpp /* * RenderingContext.cpp * lwjgl * * Created by Gregory Pierce on Wed Sep 04 2002. * Copyright (c) 2002 __MyCompanyName__. All rights reserved. * */ #include "RenderingContext.h" RenderingContext::RenderingContext() { } RenderingContext::~RenderingContext() { } /* ** OpenGL Setup */ //GetWindowPort(win) bool RenderingContext::setupAGL( AGLDrawable pAGLDrawable ) { AGLPixelFormat fmt; GLboolean ok; GLint attrib[] = { AGL_RGBA, AGL_NONE }; /* Choose an rgb pixel format */ fmt = aglChoosePixelFormat(NULL, 0, attrib); if(fmt == NULL) { return false; } /* Create an AGL context */ aglContext = aglCreateContext(fmt, NULL); if(aglContext == NULL) { return false; } /* Attach the window to the context */ ok = aglSetDrawable(aglContext, pAGLDrawable ); if(!ok) { return false; } /* Make the context the current context */ ok = aglSetCurrentContext(aglContext); if(!ok) { return false; } /* Pixel format is no longer needed */ aglDestroyPixelFormat(fmt); return true; } void RenderingContext::destroy(void) { cleanupAGL(); // cleanup the window // DisposeWindow( windowPtr ); } /* ** OpenGL Cleanup */ void RenderingContext::cleanupAGL() { aglSetCurrentContext(NULL); aglSetDrawable(aglContext, NULL); aglDestroyContext(aglContext); } |