Commit 838ea264 authored by hybrid's avatar hybrid

Changed OpenGL default Renderstate to ALPHA_TEST being disabled. Some...

Changed OpenGL default Renderstate to ALPHA_TEST being disabled. Some indentation changes in other files.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@786 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 63b756e8
Changes in version 1.4 (... 2007) Changes in version 1.4 (... 2007)
- Fixed some OpenGL renderstate stuff. setBasicRenderstate returns with
active texture layer 0. The material renderer must return from OnUnset
with the same active texture layer. The alpha test is disabled and the
texture mode should be GL_MODULATE.
- Fixed CSoftwareTexture2::getOriginalSize, reported by CaptainPants. Added a - Fixed CSoftwareTexture2::getOriginalSize, reported by CaptainPants. Added a
new method CSoftwareTexture2::getMaxSize to return the size of the largest new method CSoftwareTexture2::getMaxSize to return the size of the largest
mipmap, which is used by texelarea instead of getOriginalSize. mipmap, which is used by texelarea instead of getOriginalSize.
......
...@@ -17,9 +17,9 @@ namespace gui ...@@ -17,9 +17,9 @@ namespace gui
{ {
//! constructor //! constructor
CGUIListBox::CGUIListBox(IGUIEnvironment* environment, IGUIElement* parent, CGUIListBox::CGUIListBox(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle, bool clip, s32 id, core::rect<s32> rectangle, bool clip,
bool drawBack, bool moveOverSelect) bool drawBack, bool moveOverSelect)
: IGUIListBox(environment, parent, id, rectangle), Selected(-1), ItemHeight(0), : IGUIListBox(environment, parent, id, rectangle), Selected(-1), ItemHeight(0),
TotalItemHeight(0), ItemsIconWidth(0), Font(0), IconBank(0), TotalItemHeight(0), ItemsIconWidth(0), Font(0), IconBank(0),
ScrollBar(0), Selecting(false), DrawBack(drawBack), ScrollBar(0), Selecting(false), DrawBack(drawBack),
...@@ -37,7 +37,7 @@ CGUIListBox::CGUIListBox(IGUIEnvironment* environment, IGUIElement* parent, ...@@ -37,7 +37,7 @@ CGUIListBox::CGUIListBox(IGUIEnvironment* environment, IGUIElement* parent,
!clip); !clip);
ScrollBar->setSubElement(true); ScrollBar->setSubElement(true);
ScrollBar->setTabStop(false); ScrollBar->setTabStop(false);
ScrollBar->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT); ScrollBar->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
ScrollBar->drop(); ScrollBar->drop();
ScrollBar->setPos(0); ScrollBar->setPos(0);
...@@ -48,7 +48,7 @@ CGUIListBox::CGUIListBox(IGUIEnvironment* environment, IGUIElement* parent, ...@@ -48,7 +48,7 @@ CGUIListBox::CGUIListBox(IGUIEnvironment* environment, IGUIElement* parent,
// this element can be tabbed to // this element can be tabbed to
setTabStop(true); setTabStop(true);
setTabOrder(-1); setTabOrder(-1);
updateAbsolutePosition(); updateAbsolutePosition();
} }
...@@ -199,9 +199,9 @@ bool CGUIListBox::OnEvent(SEvent event) ...@@ -199,9 +199,9 @@ bool CGUIListBox::OnEvent(SEvent event)
switch(event.EventType) switch(event.EventType)
{ {
case EET_KEY_INPUT_EVENT: case EET_KEY_INPUT_EVENT:
if (event.KeyInput.PressedDown && if (event.KeyInput.PressedDown &&
(event.KeyInput.Key == KEY_DOWN || (event.KeyInput.Key == KEY_DOWN ||
event.KeyInput.Key == KEY_UP || event.KeyInput.Key == KEY_UP ||
event.KeyInput.Key == KEY_HOME || event.KeyInput.Key == KEY_HOME ||
event.KeyInput.Key == KEY_END || event.KeyInput.Key == KEY_END ||
event.KeyInput.Key == KEY_NEXT || event.KeyInput.Key == KEY_NEXT ||
...@@ -210,10 +210,10 @@ bool CGUIListBox::OnEvent(SEvent event) ...@@ -210,10 +210,10 @@ bool CGUIListBox::OnEvent(SEvent event)
s32 oldSelected = Selected; s32 oldSelected = Selected;
switch (event.KeyInput.Key) switch (event.KeyInput.Key)
{ {
case KEY_DOWN: case KEY_DOWN:
Selected += 1; Selected += 1;
break; break;
case KEY_UP: case KEY_UP:
Selected -= 1; Selected -= 1;
break; break;
case KEY_HOME: case KEY_HOME:
...@@ -227,10 +227,13 @@ bool CGUIListBox::OnEvent(SEvent event) ...@@ -227,10 +227,13 @@ bool CGUIListBox::OnEvent(SEvent event)
break; break;
case KEY_PRIOR: case KEY_PRIOR:
Selected -= AbsoluteRect.getHeight() / ItemHeight; Selected -= AbsoluteRect.getHeight() / ItemHeight;
break;
default:
break;
} }
if (Selected >= (s32)Items.size()) if (Selected >= (s32)Items.size())
Selected = Items.size() - 1; Selected = Items.size() - 1;
else else
if (Selected<0) if (Selected<0)
Selected = 0; Selected = 0;
...@@ -247,10 +250,10 @@ bool CGUIListBox::OnEvent(SEvent event) ...@@ -247,10 +250,10 @@ bool CGUIListBox::OnEvent(SEvent event)
e.GUIEvent.EventType = EGET_LISTBOX_CHANGED; e.GUIEvent.EventType = EGET_LISTBOX_CHANGED;
Parent->OnEvent(e); Parent->OnEvent(e);
} }
return true; return true;
} }
else else
if (!event.KeyInput.PressedDown && ( event.KeyInput.Key == KEY_RETURN || event.KeyInput.Key == KEY_SPACE ) ) if (!event.KeyInput.PressedDown && ( event.KeyInput.Key == KEY_RETURN || event.KeyInput.Key == KEY_SPACE ) )
{ {
if (Parent) if (Parent)
...@@ -278,6 +281,8 @@ bool CGUIListBox::OnEvent(SEvent event) ...@@ -278,6 +281,8 @@ bool CGUIListBox::OnEvent(SEvent event)
if (event.GUIEvent.Caller == this) if (event.GUIEvent.Caller == this)
Selecting = false; Selecting = false;
} }
default:
break;
} }
break; break;
case EET_MOUSE_INPUT_EVENT: case EET_MOUSE_INPUT_EVENT:
...@@ -295,20 +300,20 @@ bool CGUIListBox::OnEvent(SEvent event) ...@@ -295,20 +300,20 @@ bool CGUIListBox::OnEvent(SEvent event)
IGUIElement *el = Environment->getRootGUIElement()->getElementFromPoint( IGUIElement *el = Environment->getRootGUIElement()->getElementFromPoint(
core::position2di(event.MouseInput.X, event.MouseInput.Y)); core::position2di(event.MouseInput.X, event.MouseInput.Y));
if (Environment->hasFocus(this) && if (Environment->hasFocus(this) &&
ScrollBar == el && ScrollBar == el &&
ScrollBar->OnEvent(event)) ScrollBar->OnEvent(event))
{ {
return true; return true;
} }
Selecting = true; Selecting = true;
Environment->setFocus(this); Environment->setFocus(this);
return true; return true;
} }
case EMIE_LMOUSE_LEFT_UP: case EMIE_LMOUSE_LEFT_UP:
if (Environment->hasFocus(this) && if (Environment->hasFocus(this) &&
ScrollBar->isPointInside(p) && ScrollBar->isPointInside(p) &&
ScrollBar->OnEvent(event)) ScrollBar->OnEvent(event))
return true; return true;
...@@ -320,7 +325,7 @@ bool CGUIListBox::OnEvent(SEvent event) ...@@ -320,7 +325,7 @@ bool CGUIListBox::OnEvent(SEvent event)
break; break;
} }
Selecting = false; Selecting = false;
selectNew(event.MouseInput.Y); selectNew(event.MouseInput.Y);
return true; return true;
...@@ -333,6 +338,8 @@ bool CGUIListBox::OnEvent(SEvent event) ...@@ -333,6 +338,8 @@ bool CGUIListBox::OnEvent(SEvent event)
return true; return true;
} }
} }
default:
break;
} }
} }
break; break;
...@@ -353,7 +360,7 @@ void CGUIListBox::selectNew(s32 ypos, bool onlyHover) ...@@ -353,7 +360,7 @@ void CGUIListBox::selectNew(s32 ypos, bool onlyHover)
if (Selected >= (s32)Items.size()) if (Selected >= (s32)Items.size())
Selected = Items.size() - 1; Selected = Items.size() - 1;
else else
if (Selected<0) if (Selected<0)
Selected = 0; Selected = 0;
...@@ -392,7 +399,7 @@ void CGUIListBox::draw() ...@@ -392,7 +399,7 @@ void CGUIListBox::draw()
// draw background // draw background
core::rect<s32> frameRect(AbsoluteRect); core::rect<s32> frameRect(AbsoluteRect);
// draw items // draw items
core::rect<s32> clientClip(AbsoluteRect); core::rect<s32> clientClip(AbsoluteRect);
...@@ -433,8 +440,8 @@ void CGUIListBox::draw() ...@@ -433,8 +440,8 @@ void CGUIListBox::draw()
{ {
core::position2di iconPos = textRect.UpperLeftCorner; core::position2di iconPos = textRect.UpperLeftCorner;
iconPos.Y += textRect.getHeight() / 2; iconPos.Y += textRect.getHeight() / 2;
iconPos.X += ItemsIconWidth/2; iconPos.X += ItemsIconWidth/2;
IconBank->draw2DSprite( (u32)Items[i].icon, iconPos, &clientClip, IconBank->draw2DSprite( (u32)Items[i].icon, iconPos, &clientClip,
skin->getColor((i==Selected) ? EGDC_ICON_HIGH_LIGHT : EGDC_ICON), skin->getColor((i==Selected) ? EGDC_ICON_HIGH_LIGHT : EGDC_ICON),
(i==Selected) ? selectTime : 0 , (i==Selected) ? os::Timer::getTime() : 0, false, true); (i==Selected) ? selectTime : 0 , (i==Selected) ? os::Timer::getTime() : 0, false, true);
} }
...@@ -466,20 +473,20 @@ s32 CGUIListBox::addItem(const wchar_t* text, s32 icon) ...@@ -466,20 +473,20 @@ s32 CGUIListBox::addItem(const wchar_t* text, s32 icon)
Items.push_back(i); Items.push_back(i);
recalculateItemHeight(); recalculateItemHeight();
if (IconBank && icon > -1 && if (IconBank && icon > -1 &&
IconBank->getSprites().size() > (u32)icon && IconBank->getSprites().size() > (u32)icon &&
IconBank->getSprites()[(u32)icon].Frames.size()) IconBank->getSprites()[(u32)icon].Frames.size())
{ {
u32 rno = IconBank->getSprites()[(u32)icon].Frames[0].rectNumber; u32 rno = IconBank->getSprites()[(u32)icon].Frames[0].rectNumber;
if (IconBank->getPositions().size() > rno) if (IconBank->getPositions().size() > rno)
{ {
s32 w = IconBank->getPositions()[rno].getWidth(); const s32 w = IconBank->getPositions()[rno].getWidth();
if (w > ItemsIconWidth) if (w > ItemsIconWidth)
ItemsIconWidth = w; ItemsIconWidth = w;
} }
} }
return Items.size() - 1; return Items.size() - 1;
} }
...@@ -500,7 +507,7 @@ void CGUIListBox::recalculateScrollPos() ...@@ -500,7 +507,7 @@ void CGUIListBox::recalculateScrollPos()
{ {
ScrollBar->setPos(ScrollBar->getPos() + selPos); ScrollBar->setPos(ScrollBar->getPos() + selPos);
} }
else else
if (selPos > AbsoluteRect.getHeight() - ItemHeight) if (selPos > AbsoluteRect.getHeight() - ItemHeight)
{ {
ScrollBar->setPos(ScrollBar->getPos() + selPos - AbsoluteRect.getHeight() + ItemHeight); ScrollBar->setPos(ScrollBar->getPos() + selPos - AbsoluteRect.getHeight() + ItemHeight);
...@@ -553,7 +560,6 @@ void CGUIListBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadW ...@@ -553,7 +560,6 @@ void CGUIListBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadW
u32 i; u32 i;
for (i=0; i<Items.size(); ++i) for (i=0; i<Items.size(); ++i)
addItem(tmpText[i].c_str(), tmpIcons[i].c_str()); addItem(tmpText[i].c_str(), tmpIcons[i].c_str());
this->setSelected(in->getAttributeAsInt("Selected")); this->setSelected(in->getAttributeAsInt("Selected"));
*/ */
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "IVideoDriver.h" #include "IVideoDriver.h"
#include "ITexture.h" #include "ITexture.h"
namespace irr namespace irr
{ {
namespace gui namespace gui
{ {
...@@ -18,7 +18,6 @@ CGUISpriteBank::CGUISpriteBank(IGUIEnvironment* env) : ...@@ -18,7 +18,6 @@ CGUISpriteBank::CGUISpriteBank(IGUIEnvironment* env) :
if (Driver) if (Driver)
Driver->grab(); Driver->grab();
} }
} }
CGUISpriteBank::~CGUISpriteBank() CGUISpriteBank::~CGUISpriteBank()
...@@ -31,7 +30,6 @@ CGUISpriteBank::~CGUISpriteBank() ...@@ -31,7 +30,6 @@ CGUISpriteBank::~CGUISpriteBank()
// drop video driver // drop video driver
if (Driver) if (Driver)
Driver->drop(); Driver->drop();
} }
core::array< core::rect<s32> >& CGUISpriteBank::getPositions() core::array< core::rect<s32> >& CGUISpriteBank::getPositions()
...@@ -81,8 +79,9 @@ void CGUISpriteBank::setTexture(u32 index, video::ITexture* texture) ...@@ -81,8 +79,9 @@ void CGUISpriteBank::setTexture(u32 index, video::ITexture* texture)
//! draws a sprite in 2d with scale and color //! draws a sprite in 2d with scale and color
void CGUISpriteBank::draw2DSprite(u32 index, const core::position2di& pos, const core::rect<s32>* clip, void CGUISpriteBank::draw2DSprite(u32 index, const core::position2di& pos,
const video::SColor& color, u32 starttime, u32 currenttime, bool loop, bool center) const core::rect<s32>* clip, const video::SColor& color,
u32 starttime, u32 currenttime, bool loop, bool center)
{ {
if (index >= Sprites.size() || Sprites[index].Frames.empty()) if (index >= Sprites.size() || Sprites[index].Frames.empty())
return; return;
...@@ -106,7 +105,7 @@ void CGUISpriteBank::draw2DSprite(u32 index, const core::position2di& pos, const ...@@ -106,7 +105,7 @@ void CGUISpriteBank::draw2DSprite(u32 index, const core::position2di& pos, const
return; return;
core::rect<s32> &r = Rectangles[rn]; core::rect<s32> &r = Rectangles[rn];
if (center) if (center)
{ {
core::position2di p = pos; core::position2di p = pos;
...@@ -118,7 +117,7 @@ void CGUISpriteBank::draw2DSprite(u32 index, const core::position2di& pos, const ...@@ -118,7 +117,7 @@ void CGUISpriteBank::draw2DSprite(u32 index, const core::position2di& pos, const
Driver->draw2DImage(tex, pos, r, clip, color, true); Driver->draw2DImage(tex, pos, r, clip, color, true);
} }
} }
} // namespace gui } // namespace gui
......
...@@ -1051,7 +1051,6 @@ bool COpenGLDriver::setTexture(s32 stage, video::ITexture* texture) ...@@ -1051,7 +1051,6 @@ bool COpenGLDriver::setTexture(s32 stage, video::ITexture* texture)
if (stage >= MaxTextureUnits) if (stage >= MaxTextureUnits)
return false; return false;
// Not working, texture confusion in menu of Meshviewer.
if (CurrentTexture[stage]==texture) if (CurrentTexture[stage]==texture)
return true; return true;
...@@ -1187,6 +1186,7 @@ void COpenGLDriver::setRenderStates3DMode() ...@@ -1187,6 +1186,7 @@ void COpenGLDriver::setRenderStates3DMode()
{ {
// Reset Texture Stages // Reset Texture Stages
glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_MODULATE ); glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_MODULATE );
glDisable(GL_ALPHA_TEST);
glDisable( GL_BLEND ); glDisable( GL_BLEND );
glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_COLOR ); glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_COLOR );
......
...@@ -53,8 +53,6 @@ public: ...@@ -53,8 +53,6 @@ public:
// thanks to Murphy, the following line removed some // thanks to Murphy, the following line removed some
// bugs with several OpenGL implementations. // bugs with several OpenGL implementations.
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glDisable(GL_ALPHA_TEST);
} }
} }
}; };
...@@ -91,6 +89,7 @@ public: ...@@ -91,6 +89,7 @@ public:
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, (f32) modulate ); glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, (f32) modulate );
glBlendFunc( getGLBlend(srcFact), getGLBlend(dstFact) ); glBlendFunc( getGLBlend(srcFact), getGLBlend(dstFact) );
glEnable(GL_ALPHA_TEST);
glEnable(GL_BLEND); glEnable(GL_BLEND);
if ( getTexelAlpha ( srcFact ) + getTexelAlpha ( dstFact ) ) if ( getTexelAlpha ( srcFact ) + getTexelAlpha ( dstFact ) )
...@@ -109,6 +108,7 @@ public: ...@@ -109,6 +108,7 @@ public:
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PREVIOUS_EXT); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PREVIOUS_EXT);
glDisable(GL_BLEND); glDisable(GL_BLEND);
glDisable(GL_ALPHA_TEST);
} }
private: private:
...@@ -171,13 +171,12 @@ public: ...@@ -171,13 +171,12 @@ public:
if (Driver->queryFeature(EVDF_MULTITEXTURE)) if (Driver->queryFeature(EVDF_MULTITEXTURE))
{ {
Driver->extGlActiveTexture(GL_TEXTURE1_ARB); Driver->extGlActiveTexture(GL_TEXTURE1_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
Driver->extGlActiveTexture(GL_TEXTURE0_ARB); Driver->extGlActiveTexture(GL_TEXTURE0_ARB);
} }
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glDisable(GL_ALPHA_TEST);
} }
} }
}; };
...@@ -200,8 +199,6 @@ public: ...@@ -200,8 +199,6 @@ public:
if ((material.MaterialType != lastMaterial.MaterialType) || resetAllRenderstates) if ((material.MaterialType != lastMaterial.MaterialType) || resetAllRenderstates)
{ {
glDisable(GL_ALPHA_TEST);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_BLEND); glEnable(GL_BLEND);
...@@ -238,8 +235,6 @@ public: ...@@ -238,8 +235,6 @@ public:
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
{ {
glDisable(GL_ALPHA_TEST);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_REPLACE); glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_REPLACE);
...@@ -348,9 +343,7 @@ public: ...@@ -348,9 +343,7 @@ public:
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
{ {
glEnable(GL_ALPHA_TEST); glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.5); glAlphaFunc(GL_GREATER, 0.5);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
} }
} }
...@@ -386,8 +379,6 @@ public: ...@@ -386,8 +379,6 @@ public:
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
{ {
glDisable(GL_ALPHA_TEST);
// diffuse map // diffuse map
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
...@@ -457,6 +448,7 @@ public: ...@@ -457,6 +448,7 @@ public:
{ {
Driver->extGlActiveTexture(GL_TEXTURE1_ARB); Driver->extGlActiveTexture(GL_TEXTURE1_ARB);
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 1.f ); glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 1.f );
Driver->extGlActiveTexture(GL_TEXTURE0_ARB);
} }
} }
}; };
...@@ -481,8 +473,6 @@ public: ...@@ -481,8 +473,6 @@ public:
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
{ {
glDisable(GL_ALPHA_TEST);
// diffuse map // diffuse map
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
...@@ -502,6 +492,7 @@ public: ...@@ -502,6 +492,7 @@ public:
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE1_RGB_EXT, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE1_RGB_EXT, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND1_RGB_EXT,GL_SRC_COLOR); glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND1_RGB_EXT,GL_SRC_COLOR);
Driver->extGlActiveTexture(GL_TEXTURE0_ARB);
} }
} }
} }
...@@ -525,18 +516,8 @@ public: ...@@ -525,18 +516,8 @@ public:
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
{ {
if (Driver->queryFeature(EVDF_MULTITEXTURE))
{
Driver->extGlActiveTexture(GL_TEXTURE1_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
Driver->extGlActiveTexture(GL_TEXTURE0_ARB);
}
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glDisable(GL_ALPHA_TEST);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
...@@ -547,8 +528,6 @@ public: ...@@ -547,8 +528,6 @@ public:
virtual void OnUnsetMaterial() virtual void OnUnsetMaterial()
{ {
if (Driver->queryFeature(EVDF_MULTITEXTURE))
Driver->extGlActiveTexture(GL_TEXTURE0_ARB);
glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T); glDisable(GL_TEXTURE_GEN_T);
} }
...@@ -573,8 +552,6 @@ public: ...@@ -573,8 +552,6 @@ public:
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
{ {
glDisable(GL_ALPHA_TEST);
if (Driver->queryFeature(EVDF_MULTITEXTURE)) if (Driver->queryFeature(EVDF_MULTITEXTURE))
{ {
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
...@@ -613,14 +590,17 @@ public: ...@@ -613,14 +590,17 @@ public:
{ {
if (Driver->queryFeature(EVDF_MULTITEXTURE)) if (Driver->queryFeature(EVDF_MULTITEXTURE))
{ {
Driver->extGlActiveTexture(GL_TEXTURE0_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); // default value
Driver->extGlActiveTexture(GL_TEXTURE1_ARB); Driver->extGlActiveTexture(GL_TEXTURE1_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
} }
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T); glDisable(GL_TEXTURE_GEN_T);
if (Driver->queryFeature(EVDF_MULTITEXTURE))
{
Driver->extGlActiveTexture(GL_TEXTURE0_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); // default value
}
} }
}; };
...@@ -645,8 +625,6 @@ public: ...@@ -645,8 +625,6 @@ public:
{ {
if (Driver->queryFeature(EVDF_MULTITEXTURE)) if (Driver->queryFeature(EVDF_MULTITEXTURE))
{ {
Driver->extGlActiveTexture(GL_TEXTURE0_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE ); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE );
...@@ -666,7 +644,6 @@ public: ...@@ -666,7 +644,6 @@ public:
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glDisable(GL_ALPHA_TEST);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
...@@ -684,6 +661,11 @@ public: ...@@ -684,6 +661,11 @@ public:
glDisable(GL_BLEND); glDisable(GL_BLEND);
glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T); glDisable(GL_TEXTURE_GEN_T);
if (Driver->queryFeature(EVDF_MULTITEXTURE))
{
Driver->extGlActiveTexture(GL_TEXTURE0_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); // default value
}
} }
//! Returns if the material is transparent. //! Returns if the material is transparent.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment