1 /******************************************************************************
2 * Arachnoid Graphics Plugin for Mupen64Plus
3 * http://bitbucket.org/wahrhaft/mupen64plus-video-arachnoid/
5 * Copyright (C) 2007 Kristofer Karlsson, Rickard Niklasson
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *****************************************************************************/
22 #ifndef OPEN_GL_RENDERER_H_
23 #define OPEN_GL_RENDERER_H_
28 //Forward Declarations
36 #include "MultiTexturingExt.h"
39 //*****************************************************************************
41 //! Used in vertex buffer by OpenGLRenderer.
42 //*****************************************************************************
45 float x, y, z, w; //!< Vertex position
49 } color, secondaryColor; //!< Color and secondary color
50 float s0, t0, s1, t1; //!< Texture coordinats
51 float fog; //!< Vertex fog variable
54 //*****************************************************************************
56 //! Class for rendering using OpenGL
57 //*****************************************************************************
62 //Get Singleton Instance
63 static OpenGLRenderer& getSingleton()
65 static OpenGLRenderer instance;
73 bool initialize(RSP* rsp, RDP* rdp, TextureCache* textureCache, VI* vi, FogManager* fogMgr);
79 void addTriangle( SPVertex *vertices, int v0, int v1, int v2 );
81 //Get number of vertices
82 int getNumVertices() { return m_numVertices; }
85 void renderTexRect( float ulx, float uly, //Upper left vertex
86 float lrx, float lry, //Lower right vertex
87 float uls, float ult, //Upper left texcoord
88 float lrs, float lrt, //Lower right texcoord
98 GLVertex m_vertices[256]; //!< Vertex buffer
99 unsigned char m_triangles[300][3]; //!< Triangles used to index vertices
101 int m_numVertices; //!< Number of vertices in vertex buffer
102 int m_numTriangles; //!< Number of triangles
104 RSP* m_rsp; //!< Pointer to Reality Signal Processor
105 RDP* m_rdp; //!< Pointer to Reality Drawing Processor
106 VI* m_vi; //!< Pointer to Video Interface
107 TextureCache* m_textureCache; //!< Pointer to texture cache
108 FogManager* m_fogMgr; //!< Pointer to Fog Manager used to render fog.