2003-06-11 23:36:48 +00:00
|
|
|
|
// The contents of this file are subject to the BOINC Public License
|
2002-10-14 20:42:01 +00:00
|
|
|
|
// Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
|
// compliance with the License. You may obtain a copy of the License at
|
2003-06-11 23:36:48 +00:00
|
|
|
|
// http://boinc.berkeley.edu/license_1.0.txt
|
2002-10-14 20:42:01 +00:00
|
|
|
|
//
|
|
|
|
|
// Software distributed under the License is distributed on an "AS IS"
|
|
|
|
|
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
|
// License for the specific language governing rights and limitations
|
|
|
|
|
// under the License.
|
|
|
|
|
//
|
|
|
|
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
|
|
|
|
//
|
|
|
|
|
// The Initial Developer of the Original Code is the SETI@home project.
|
|
|
|
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
|
|
|
|
// University of California at Berkeley. All Rights Reserved.
|
|
|
|
|
//
|
|
|
|
|
// Contributor(s):
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
/*
|
2003-06-06 22:08:46 +00:00
|
|
|
|
Contains: Functions to enable build and destory a GL fullscreen context
|
2002-10-14 20:42:01 +00:00
|
|
|
|
|
2003-06-06 22:08:46 +00:00
|
|
|
|
Written by: Geoff Stahl (ggs)
|
2002-10-14 20:42:01 +00:00
|
|
|
|
|
2003-06-06 22:08:46 +00:00
|
|
|
|
Copyright: Copyright <EFBFBD> 1999 Apple Computer, Inc., All Rights Reserved
|
2002-10-14 20:42:01 +00:00
|
|
|
|
|
2003-06-06 22:08:46 +00:00
|
|
|
|
Disclaimer: You may incorporate this sample code into your applications without
|
|
|
|
|
restriction, though the sample code has been provided "AS IS" and the
|
|
|
|
|
responsibility for its operation is 100% yours. However, what you are
|
|
|
|
|
not permitted to do is to redistribute the source as "DSC Sample Code"
|
|
|
|
|
after having made changes. If you're going to re-distribute the source,
|
|
|
|
|
we require that you make it clear in the source that the code was
|
|
|
|
|
descended from Apple Sample Code, but that you've made changes.
|
2002-10-14 20:42:01 +00:00
|
|
|
|
|
|
|
|
|
Adapted to BOINC by Eric Heien
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// include control --------------------------------------------------
|
|
|
|
|
|
|
|
|
|
#ifndef SetupGL_h
|
|
|
|
|
#define SetupGL_h
|
|
|
|
|
|
|
|
|
|
// includes ---------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
#ifdef __APPLE_CC__
|
|
|
|
|
#include <DrawSprocket/DrawSprocket.h>
|
|
|
|
|
#include <AGL/agl.h>
|
|
|
|
|
#else
|
|
|
|
|
#include <DrawSprocket.h>
|
|
|
|
|
#include <agl.h>
|
|
|
|
|
#include <gl.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// structures (public) -----------------------------------------------
|
|
|
|
|
|
|
|
|
|
// structure for creating a fullscreen context
|
|
|
|
|
struct structGLInfo // storage for setup info
|
|
|
|
|
{
|
2003-06-06 22:08:46 +00:00
|
|
|
|
SInt16 width; // input: width of drawable (screen width in full screen mode), return: actual width allocated
|
|
|
|
|
SInt16 height; // input: height of drawable (screen height in full screen mode), return: actual height allocated
|
|
|
|
|
UInt32 pixelDepth; // input: requested pixel depth
|
|
|
|
|
GLint aglAttributes[64]; // input: pixel format attributes always required (reset to what was actually allocated)
|
|
|
|
|
AGLPixelFormat fmt; // input: none; output pixel format...
|
2002-10-14 20:42:01 +00:00
|
|
|
|
};
|
|
|
|
|
typedef struct structGLInfo structGLInfo;
|
|
|
|
|
typedef struct structGLInfo * pstructGLInfo;
|
|
|
|
|
|
|
|
|
|
// structure for creating a context from a window
|
|
|
|
|
struct structGLWindowInfo // storage for setup info
|
|
|
|
|
{
|
2003-06-06 22:08:46 +00:00
|
|
|
|
GLint aglAttributes[64]; // input: pixel format attributes always required (reset to what was actually allocated)
|
|
|
|
|
AGLPixelFormat fmt; // input: none; output pixel format...
|
2003-03-02 00:43:32 +00:00
|
|
|
|
// if so renderer check (accel) will look at all renderers vice just the current one
|
2002-10-14 20:42:01 +00:00
|
|
|
|
// if window is not dragable renderer check will either check the single device or short
|
|
|
|
|
// circuit to software if window spans multiple devices
|
|
|
|
|
};
|
|
|
|
|
typedef struct structGLWindowInfo structGLWindowInfo;
|
|
|
|
|
typedef struct structGLWindowInfo * pstructGLWindowInfo;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// public function declarations -------------------------------------
|
|
|
|
|
// Destroys drawable and context
|
|
|
|
|
// Ouputs: *paglDraw, *paglContext and *pdspContext should be 0 on exit
|
|
|
|
|
|
2003-03-02 00:43:32 +00:00
|
|
|
|
OSStatus BuildGLonWindow (WindowPtr pWindow, AGLContext* paglContext, pstructGLWindowInfo pcontextInfo);
|
2002-10-14 20:42:01 +00:00
|
|
|
|
|
|
|
|
|
// same as above but destorys a context that was associated with an existing window, window is left intacted
|
|
|
|
|
OSStatus DestroyGLFromWindow (AGLContext* paglContext, pstructGLWindowInfo pcontextInfo);
|
|
|
|
|
|
|
|
|
|
// Special suspend function to ensure the the GL window is hidden
|
|
|
|
|
OSStatus SuspendFullScreenGL (AGLDrawable aglDraw, AGLContext aglContext);
|
|
|
|
|
|
|
|
|
|
// Special resume function to ensure the the GL window is shown
|
|
|
|
|
OSStatus ResumeFullScreenGL (AGLDrawable aglDraw, AGLContext aglContext);
|
|
|
|
|
|
|
|
|
|
short FindGDHandleFromWindow (WindowPtr pWindow, GDHandle * phgdOnThisDevice);
|
|
|
|
|
|
|
|
|
|
GLuint BuildFontGL (AGLContext ctx, GLint fontID, Style face, GLint size);
|
|
|
|
|
|
2002-10-29 18:51:45 +00:00
|
|
|
|
void DeleteFontGL (GLuint fontList);
|
2002-10-14 20:42:01 +00:00
|
|
|
|
|
|
|
|
|
// Error reporter, can be set to report however the application desires
|
|
|
|
|
void ReportError (char * strError);
|
|
|
|
|
|
|
|
|
|
// Error with numeric code reporter, can be set to report however the application desires
|
|
|
|
|
void ReportErrorNum (char * strError, long numError);
|
|
|
|
|
|
|
|
|
|
// Handle reporting of DSp errors, error code is passed through
|
|
|
|
|
OSStatus DSpReportError (OSStatus error);
|
|
|
|
|
|
|
|
|
|
// Handle reporting of agl errors, error code is passed through
|
|
|
|
|
OSStatus aglReportError (void);
|
|
|
|
|
|
|
|
|
|
// Handle reporting of OpenGL errors, error code is passed through
|
|
|
|
|
OSStatus glReportError (void);
|
|
|
|
|
|
|
|
|
|
void DoUpdate (AGLContext aglContext);
|
|
|
|
|
|
2003-03-02 00:43:32 +00:00
|
|
|
|
extern WindowRef appGLWindow;
|
|
|
|
|
|
2003-06-05 20:44:41 +00:00
|
|
|
|
|
|
|
|
|
// structures (public) -----------------------------------------------
|
|
|
|
|
|
|
|
|
|
enum { fadeTicks = 10 };
|
|
|
|
|
|
|
|
|
|
// public function declarations -------------------------------------
|
|
|
|
|
|
|
|
|
|
OSStatus StartDSp (void);
|
|
|
|
|
void ShutdownDSp (void);
|
|
|
|
|
|
|
|
|
|
CGrafPtr GetDSpDrawable (DSpContextReference dspContext);
|
|
|
|
|
void DestroyDSpContext (DSpContextReference* pdspContext);
|
|
|
|
|
|
|
|
|
|
OSStatus DSpContext_CustomFadeGammaOut (DSpContextReference inContext, long fadeTicks);
|
|
|
|
|
OSStatus DSpContext_CustomFadeGammaIn (DSpContextReference inContext, long fadeTicks);
|
|
|
|
|
|
|
|
|
|
extern Boolean gDSpStarted;
|
|
|
|
|
|
2002-10-14 20:42:01 +00:00
|
|
|
|
#endif // SetupGL_h
|