Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

GlWindowOSX.h

Go to the documentation of this file.
00001 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
00002  *
00003  * VR Juggler is (C) Copyright 1998-2003 by Iowa State University
00004  *
00005  * Original Authors:
00006  *   Allen Bierbaum, Christopher Just,
00007  *   Patrick Hartling, Kevin Meinert,
00008  *   Carolina Cruz-Neira, Albert Baker
00009  *
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Library General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2 of the License, or (at your option) any later version.
00014  *
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Library General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU Library General Public
00021  * License along with this library; if not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00023  * Boston, MA 02111-1307, USA.
00024  *
00025  * -----------------------------------------------------------------
00026  * File:          $RCSfile: GlWindowOSX.h,v $
00027  * Date modified: $Date: 2003/10/12 21:39:23 $
00028  * Version:       $Revision: 1.15 $
00029  * -----------------------------------------------------------------
00030  *
00031  *************** <auto-copyright.pl END do not edit this line> ***************/
00032 
00033 #ifndef _VRJ_GL_WIN_OSX_H_
00034 #define _VRJ_GL_WIN_OSX_H_
00035 
00036 #include <vrj/vrjConfig.h>
00037 #include <vector>
00038 
00039 #include <vrj/Draw/OGL/GlWindow.h>
00040 #include <vrj/Kernel/Kernel.h>
00041 #include <vrj/Util/Debug.h>
00042 #include <vrj/Display/Display.h>
00043 #include <gadget/Devices/EventWindow/EventWindowOSX.h>
00044 
00045 #ifdef __APPLE_CC__
00046 #   include <Carbon/Carbon.h>
00047 #   include <DrawSprocket/DrawSprocket.h>
00048 #   include <AGL/agl.h>
00049 #else
00050 #   include <Carbon.h>
00051 #   include <DrawSprocket.h>
00052 #   include <agl.h>
00053 #endif
00054 
00060 struct structGLWindowInfo {
00061    Boolean fAcceleratedMust;    // input: must renderer be accelerated?
00062    GLint aglAttributes[64];     // input: pixel format attributes always
00063                                 //        required (reset to what was actually
00064                 //        allocated)
00065    long VRAM;           // input: minimum VRAM; output: actual (if
00066                                 //        successful otherwise input)
00067    long textureRAM;     // input: amount of texture RAM required on
00068                                 //        card; output: same (used in
00069                 //        allcoation to ensure enough texture
00070    AGLPixelFormat   fmt;    // input: none; output pixel format...
00071    Boolean fDraggable;      // input: is window going to be dragable,
00072                 //        * if so renderer check (accel, VRAM,
00073                 //          textureRAM) will look at all
00074                 //          renderers vice just the current one
00075                 //        * if window is not dragable renderer
00076                 //          check will either check the single
00077                 //          device or short circuit to software
00078                 //        * if window spans multiple devices
00079                 //          software renderer is consider to
00080                 //          have unlimited VRAM, unlimited
00081                 //          textureRAM and to not be
00082                 //          accelerated
00083 };
00084 
00085 namespace vrj
00086 {
00087 
00092 class GlWindowOSX: public GlWindow, public gadget::EventWindowOSX
00093 {
00094 public:
00095     GlWindowOSX();
00096     virtual ~GlWindowOSX();
00097 
00098     void swapBuffers();
00099     int open();
00100     int close();
00101     bool makeCurrent();
00102 
00107 
00112    bool startSampling();
00114 
00115    void configWindow(Display* _display);
00116 
00117    virtual bool createHardwareSwapGroup(std::vector<GlWindow*> wins);
00118 
00119 protected:
00120     OSStatus BuildGLFromWindow(WindowPtr pWindow, AGLContext* paglContext,
00121                                structGLWindowInfo* pcontextInfo);
00122 
00123     OSStatus BuildGLonWindow(WindowPtr pWindow, AGLContext* paglContext,
00124                              structGLWindowInfo* pcontextInfo);
00125 
00126     OSStatus DestroyGLFromWindow(AGLContext* paglContext,
00127                                  structGLWindowInfo* pcontextInfo);
00128 
00129     short FindGDHandleFromWindow(WindowPtr pWindow, GDHandle* phgdOnThisDevice);
00130 
00131     Boolean CheckRenderer(GDHandle hGD, long *VRAM, long *textureRAM, GLint*,
00132                           Boolean fAccelMust);
00133 
00134     Boolean CheckAllDeviceRenderers(long* pVRAM, long* pTextureRAM,
00135                                     GLint* pDepthSizeSupport,
00136                                     Boolean fAccelMust);
00137 
00138     void ReportError(const char* strError);
00139     GLenum aglReportError(void);
00140 
00141 private:
00142     int                 mPipe;
00143     structGLWindowInfo      glInfo;
00144     AGLContext          aglContext;
00145     Rect            rectWin;
00146 
00147     WindowPtr           gpWindow;
00148     long            gFrameWindow;
00149     AbsoluteTime        gTimeWindow;
00150     float           gRotation;
00151     CFStringRef         window_title;
00152 
00153     static AGLContext       aglShareContext;
00154 };
00155 
00156 }
00157 
00158 #endif

Generated on Sun May 2 15:10:17 2004 for VR Juggler by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002