1 | /****************************************************************************** |
---|
2 | * SAGE - Scalable Adaptive Graphics Environment |
---|
3 | * |
---|
4 | * Module: sdlSingleContext.h |
---|
5 | * Author : Byungil Jeong |
---|
6 | * |
---|
7 | * Description: This is the header file for the video display module of SAGE. |
---|
8 | * |
---|
9 | * Notes : Since the display window may receive its many pieces from many servers, we need to pass multiple buffers |
---|
10 | * to this class. Each of the buffers passed contains a frame which forms a part (or whole) of the image on |
---|
11 | * the display side. |
---|
12 | * |
---|
13 | * Copyright (C) 2007 Electronic Visualization Laboratory, |
---|
14 | * University of Illinois at Chicago |
---|
15 | * |
---|
16 | * All rights reserved. |
---|
17 | * |
---|
18 | * Redistribution and use in source and binary forms, with or without |
---|
19 | * modification, are permitted provided that the following conditions are met: |
---|
20 | * |
---|
21 | * * Redistributions of source code must retain the above copyright |
---|
22 | * notice, this list of conditions and the following disclaimer. |
---|
23 | * * Redistributions in binary form must reproduce the above |
---|
24 | * copyright notice, this list of conditions and the following disclaimer |
---|
25 | * in the documentation and/or other materials provided with the distribution. |
---|
26 | * * Neither the name of the University of Illinois at Chicago nor |
---|
27 | * the names of its contributors may be used to endorse or promote |
---|
28 | * products derived from this software without specific prior written permission. |
---|
29 | * |
---|
30 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
31 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
32 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
33 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
---|
34 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
---|
35 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
36 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
---|
37 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
---|
38 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
---|
39 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
---|
40 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
41 | * |
---|
42 | * Direct questions, comments etc about SAGE to sage_users@listserv.uic.edu or |
---|
43 | * http://www.evl.uic.edu/cavern/forum/ |
---|
44 | * |
---|
45 | ***************************************************************************************************************************/ |
---|
46 | |
---|
47 | #ifndef SDL_SINGLE_CONTEXT_H |
---|
48 | #define SDL_SINGLE_CONTEXT_H |
---|
49 | |
---|
50 | #include "displayContext.h" |
---|
51 | |
---|
52 | #if defined(__APPLE__) |
---|
53 | #include <OpenGL/gl.h> // Header File For The OpenGL Library |
---|
54 | #include <OpenGL/glu.h> // Header File For The GLu Library |
---|
55 | #else |
---|
56 | #include <GL/gl.h> // Header File For The OpenGL Library |
---|
57 | #include <GL/glu.h> // Header File For The GLu Library |
---|
58 | #endif |
---|
59 | |
---|
60 | #ifdef sun |
---|
61 | #include <SDL.h> |
---|
62 | #elif defined(__APPLE__) |
---|
63 | #include <SDL.h> |
---|
64 | #else |
---|
65 | #include <SDL/SDL.h> |
---|
66 | #endif |
---|
67 | |
---|
68 | |
---|
69 | class sdlSingleContext : public displayContext { |
---|
70 | protected: |
---|
71 | SDL_Surface *surface; |
---|
72 | int window_width, window_height; |
---|
73 | |
---|
74 | public: |
---|
75 | int init(struct sageDisplayConfig &cfg); |
---|
76 | void clearScreen(); |
---|
77 | void setupViewport(int i, sageRect &tileRect); |
---|
78 | void refreshScreen(); |
---|
79 | void changeBackground(int red, int green, int blue); |
---|
80 | ~sdlSingleContext(); |
---|
81 | void checkEvent(); |
---|
82 | }; |
---|
83 | |
---|
84 | #endif |
---|