Fix coding style
[survex.git] / src / tr.h
blob8ff06b23bbaa805b760937cc8dea9bd165413bf4
1 /* $Id: tr.h,v 1.5 1997/07/21 17:34:07 brianp Exp $ */
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
8 * Revision 1.4 1997/07/21 15:47:35 brianp
9 * renamed all "near" and "far" variables
11 * Revision 1.3 1997/04/26 21:23:25 brianp
12 * added trRasterPos3f function
14 * Revision 1.2 1997/04/19 23:26:10 brianp
15 * many API changes
17 * Revision 1.1 1997/04/18 21:53:05 brianp
18 * Initial revision
24 * Tiled Rendering library
25 * Version 1.1
26 * Copyright (C) Brian Paul
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.
34 * Basic usage:
36 * 1. Allocate a tile rendering context:
37 * TRcontext t = trNew();
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);
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);
51 * 4. Render the tiles:
52 * do {
53 * trBeginTile(t);
54 * DrawMyScene();
55 * } while (trEndTile(t));
57 * You provide the DrawMyScene() function which calls glClear() and
58 * draws all your stuff.
60 * 5. The image array is now complete. Display it, write it to a file, etc.
62 * 6. Delete the tile rendering context when finished:
63 * trDelete(t);
68 #ifndef TR_H
69 #define TR_H
72 #include <GL/gl.h>
75 #ifdef __cplusplus
76 extern "C" {
77 #endif
80 #define TR_VERSION "1.1"
81 #define TR_MAJOR_VERSION 1
82 #define TR_MINOR_VERSION 1
85 typedef struct _TRctx TRcontext;
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;
107 extern TRcontext *trNew(void);
109 extern void trDelete(TRcontext *tr);
112 extern void trTileSize(TRcontext *tr, GLint width, GLint height, GLint border);
114 extern void trTileBuffer(TRcontext *tr, GLenum format, GLenum type,
115 GLvoid *image);
118 extern void trImageSize(TRcontext *tr, GLint width, GLint height);
120 extern void trImageBuffer(TRcontext *tr, GLenum format, GLenum type,
121 GLvoid *image);
124 extern void trRowOrder(TRcontext *tr, TRenum order);
127 extern GLint trGet(TRcontext *tr, TRenum param);
130 extern void trOrtho(TRcontext *tr,
131 GLdouble left, GLdouble right,
132 GLdouble bottom, GLdouble top,
133 GLdouble zNear, GLdouble zFar);
135 extern void trFrustum(TRcontext *tr,
136 GLdouble left, GLdouble right,
137 GLdouble bottom, GLdouble top,
138 GLdouble zNear, GLdouble zFar);
140 extern void trPerspective(TRcontext *tr,
141 GLdouble fovy, GLdouble aspect,
142 GLdouble zNear, GLdouble zFar );
145 extern void trBeginTile(TRcontext *tr);
147 extern int trEndTile(TRcontext *tr);
150 extern void trRasterPos3f(TRcontext *tr, GLfloat x, GLfloat y, GLfloat z);
154 #ifdef __cplusplus
156 #endif
159 #endif