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