00001 /* 00002 * gsub_lite.h 00003 * 00004 * Graphics Subroutines (Lite) for ARToolKit. 00005 * 00006 * Copyright (c) 2003-2007 Philip Lamb (PRL) phil@eden.net.nz. All rights reserved. 00007 * 00008 * Rev Date Who Changes 00009 * 2.7.0 2003-08-13 PRL Complete rewrite to ARToolKit-2.65 gsub.c API. 00010 * 2.7.1 2004-03-03 PRL Avoid defining BOOL if already defined 00011 * 2.7.1 2004-03-03 PRL Don't enable lighting if it was not enabled. 00012 * 2.7.2 2004-04-27 PRL Added headerdoc markup. See http://developer.apple.com/darwin/projects/headerdoc/ 00013 * 2.7.3 2004-07-02 PRL Much more object-orientated through use of ARGL_CONTEXT_SETTINGS type. 00014 * 2.7.4 2004-07-14 PRL Added gluCheckExtension hack for GLU versions pre-1.3. 00015 * 2.7.5 2004-07-15 PRL Added arglDispImageStateful(); removed extraneous glPixelStorei(GL_UNPACK_IMAGE_HEIGHT,...) calls. 00016 * 2.7.6 2005-02-18 PRL Go back to using int rather than BOOL, to avoid conflict with Objective-C. 00017 * 2.7.7 2005-07-26 PRL Added cleanup routines for texture stuff. 00018 * 2.7.8 2005-07-29 PRL Added distortion compensation enabling/disabling. 00019 * 2.7.9 2005-08-15 PRL Added complete support for runtime selection of pixel format and rectangle/power-of-2 textures. 00020 * 2.8.0 2006-04-04 PRL Move pixel format constants into toolkit global namespace (in config.h). 00021 * 2.8.1 2006-04-06 PRL Move arglDrawMode, arglTexmapMode, arglTexRectangle out of global variables. 00022 * 2.8.2 2006-06-12 PRL More stringent runtime GL caps checking. Fix zoom for DRAWPIXELS mode. 00023 * 00024 */ 00025 /* 00026 * 00027 * This file is part of ARToolKit. 00028 * 00029 * ARToolKit is free software; you can redistribute it and/or modify 00030 * it under the terms of the GNU General Public License as published by 00031 * the Free Software Foundation; either version 2 of the License, or 00032 * (at your option) any later version. 00033 * 00034 * ARToolKit is distributed in the hope that it will be useful, 00035 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00036 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00037 * GNU General Public License for more details. 00038 * 00039 * You should have received a copy of the GNU General Public License 00040 * along with ARToolKit; if not, write to the Free Software 00041 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00042 * 00043 */ 00044 00116 #ifndef __gsub_lite_h__ 00117 #define __gsub_lite_h__ 00118 00119 #ifdef __cplusplus 00120 extern "C" { 00121 #endif 00122 00123 // ============================================================================ 00124 // Public includes. 00125 // ============================================================================ 00126 00127 #ifdef __APPLE__ 00128 # include <OpenGL/gl.h> 00129 #else 00130 # ifdef _WIN32 00131 # include <windows.h> 00132 # endif 00133 # include <GL/gl.h> 00134 #endif 00135 #include <AR/config.h> 00136 #include <AR/ar.h> // ARUint8, AR_PIXEL_FORMAT, arDebug, arImage. 00137 #include <AR/param.h> // ARParam, arParamDecompMat(), arParamObserv2Ideal() 00138 00139 // ============================================================================ 00140 // Public types and definitions. 00141 // ============================================================================ 00142 00143 // Keep code nicely typed. 00144 #ifndef TRUE 00145 # define TRUE 1 00146 #endif 00147 #ifndef FALSE 00148 # define FALSE 0 00149 #endif 00150 00174 typedef struct _ARGL_CONTEXT_SETTINGS *ARGL_CONTEXT_SETTINGS_REF; 00175 00176 // ============================================================================ 00177 // Public globals. 00178 // ============================================================================ 00179 00180 #if defined(__APPLE__) 00181 extern int arglAppleClientStorage; 00182 extern int arglAppleTextureRange; 00183 #endif // __APPLE__ 00184 00185 // ============================================================================ 00186 // Public functions. 00187 // ============================================================================ 00188 00210 ARGL_CONTEXT_SETTINGS_REF arglSetupForCurrentContext(void); 00211 00225 void arglCleanup(ARGL_CONTEXT_SETTINGS_REF contextSettings); 00226 00258 void arglCameraFrustum(const ARParam *cparam, const double focalmin, const double focalmax, GLdouble m_projection[16]); 00259 00267 void arglCameraFrustumRH(const ARParam *cparam, const double focalmin, const double focalmax, GLdouble m_projection[16]); 00268 00288 void arglCameraView(const double para[3][4], GLdouble m_modelview[16], const double scale); 00289 00297 void arglCameraViewRH(const double para[3][4], GLdouble m_modelview[16], const double scale); 00298 00350 void arglDispImage(ARUint8 *image, const ARParam *cparam, const double zoom, ARGL_CONTEXT_SETTINGS_REF contextSettings); 00351 00372 void arglDispImageStateful(ARUint8 *image, const ARParam *cparam, const double zoom, ARGL_CONTEXT_SETTINGS_REF contextSettings); 00373 00393 int arglDistortionCompensationSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, int enable); 00394 00409 int arglDistortionCompensationGet(ARGL_CONTEXT_SETTINGS_REF contextSettings, int *enable); 00410 00430 int arglPixelFormatSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, AR_PIXEL_FORMAT format); 00431 00446 int arglPixelFormatGet(ARGL_CONTEXT_SETTINGS_REF contextSettings, AR_PIXEL_FORMAT *format, int *size); 00447 00467 void arglDrawModeSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, const int mode); 00468 00478 int arglDrawModeGet(ARGL_CONTEXT_SETTINGS_REF contextSettings); 00479 00498 void arglTexmapModeSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, const int mode); 00499 00508 int arglTexmapModeGet(ARGL_CONTEXT_SETTINGS_REF contextSettings); 00509 00525 void arglTexRectangleSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, const int state); 00526 00535 int arglTexRectangleGet(ARGL_CONTEXT_SETTINGS_REF contextSettings); 00536 00537 #ifdef __cplusplus 00538 } 00539 #endif 00540 00545 #endif /* !__gsub_lite_h__ */