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