1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | /* |
---|
3 | * ---------------------------------------------------------------------- |
---|
4 | * ScreenSnapper.h: ScreenSnapper class. It captures the render result |
---|
5 | * and stores it in an array of chars or floats |
---|
6 | * depending on chosen format. |
---|
7 | * |
---|
8 | * ====================================================================== |
---|
9 | * AUTHOR: Wei Qiao <qiaow@purdue.edu> |
---|
10 | * Purdue Rendering and Perceptualization Lab (PURPL) |
---|
11 | * |
---|
12 | * Copyright (c) 2004-2006 Purdue Research Foundation |
---|
13 | * |
---|
14 | * See the file "license.terms" for information on usage and |
---|
15 | * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
16 | * ====================================================================== |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef _SCREEN_SNAPPER_H_ |
---|
20 | #define _SCREEN_SNAPPER_H_ |
---|
21 | |
---|
22 | #include "define.h" |
---|
23 | #include <GL/gl.h> |
---|
24 | #include <stdio.h> |
---|
25 | |
---|
26 | |
---|
27 | class ScreenSnapper |
---|
28 | { |
---|
29 | public: |
---|
30 | int width, height; //size of the screen |
---|
31 | GLuint data_type; //data type: GL_FLOAT or GL_UNSIGNED_BYTE |
---|
32 | int n_channels_per_pixel; //RGB(3) or RGBA(4) |
---|
33 | |
---|
34 | void* data; //storage array for the captured image. This array is "flat". |
---|
35 | //It stores pixels in the order from lower-left corner to upper-right corner. |
---|
36 | //[rgb][rgb][rgb]... or [rgba][rgba][rgba]... |
---|
37 | |
---|
38 | ScreenSnapper(int width, int height, GLuint type, int channel_per_pixel); |
---|
39 | ~ScreenSnapper(); |
---|
40 | |
---|
41 | void reset(char c); //set every byte in the data array to c |
---|
42 | void capture(); |
---|
43 | void print(); |
---|
44 | }; |
---|
45 | |
---|
46 | #endif |
---|