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