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