mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-29 03:33:48 +00:00
remove last traces of GL_BLEND/glBlendFunc() manipulation
everything goes through RenderState now some calls are left in FTGL but properly invalidated afterwards
This commit is contained in:
parent
d3cbc181bd
commit
70b8e69402
13 changed files with 33 additions and 61 deletions
|
@ -498,7 +498,7 @@ void MiniMapRender::onRender(const RenderState& rs) const
|
|||
{
|
||||
texWaterBit->apply();
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
|
||||
rs.gpu.setBlend(BLEND_ADD);
|
||||
glColor4f(0.1f, 0.2f, 0.9f, 0.4f*lightLevel);
|
||||
bool curColorIsWater = true;
|
||||
|
||||
|
@ -579,7 +579,7 @@ void MiniMapRender::onRender(const RenderState& rs) const
|
|||
}
|
||||
}
|
||||
}
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
rs.gpu.setBlend(BLEND_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -661,7 +661,7 @@ void MiniMapRender::onRender(const RenderState& rs) const
|
|||
|
||||
texHealthBar->apply();
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
rs.gpu.setBlend(BLEND_DEFAULT);
|
||||
glColor4f(healthBarColor.x, healthBarColor.y, healthBarColor.z, 0.6f);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
|
@ -682,7 +682,7 @@ void MiniMapRender::onRender(const RenderState& rs) const
|
|||
glEnd();
|
||||
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
|
||||
rs.gpu.setBlend(BLEND_ADD);
|
||||
|
||||
int jump = 0;
|
||||
|
||||
|
@ -713,7 +713,7 @@ void MiniMapRender::onRender(const RenderState& rs) const
|
|||
}
|
||||
glEnd();
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
rs.gpu.setBlend(BLEND_DEFAULT);
|
||||
glColor4f(1,1,1,1);
|
||||
|
||||
texMarker->apply();
|
||||
|
@ -731,10 +731,6 @@ void MiniMapRender::onRender(const RenderState& rs) const
|
|||
glTexCoord2f(0, 0);
|
||||
glVertex2f(x-healthMarkerSize, y-healthMarkerSize);
|
||||
glEnd();
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glColor4f(1,1,1,1);
|
||||
}
|
||||
|
||||
void MiniMapRender::renderIcon(const MinimapIcon *ico, const Vector& pos) const
|
||||
|
|
|
@ -54,7 +54,6 @@ void Strand::onRender(const RenderState& rs) const
|
|||
const int numSegments = segments.size();
|
||||
if (numSegments == 0) return;
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glTranslatef(-position.x, -position.y, 0);
|
||||
glLineWidth(1);
|
||||
|
||||
|
|
|
@ -138,12 +138,10 @@ void Web::onUpdate(float dt)
|
|||
void Web::onRender(const RenderState& rs) const
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
RenderObject::lastTextureApplied = 0;
|
||||
|
||||
glLineWidth(4);
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glBegin(GL_LINES);
|
||||
if(points.size() > 0) {
|
||||
for (size_t i = 0; i < points.size()-1; i++) {
|
||||
|
|
|
@ -152,8 +152,7 @@ void AfterEffectManager::render(const RenderState& rs) const
|
|||
|
||||
glPushMatrix();
|
||||
|
||||
glDisable (GL_ALPHA_TEST);
|
||||
glDisable(GL_BLEND);
|
||||
rs.gpu.setBlend(BLEND_DISABLED);
|
||||
|
||||
core->frameBuffer.endCapture();
|
||||
glTranslatef(core->cameraPos.x, core->cameraPos.y, 0);
|
||||
|
|
|
@ -1827,7 +1827,7 @@ void Core::render(int startLayer, int endLayer, bool useFrameBufferIfAvail)
|
|||
|
||||
if (i == darkLayer.getRenderLayer())
|
||||
{
|
||||
darkLayer.render();
|
||||
darkLayer.render(rs);
|
||||
}
|
||||
|
||||
if (i == darkLayer.getLayer() && startLayer != i)
|
||||
|
@ -2087,7 +2087,6 @@ unsigned char *Core::grabScreenshot(size_t x, size_t y, size_t w, size_t h)
|
|||
unsigned char * const imageData = new unsigned char[size];
|
||||
|
||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_ALPHA_TEST); glDisable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST); glDisable(GL_DITHER); glDisable(GL_FOG);
|
||||
glDisable(GL_LIGHTING); glDisable(GL_LOGIC_OP);
|
||||
|
|
|
@ -30,7 +30,6 @@ DarkLayer::DarkLayer()
|
|||
renderLayer = -1;
|
||||
texture = 0;
|
||||
|
||||
stretch = 4;
|
||||
format = GL_RGB; //FIXED?: used to be GL_LUMINANCE, that might have been causing problems
|
||||
useFrameBuffer = true; //BUG?: will do this even if frame buffer is off in usersettings...
|
||||
}
|
||||
|
@ -131,7 +130,7 @@ void DarkLayer::preRender()
|
|||
}
|
||||
}
|
||||
|
||||
void DarkLayer::render() const
|
||||
void DarkLayer::render(const RenderState& rs) const
|
||||
{
|
||||
if (renderLayer != -1)
|
||||
{
|
||||
|
@ -146,33 +145,15 @@ void DarkLayer::render() const
|
|||
else
|
||||
glBindTexture(GL_TEXTURE_2D,texture);
|
||||
|
||||
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
|
||||
|
||||
// subtractive blend! (using color)
|
||||
glBlendFunc(GL_ZERO, GL_SRC_COLOR);
|
||||
|
||||
GLenum error = glGetError();
|
||||
if (error == GL_INVALID_ENUM)
|
||||
{
|
||||
debugLog("darkLayer: invalid enum");
|
||||
}
|
||||
else if (error == GL_INVALID_OPERATION)
|
||||
{
|
||||
debugLog("darkLayer: invalid operation");
|
||||
}
|
||||
|
||||
|
||||
rs.gpu.setBlend(BLEND_MULT);
|
||||
|
||||
glColor4f(1,1,1,1);
|
||||
|
||||
float width = core->getWindowWidth();
|
||||
float height = core->getWindowHeight();
|
||||
float offX = -(core->getVirtualOffX() * width / core->getVirtualWidth());
|
||||
float offY = -(core->getVirtualOffY() * height / core->getVirtualHeight());
|
||||
const float width = core->getWindowWidth();
|
||||
const float height = core->getWindowHeight();
|
||||
const float offX = -(core->getVirtualOffX() * width / core->getVirtualWidth());
|
||||
const float offY = -(core->getVirtualOffY() * height / core->getVirtualHeight());
|
||||
const float stretch = 4;
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "Base.h"
|
||||
#include "FrameBuffer.h"
|
||||
|
||||
struct RenderState;
|
||||
|
||||
class DarkLayer
|
||||
{
|
||||
public:
|
||||
|
@ -32,7 +34,7 @@ public:
|
|||
void toggle(bool on);
|
||||
void setLayers(int layer, int renderLayer);
|
||||
void preRender();
|
||||
void render() const;
|
||||
void render(const RenderState& rs) const;
|
||||
int getLayer();
|
||||
int getRenderLayer();
|
||||
bool isUsed();
|
||||
|
@ -43,7 +45,6 @@ public:
|
|||
bool useFrameBuffer;
|
||||
FrameBuffer frameBuffer;
|
||||
protected:
|
||||
float stretch;
|
||||
int quality;
|
||||
bool active;
|
||||
int layer, renderLayer;
|
||||
|
|
|
@ -418,13 +418,11 @@ void CollideQuad::renderCollision(const RenderState& rs) const
|
|||
glTranslatef(position.x+offset.x, position.y+offset.y, 0);
|
||||
|
||||
glTranslatef(internalOffset.x, internalOffset.y, 0);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
rs.gpu.setBlend(BLEND_DEFAULT);
|
||||
|
||||
glColor4f(1,0,0,0.5);
|
||||
drawCircle(collideRadius, 8);
|
||||
glDisable(GL_BLEND);
|
||||
glTranslatef(offset.x, offset.y,0);
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -531,7 +531,6 @@ void RenderObject::debugRenderPaths() const
|
|||
return;
|
||||
|
||||
glLineWidth(4);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
|
|
@ -33,9 +33,9 @@ GPUState::GPUState()
|
|||
void GPUState::setBlend(BlendType bt)
|
||||
{
|
||||
compile_assert(Countof(s_blendParams) == _BLEND_MAXSIZE);
|
||||
// FIXME: comment this back in once ALL other occurances of glBlendFunc() have been removed
|
||||
//if(_blendType == bt)
|
||||
// return;
|
||||
|
||||
if(_blendType == bt)
|
||||
return;
|
||||
|
||||
_blendType = bt;
|
||||
if (unsigned(bt) < _BLEND_MAXSIZE)
|
||||
|
@ -50,3 +50,8 @@ void GPUState::setBlend(BlendType bt)
|
|||
glDisable(GL_ALPHA_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
void GPUState::invalidateBlend()
|
||||
{
|
||||
_blendType = _BLEND_MAXSIZE;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ struct GPUState
|
|||
GPUState();
|
||||
|
||||
void setBlend(BlendType bt);
|
||||
void invalidateBlend();
|
||||
|
||||
private:
|
||||
BlendType _blendType;
|
||||
|
|
|
@ -265,15 +265,14 @@ void Bone::renderCollision(const RenderState& rs) const
|
|||
{
|
||||
if (!collisionMask.empty())
|
||||
{
|
||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||
glPushMatrix();
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
RenderObject::lastTextureApplied = 0;
|
||||
|
||||
glLoadIdentity();
|
||||
core->setupRenderPositionAndScale();
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
rs.gpu.setBlend(BLEND_DEFAULT);
|
||||
|
||||
glColor4f(1,1,0,0.5);
|
||||
|
||||
|
@ -290,10 +289,7 @@ void Bone::renderCollision(const RenderState& rs) const
|
|||
glTranslatef(-collide.x, -collide.y, 0);
|
||||
}
|
||||
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glPopMatrix();
|
||||
glPopAttrib();
|
||||
}
|
||||
else
|
||||
CollideQuad::renderCollision(rs);
|
||||
|
|
|
@ -261,13 +261,13 @@ void TTFText::onRender(const RenderState& rs) const
|
|||
glPushMatrix();
|
||||
glScalef(1, -1, 0);
|
||||
glTranslatef(-hw, 0 + (i*-lineHeight), 0);
|
||||
font->font->Render(text[i].c_str());
|
||||
font->font->Render(text[i].c_str()); // changes blend modes
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
RenderObject::lastTextureApplied = 0;
|
||||
|
||||
rs.gpu.invalidateBlend();
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue