]> git.mxchange.org Git - simgear.git/blob - simgear/screen/tr.h
- remove the SG_GLxxxx_H #defines, since OSG provides its own versions
[simgear.git] / simgear / screen / tr.h
1 /* $Id$ */
2
3 /*
4  * $Log$
5  * Revision 1.4  2008/07/27 16:10:37  ehofman
6  *
7  *
8  *  - remove the SG_GLxxxx_H #defines, since OSG provides its own versions
9  *  - this exposed a bizarre issue on Mac where dragging in <AGL/agl.h> in
10  *    extensions.hxx was pulling in all of Carbon to the global namespace
11  *    - very scary. As a result, I now need to explicitly include CoreFoundation
12  *    in fg_init.cxx.
13  *  - change SG_USING_STD(x) to using std::x
14  *
15  * Issues:
16  *
17  *  - the logic for X11 and Win32 in RenderTexture and extensions is tortured,
18  *    please see if you agree I got all the ifdefs correct.
19  *
20  * Revision 1.3  2006/02/21 10:47:21  ehofman
21  * Back out the previous patch.
22  *
23  * Revision 1.2  2004/11/18 19:10:34  curt
24  * Abstract out location of gl.h, glut.h, and glu.h includes so that we can
25  * make the Mac platform happy since they put these in a different place compared
26  * to the rest of the world.
27  *
28  * Revision 1.1.1.1  2002/09/07 02:58:19  curt
29  * Initial revsion of Simgear-0.3.0
30  *
31  * Revision 1.1  2001/06/26 15:19:39  curt
32  * Added tr.cxx / tr.h, Brian Paul's LGPL'd tiled rendering support libs for
33  * rendering ultra high res "tiled" screen shots.
34  *
35  * Revision 1.5  1997/07/21  17:34:07  brianp
36  * added tile borders, incremented version to 1.1
37  *
38  * Revision 1.4  1997/07/21  15:47:35  brianp
39  * renamed all "near" and "far" variables
40  *
41  * Revision 1.3  1997/04/26  21:23:25  brianp
42  * added trRasterPos3f function
43  *
44  * Revision 1.2  1997/04/19  23:26:10  brianp
45  * many API changes
46  *
47  * Revision 1.1  1997/04/18  21:53:05  brianp
48  * Initial revision
49  *
50  */
51
52
53 /*
54  * Tiled Rendering library
55  * Version 1.1
56  * Copyright (C) Brian Paul
57  *
58  *
59  * This library allows one to render arbitrarily large images with OpenGL.
60  * The basic idea is to break the image into tiles which are rendered one
61  * at a time.  The tiles are assembled together to form the final, large
62  * image.  Tiles and images can be of any size.
63  *
64  * Basic usage:
65  *
66  * 1. Allocate a tile rendering context:
67  *       TRcontext t = trNew();
68  *
69  * 2. Specify the final image buffer and tile size:
70  *       GLubyte image[W][H][4]
71  *       trImageSize(t, W, H);
72  *       trImageBuffer(t, GL_RGBA, GL_UNSIGNED_BYTE, (GLubyte *) image);
73  *
74  * 3. Setup your projection:
75  *       trFrustum(t, left, right, bottom top, near, far);
76  *    or
77  *       trOrtho(t, left, right, bottom top, near, far);
78  *    or
79  *       trPerspective(t, fovy, aspect, near, far);
80  *
81  * 4. Render the tiles:
82  *       do {
83  *           trBeginTile(t);
84  *           DrawMyScene();
85  *       } while (trEndTile(t));
86  *
87  *    You provide the DrawMyScene() function which calls glClear() and
88  *    draws all your stuff.
89  *
90  * 5. The image array is now complete.  Display it, write it to a file, etc.
91  *
92  * 6. Delete the tile rendering context when finished:
93  *       trDelete(t);
94  *
95  */
96
97
98 #ifndef TR_H
99 #define TR_H
100
101 #include <simgear/compiler.h>
102
103 #include <osg/GL>
104
105
106 //#ifdef __cplusplus
107 //extern "C" {
108 //#endif
109
110
111 #define TR_VERSION "1.1"
112 #define TR_MAJOR_VERSION 1
113 #define TR_MINOR_VERSION 1
114
115
116 typedef struct _TRctx TRcontext;
117
118
119 typedef enum {
120         TR_TILE_WIDTH = 100,
121         TR_TILE_HEIGHT,
122         TR_TILE_BORDER,
123         TR_IMAGE_WIDTH,
124         TR_IMAGE_HEIGHT,
125         TR_ROWS,
126         TR_COLUMNS,
127         TR_CURRENT_ROW,
128         TR_CURRENT_COLUMN,
129         TR_CURRENT_TILE_WIDTH,
130         TR_CURRENT_TILE_HEIGHT,
131         TR_ROW_ORDER,
132         TR_TOP_TO_BOTTOM,
133         TR_BOTTOM_TO_TOP,
134         TR_LEFT,
135         TR_RIGHT,
136         TR_BOTTOM,
137         TR_TOP,
138         TR_NEAR,
139         TR_FAR
140 } TRenum;
141
142
143
144 extern TRcontext *trNew(void);
145
146 extern void trDelete(TRcontext *tr);
147
148
149 extern void trTileSize(TRcontext *tr, GLint width, GLint height, GLint border);
150
151 extern void trTileBuffer(TRcontext *tr, GLenum format, GLenum type,
152                                                  GLvoid *image);
153
154
155 extern void trImageSize(TRcontext *tr, GLint width, GLint height);
156
157 extern void trImageBuffer(TRcontext *tr, GLenum format, GLenum type,
158                                                   GLvoid *image);
159
160
161 extern void trRowOrder(TRcontext *tr, TRenum order);
162
163
164 extern GLint trGet(TRcontext *tr, TRenum param);
165 extern GLdouble trGetD(TRcontext *tr, TRenum param);
166
167
168 extern void trOrtho(TRcontext *tr,
169                                         GLdouble left, GLdouble right,
170                                         GLdouble bottom, GLdouble top,
171                                         GLdouble zNear, GLdouble zFar);
172
173 extern void trFrustum(TRcontext *tr,
174                                           GLdouble left, GLdouble right,
175                                           GLdouble bottom, GLdouble top,
176                                           GLdouble zNear, GLdouble zFar);
177
178 extern void trPerspective(TRcontext *tr,
179                                                   GLdouble fovy, GLdouble aspect,
180                                                   GLdouble zNear, GLdouble zFar );
181
182
183 extern void trBeginTile(TRcontext *tr);
184
185 extern int trEndTile(TRcontext *tr);
186
187
188 extern void trRasterPos3f(TRcontext *tr, GLfloat x, GLfloat y, GLfloat z);
189
190
191
192 //#ifdef __cplusplus
193 //}
194 //#endif
195
196
197 #endif