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 #include "DummyCombiner.h"
23 #include "CombinerStructs.h"
24 #include "ExtensionChecker.h"
25 #include "MultiTexturingExt.h"
27 //-----------------------------------------------------------------------------
29 //! Checks if multitexturing is supported
30 //-----------------------------------------------------------------------------
31 void DummyCombiner::initialize()
33 ARB_multitexture = isExtensionSupported("GL_ARB_multitexture");
36 //-----------------------------------------------------------------------------
37 //* Create New Texture Enviroment
38 //! Allocates a new texture enviroment
39 //! @param[in] colorCombiner How to combine and get a color
40 //! @param[in] alphaCombiner How to combine and get an alpha value
41 //! @return The texture enviroment that was created
42 //-----------------------------------------------------------------------------
43 TexEnvCombiner* DummyCombiner::createNewTextureEnviroment(Combiner* colorCombiner, Combiner *alphaCombiner)
45 TexEnvCombiner* texEnv = new TexEnvCombiner();
46 texEnv->usesT0 = false;
47 texEnv->usesT1 = false;
48 texEnv->mode = GL_REPLACE;
49 texEnv->vertex.color = COMBINED;
50 texEnv->vertex.alpha = COMBINED;
52 //For each stage in alpha combiner
53 for (int i = 0; i < alphaCombiner->numStages; i++)
55 //For each operation in stage
56 for (int j = 0; j < alphaCombiner->stage[i].numOps; j++)
58 CombinerOp* op = &colorCombiner->stage[i].op[j];
60 if ( op->param1 == TEXEL0 )
62 texEnv->usesT0 = true;
69 //-----------------------------------------------------------------------------
70 //* Set Texture Enviroment
71 //! Sets OpenGL (enables texturing)
72 //-----------------------------------------------------------------------------
73 void DummyCombiner::setTextureEnviroment(TexEnvCombiner* texEnv)
76 if ( ARB_multitexture )
77 glActiveTextureARB( GL_TEXTURE0_ARB );
80 glEnable( GL_TEXTURE_2D );
82 glDisable( GL_TEXTURE_2D );