00001 /* $Id: tr_8h_source.html,v 1.3 2010/02/23 22:10:17 curt Exp $ */ 00002 00003 /* 00004 * $Log: tr_8h_source.html,v $ 00004 * Revision 1.3 2010/02/23 22:10:17 curt 00004 * Another v2.0.0 commit. 00004 * 00005 * Revision 1.4 2008/07/27 16:10:37 ehofman 00006 * 00007 * 00008 * - remove the SG_GLxxxx_H #defines, since OSG provides its own versions 00009 * - this exposed a bizarre issue on Mac where dragging in <AGL/agl.h> in 00010 * extensions.hxx was pulling in all of Carbon to the global namespace 00011 * - very scary. As a result, I now need to explicitly include CoreFoundation 00012 * in fg_init.cxx. 00013 * - change SG_USING_STD(x) to using std::x 00014 * 00015 * Issues: 00016 * 00017 * - the logic for X11 and Win32 in RenderTexture and extensions is tortured, 00018 * please see if you agree I got all the ifdefs correct. 00019 * 00020 * Revision 1.3 2006/02/21 10:47:21 ehofman 00021 * Back out the previous patch. 00022 * 00023 * Revision 1.2 2004/11/18 19:10:34 curt 00024 * Abstract out location of gl.h, glut.h, and glu.h includes so that we can 00025 * make the Mac platform happy since they put these in a different place compared 00026 * to the rest of the world. 00027 * 00028 * Revision 1.1.1.1 2002/09/07 02:58:19 curt 00029 * Initial revsion of Simgear-0.3.0 00030 * 00031 * Revision 1.1 2001/06/26 15:19:39 curt 00032 * Added tr.cxx / tr.h, Brian Paul's LGPL'd tiled rendering support libs for 00033 * rendering ultra high res "tiled" screen shots. 00034 * 00035 * Revision 1.5 1997/07/21 17:34:07 brianp 00036 * added tile borders, incremented version to 1.1 00037 * 00038 * Revision 1.4 1997/07/21 15:47:35 brianp 00039 * renamed all "near" and "far" variables 00040 * 00041 * Revision 1.3 1997/04/26 21:23:25 brianp 00042 * added trRasterPos3f function 00043 * 00044 * Revision 1.2 1997/04/19 23:26:10 brianp 00045 * many API changes 00046 * 00047 * Revision 1.1 1997/04/18 21:53:05 brianp 00048 * Initial revision 00049 * 00050 */ 00051 00052 00053 /* 00054 * Tiled Rendering library 00055 * Version 1.1 00056 * Copyright (C) Brian Paul 00057 * 00058 * 00059 * This library allows one to render arbitrarily large images with OpenGL. 00060 * The basic idea is to break the image into tiles which are rendered one 00061 * at a time. The tiles are assembled together to form the final, large 00062 * image. Tiles and images can be of any size. 00063 * 00064 * Basic usage: 00065 * 00066 * 1. Allocate a tile rendering context: 00067 * TRcontext t = trNew(); 00068 * 00069 * 2. Specify the final image buffer and tile size: 00070 * GLubyte image[W][H][4] 00071 * trImageSize(t, W, H); 00072 * trImageBuffer(t, GL_RGBA, GL_UNSIGNED_BYTE, (GLubyte *) image); 00073 * 00074 * 3. Setup your projection: 00075 * trFrustum(t, left, right, bottom top, near, far); 00076 * or 00077 * trOrtho(t, left, right, bottom top, near, far); 00078 * or 00079 * trPerspective(t, fovy, aspect, near, far); 00080 * 00081 * 4. Render the tiles: 00082 * do { 00083 * trBeginTile(t); 00084 * DrawMyScene(); 00085 * } while (trEndTile(t)); 00086 * 00087 * You provide the DrawMyScene() function which calls glClear() and 00088 * draws all your stuff. 00089 * 00090 * 5. The image array is now complete. Display it, write it to a file, etc. 00091 * 00092 * 6. Delete the tile rendering context when finished: 00093 * trDelete(t); 00094 * 00095 */ 00096 00097 00098 #ifndef TR_H 00099 #define TR_H 00100 00101 #include <simgear/compiler.h> 00102 00103 #include <osg/GL> 00104 00105 00106 //#ifdef __cplusplus 00107 //extern "C" { 00108 //#endif 00109 00110 00111 #define TR_VERSION "1.1" 00112 #define TR_MAJOR_VERSION 1 00113 #define TR_MINOR_VERSION 1 00114 00115 00116 typedef struct _TRctx TRcontext; 00117 00118 00119 typedef enum { 00120 TR_TILE_WIDTH = 100, 00121 TR_TILE_HEIGHT, 00122 TR_TILE_BORDER, 00123 TR_IMAGE_WIDTH, 00124 TR_IMAGE_HEIGHT, 00125 TR_ROWS, 00126 TR_COLUMNS, 00127 TR_CURRENT_ROW, 00128 TR_CURRENT_COLUMN, 00129 TR_CURRENT_TILE_WIDTH, 00130 TR_CURRENT_TILE_HEIGHT, 00131 TR_ROW_ORDER, 00132 TR_TOP_TO_BOTTOM, 00133 TR_BOTTOM_TO_TOP, 00134 TR_LEFT, 00135 TR_RIGHT, 00136 TR_BOTTOM, 00137 TR_TOP, 00138 TR_NEAR, 00139 TR_FAR 00140 } TRenum; 00141 00142 00143 00144 extern TRcontext *trNew(void); 00145 00146 extern void trDelete(TRcontext *tr); 00147 00148 00149 extern void trTileSize(TRcontext *tr, GLint width, GLint height, GLint border); 00150 00151 extern void trTileBuffer(TRcontext *tr, GLenum format, GLenum type, 00152 GLvoid *image); 00153 00154 00155 extern void trImageSize(TRcontext *tr, GLint width, GLint height); 00156 00157 extern void trImageBuffer(TRcontext *tr, GLenum format, GLenum type, 00158 GLvoid *image); 00159 00160 00161 extern void trRowOrder(TRcontext *tr, TRenum order); 00162 00163 00164 extern GLint trGet(TRcontext *tr, TRenum param); 00165 extern GLdouble trGetD(TRcontext *tr, TRenum param); 00166 00167 00168 extern void trOrtho(TRcontext *tr, 00169 GLdouble left, GLdouble right, 00170 GLdouble bottom, GLdouble top, 00171 GLdouble zNear, GLdouble zFar); 00172 00173 extern void trFrustum(TRcontext *tr, 00174 GLdouble left, GLdouble right, 00175 GLdouble bottom, GLdouble top, 00176 GLdouble zNear, GLdouble zFar); 00177 00178 extern void trPerspective(TRcontext *tr, 00179 GLdouble fovy, GLdouble aspect, 00180 GLdouble zNear, GLdouble zFar ); 00181 00182 00183 extern void trBeginTile(TRcontext *tr); 00184 00185 extern int trEndTile(TRcontext *tr); 00186 00187 00188 extern void trRasterPos3f(TRcontext *tr, GLfloat x, GLfloat y, GLfloat z); 00189 00190 00191 00192 //#ifdef __cplusplus 00193 //} 00194 //#endif 00195 00196 00197 #endif