1
/******************************************************************************
2
* Arachnoid Graphics Plugin for Mupen64Plus
3
* http://bitbucket.org/wahrhaft/mupen64plus-video-arachnoid/
5
* Copyright (C) 2009 Jon Ring
6
* Copyright (C) 2007 Kristofer Karlsson, Rickard Niklasson
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.
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.
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
*****************************************************************************/
23
#ifndef OPEN_GL_Manager_H_
24
#define OPEN_GL_Manager_H_
31
//*****************************************************************************
32
//* OpenGL Manager Class
33
//! Singelton class for initializing OpenGL and contolling OpenGL states.
34
//*****************************************************************************
43
static OpenGLManager& getSingleton()
45
static OpenGLManager instance;
50
bool initialize(bool fullscreen, int width, int height, int bitDepth, int refreshRate, bool vSync, bool hideCursor);
52
void resize(int width, int height, int bitDepth, int refreshRate);
53
bool toggleFullscreen();
54
void beginRendering();
58
void setFogEnabled(bool fog);
62
void setLighting(bool lighting);
63
bool getLightingEnabled();
66
void setTextureing2D(bool textureing);
67
bool getTextureing2DEnabled();
70
void setZBufferEnabled(bool enable);
71
bool getZBufferEnabled();
74
void setAlphaTest(bool alphaTestEnable);
75
bool getAlphaTestEnabled();
78
void setWireFrame(bool wireframe);
81
void setCullMode(bool cullFront, bool cullBack);
82
void setForceDisableCulling(bool force) { m_forceDisableCulling = force; }
85
void setViewport(int x, int y, int width, int height, float zNear=0.0f, float zFar=1.0f);
88
void setScissorEnabled(bool enable);
89
bool getScissorEnabled();
90
void setScissor(int x, int y, int width, int height);
92
//! Sets the backround color of OpenGL viewport
93
void setClearColor(float r, float g, float b) { glClearColor(r, g, b, 1.0f); }
95
//Set callback from the M64P core
96
void setRenderingCallback(void(*callback)(int)) { m_renderingCallback = callback; }
98
//Set draw flag for rendering callback
99
void setDrawFlag() { m_drawFlag = 1; }
104
void calcViewScale(int viWidth, int viHeight);
105
float getViewScaleX() { return m_scaleX; }
106
float getViewScaleY() { return m_scaleY; }
112
int getWidth() { return m_width; }
113
int getHeight() { return m_height; }
114
bool getFullscreen() { return m_fullscreen; }
123
bool m_wireframe; //!< Wireframe mode enabled?
124
bool m_lighting; //!< Lighting enabled?
125
int m_width; //!< Display widht
126
int m_height; //!< Display height
127
int m_bitDepth; //!< Fullscreen bitdepth
128
int m_refreshRate; //!< Fullscreen refresh rate
129
float m_scaleX; //!< DisplayWidth aka WindowWidth / viWidth (n64 specific)
130
float m_scaleY; //!< DisplayHeight aka WindowHeight / viHeight (n64 specific)
131
bool m_fullscreen; //!< Fullscreen mode or window mode?
132
bool m_forceDisableCulling; //!< Culling cant be enabled if this is true
134
void (*m_renderingCallback)(int); //Rendering callback from the core