Arachnoid GLESv1.1 plugin. Compile and run (a bit glitchy and no frameskip) on the...
[mupen64plus-pandora.git] / source / mupen64plus-video-arachnoid / src / OpenGLManager.h
CommitLineData
22726e4d 1/******************************************************************************
2 * Arachnoid Graphics Plugin for Mupen64Plus
3 * http://bitbucket.org/wahrhaft/mupen64plus-video-arachnoid/
4 *
5 * Copyright (C) 2009 Jon Ring
6 * Copyright (C) 2007 Kristofer Karlsson, Rickard Niklasson
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 *****************************************************************************/
22
23#ifndef OPEN_GL_Manager_H_
24#define OPEN_GL_Manager_H_
25
26//OpenGL includes
27#include "m64p.h"
28#include "OpenGL.h"
29
30//*****************************************************************************
31//* OpenGL Manager Class
32//! Singelton class for initializing OpenGL and contolling OpenGL states.
33//*****************************************************************************
34class OpenGLManager
35{
36public:
37
38 //Destructor
39 ~OpenGLManager();
40
41 //Singleton Instance
42 static OpenGLManager& getSingleton()
43 {
44 static OpenGLManager instance;
45 return instance;
46 }
47
48 //Functions
49 bool initialize(bool fullscreen, int width, int height, int bitDepth, int refreshRate, bool vSync, bool hideCursor);
50 void dispose();
51 void resize(int width, int height, int bitDepth, int refreshRate);
52 bool toggleFullscreen();
53 void beginRendering();
54 void endRendering();
55
56 //Fog
57 void setFogEnabled(bool fog);
58 bool getFogEnabled();
59
60 //Light
61 void setLighting(bool lighting);
62 bool getLightingEnabled();
63
64 //Textureing
65 void setTextureing2D(bool textureing);
66 bool getTextureing2DEnabled();
67
68 //Depth Testing
69 void setZBufferEnabled(bool enable);
70 bool getZBufferEnabled();
71
72 //Alpha Test
73 void setAlphaTest(bool alphaTestEnable);
74 bool getAlphaTestEnabled();
75
76 //Wireframe
77 void setWireFrame(bool wireframe);
78
79 //Culling
80 void setCullMode(bool cullFront, bool cullBack);
81 void setForceDisableCulling(bool force) { m_forceDisableCulling = force; }
82
83 //Set Viewport
84 void setViewport(int x, int y, int width, int height, float zNear=0.0f, float zFar=1.0f);
85
86 //Set Scissor
87 void setScissorEnabled(bool enable);
88 bool getScissorEnabled();
89 void setScissor(int x, int y, int width, int height);
90
91 //! Sets the backround color of OpenGL viewport
92 void setClearColor(float r, float g, float b) { glClearColor(r, g, b, 1.0f); }
93
94 //Set callback from the M64P core
95 void setRenderingCallback(void(*callback)(int)) { m_renderingCallback = callback; }
96
97 //Set draw flag for rendering callback
98 void setDrawFlag() { m_drawFlag = 1; }
99
100public:
101
102 //N64 Specifics
103 void calcViewScale(int viWidth, int viHeight);
104 float getViewScaleX() { return m_scaleX; }
105 float getViewScaleY() { return m_scaleY; }
106
107public:
108
109 //Gets
110
111 int getWidth() { return m_width; }
112 int getHeight() { return m_height; }
113 bool getFullscreen() { return m_fullscreen; }
114
115private:
116
117 //Constructor
118 OpenGLManager();
119
120private:
121
122 bool m_wireframe; //!< Wireframe mode enabled?
123 bool m_lighting; //!< Lighting enabled?
124 int m_width; //!< Display widht
125 int m_height; //!< Display height
126 int m_bitDepth; //!< Fullscreen bitdepth
127 int m_refreshRate; //!< Fullscreen refresh rate
128 float m_scaleX; //!< DisplayWidth aka WindowWidth / viWidth (n64 specific)
129 float m_scaleY; //!< DisplayHeight aka WindowHeight / viHeight (n64 specific)
130 bool m_fullscreen; //!< Fullscreen mode or window mode?
131 bool m_forceDisableCulling; //!< Culling cant be enabled if this is true
132
133 void (*m_renderingCallback)(int); //Rendering callback from the core
134 int m_drawFlag;
135};
136
137#endif