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