mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-05-10 02:55:00 +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();
|
texWaterBit->apply();
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
|
rs.gpu.setBlend(BLEND_ADD);
|
||||||
glColor4f(0.1f, 0.2f, 0.9f, 0.4f*lightLevel);
|
glColor4f(0.1f, 0.2f, 0.9f, 0.4f*lightLevel);
|
||||||
bool curColorIsWater = true;
|
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();
|
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);
|
glColor4f(healthBarColor.x, healthBarColor.y, healthBarColor.z, 0.6f);
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
@ -682,7 +682,7 @@ void MiniMapRender::onRender(const RenderState& rs) const
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
|
rs.gpu.setBlend(BLEND_ADD);
|
||||||
|
|
||||||
int jump = 0;
|
int jump = 0;
|
||||||
|
|
||||||
|
@ -713,7 +713,7 @@ void MiniMapRender::onRender(const RenderState& rs) const
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
rs.gpu.setBlend(BLEND_DEFAULT);
|
||||||
glColor4f(1,1,1,1);
|
glColor4f(1,1,1,1);
|
||||||
|
|
||||||
texMarker->apply();
|
texMarker->apply();
|
||||||
|
@ -731,10 +731,6 @@ void MiniMapRender::onRender(const RenderState& rs) const
|
||||||
glTexCoord2f(0, 0);
|
glTexCoord2f(0, 0);
|
||||||
glVertex2f(x-healthMarkerSize, y-healthMarkerSize);
|
glVertex2f(x-healthMarkerSize, y-healthMarkerSize);
|
||||||
glEnd();
|
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
|
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();
|
const int numSegments = segments.size();
|
||||||
if (numSegments == 0) return;
|
if (numSegments == 0) return;
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glTranslatef(-position.x, -position.y, 0);
|
glTranslatef(-position.x, -position.y, 0);
|
||||||
glLineWidth(1);
|
glLineWidth(1);
|
||||||
|
|
||||||
|
|
|
@ -138,12 +138,10 @@ void Web::onUpdate(float dt)
|
||||||
void Web::onRender(const RenderState& rs) const
|
void Web::onRender(const RenderState& rs) const
|
||||||
{
|
{
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
RenderObject::lastTextureApplied = 0;
|
||||||
|
|
||||||
glLineWidth(4);
|
glLineWidth(4);
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
if(points.size() > 0) {
|
if(points.size() > 0) {
|
||||||
for (size_t i = 0; i < points.size()-1; i++) {
|
for (size_t i = 0; i < points.size()-1; i++) {
|
||||||
|
|
|
@ -152,8 +152,7 @@ void AfterEffectManager::render(const RenderState& rs) const
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
glDisable (GL_ALPHA_TEST);
|
rs.gpu.setBlend(BLEND_DISABLED);
|
||||||
glDisable(GL_BLEND);
|
|
||||||
|
|
||||||
core->frameBuffer.endCapture();
|
core->frameBuffer.endCapture();
|
||||||
glTranslatef(core->cameraPos.x, core->cameraPos.y, 0);
|
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())
|
if (i == darkLayer.getRenderLayer())
|
||||||
{
|
{
|
||||||
darkLayer.render();
|
darkLayer.render(rs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == darkLayer.getLayer() && startLayer != i)
|
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];
|
unsigned char * const imageData = new unsigned char[size];
|
||||||
|
|
||||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||||
glDisable(GL_BLEND);
|
|
||||||
glDisable(GL_ALPHA_TEST); glDisable(GL_BLEND);
|
glDisable(GL_ALPHA_TEST); glDisable(GL_BLEND);
|
||||||
glDisable(GL_DEPTH_TEST); glDisable(GL_DITHER); glDisable(GL_FOG);
|
glDisable(GL_DEPTH_TEST); glDisable(GL_DITHER); glDisable(GL_FOG);
|
||||||
glDisable(GL_LIGHTING); glDisable(GL_LOGIC_OP);
|
glDisable(GL_LIGHTING); glDisable(GL_LOGIC_OP);
|
||||||
|
|
|
@ -30,7 +30,6 @@ DarkLayer::DarkLayer()
|
||||||
renderLayer = -1;
|
renderLayer = -1;
|
||||||
texture = 0;
|
texture = 0;
|
||||||
|
|
||||||
stretch = 4;
|
|
||||||
format = GL_RGB; //FIXED?: used to be GL_LUMINANCE, that might have been causing problems
|
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...
|
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)
|
if (renderLayer != -1)
|
||||||
{
|
{
|
||||||
|
@ -146,33 +145,15 @@ void DarkLayer::render() const
|
||||||
else
|
else
|
||||||
glBindTexture(GL_TEXTURE_2D,texture);
|
glBindTexture(GL_TEXTURE_2D,texture);
|
||||||
|
|
||||||
|
rs.gpu.setBlend(BLEND_MULT);
|
||||||
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
glColor4f(1,1,1,1);
|
glColor4f(1,1,1,1);
|
||||||
|
|
||||||
float width = core->getWindowWidth();
|
const float width = core->getWindowWidth();
|
||||||
float height = core->getWindowHeight();
|
const float height = core->getWindowHeight();
|
||||||
float offX = -(core->getVirtualOffX() * width / core->getVirtualWidth());
|
const float offX = -(core->getVirtualOffX() * width / core->getVirtualWidth());
|
||||||
float offY = -(core->getVirtualOffY() * height / core->getVirtualHeight());
|
const float offY = -(core->getVirtualOffY() * height / core->getVirtualHeight());
|
||||||
|
const float stretch = 4;
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "Base.h"
|
#include "Base.h"
|
||||||
#include "FrameBuffer.h"
|
#include "FrameBuffer.h"
|
||||||
|
|
||||||
|
struct RenderState;
|
||||||
|
|
||||||
class DarkLayer
|
class DarkLayer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -32,7 +34,7 @@ public:
|
||||||
void toggle(bool on);
|
void toggle(bool on);
|
||||||
void setLayers(int layer, int renderLayer);
|
void setLayers(int layer, int renderLayer);
|
||||||
void preRender();
|
void preRender();
|
||||||
void render() const;
|
void render(const RenderState& rs) const;
|
||||||
int getLayer();
|
int getLayer();
|
||||||
int getRenderLayer();
|
int getRenderLayer();
|
||||||
bool isUsed();
|
bool isUsed();
|
||||||
|
@ -43,7 +45,6 @@ public:
|
||||||
bool useFrameBuffer;
|
bool useFrameBuffer;
|
||||||
FrameBuffer frameBuffer;
|
FrameBuffer frameBuffer;
|
||||||
protected:
|
protected:
|
||||||
float stretch;
|
|
||||||
int quality;
|
int quality;
|
||||||
bool active;
|
bool active;
|
||||||
int layer, renderLayer;
|
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(position.x+offset.x, position.y+offset.y, 0);
|
||||||
|
|
||||||
glTranslatef(internalOffset.x, internalOffset.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);
|
glColor4f(1,0,0,0.5);
|
||||||
drawCircle(collideRadius, 8);
|
drawCircle(collideRadius, 8);
|
||||||
glDisable(GL_BLEND);
|
|
||||||
glTranslatef(offset.x, offset.y,0);
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -531,7 +531,6 @@ void RenderObject::debugRenderPaths() const
|
||||||
return;
|
return;
|
||||||
|
|
||||||
glLineWidth(4);
|
glLineWidth(4);
|
||||||
glEnable(GL_BLEND);
|
|
||||||
|
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
|
glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
|
|
@ -33,9 +33,9 @@ GPUState::GPUState()
|
||||||
void GPUState::setBlend(BlendType bt)
|
void GPUState::setBlend(BlendType bt)
|
||||||
{
|
{
|
||||||
compile_assert(Countof(s_blendParams) == _BLEND_MAXSIZE);
|
compile_assert(Countof(s_blendParams) == _BLEND_MAXSIZE);
|
||||||
// FIXME: comment this back in once ALL other occurances of glBlendFunc() have been removed
|
|
||||||
//if(_blendType == bt)
|
if(_blendType == bt)
|
||||||
// return;
|
return;
|
||||||
|
|
||||||
_blendType = bt;
|
_blendType = bt;
|
||||||
if (unsigned(bt) < _BLEND_MAXSIZE)
|
if (unsigned(bt) < _BLEND_MAXSIZE)
|
||||||
|
@ -50,3 +50,8 @@ void GPUState::setBlend(BlendType bt)
|
||||||
glDisable(GL_ALPHA_TEST);
|
glDisable(GL_ALPHA_TEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GPUState::invalidateBlend()
|
||||||
|
{
|
||||||
|
_blendType = _BLEND_MAXSIZE;
|
||||||
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ struct GPUState
|
||||||
GPUState();
|
GPUState();
|
||||||
|
|
||||||
void setBlend(BlendType bt);
|
void setBlend(BlendType bt);
|
||||||
|
void invalidateBlend();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BlendType _blendType;
|
BlendType _blendType;
|
||||||
|
|
|
@ -265,15 +265,14 @@ void Bone::renderCollision(const RenderState& rs) const
|
||||||
{
|
{
|
||||||
if (!collisionMask.empty())
|
if (!collisionMask.empty())
|
||||||
{
|
{
|
||||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
RenderObject::lastTextureApplied = 0;
|
||||||
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
core->setupRenderPositionAndScale();
|
core->setupRenderPositionAndScale();
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
rs.gpu.setBlend(BLEND_DEFAULT);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
glColor4f(1,1,0,0.5);
|
glColor4f(1,1,0,0.5);
|
||||||
|
|
||||||
|
@ -290,10 +289,7 @@ void Bone::renderCollision(const RenderState& rs) const
|
||||||
glTranslatef(-collide.x, -collide.y, 0);
|
glTranslatef(-collide.x, -collide.y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPopAttrib();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CollideQuad::renderCollision(rs);
|
CollideQuad::renderCollision(rs);
|
||||||
|
|
|
@ -261,13 +261,13 @@ void TTFText::onRender(const RenderState& rs) const
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glScalef(1, -1, 0);
|
glScalef(1, -1, 0);
|
||||||
glTranslatef(-hw, 0 + (i*-lineHeight), 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();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
RenderObject::lastTextureApplied = 0;
|
RenderObject::lastTextureApplied = 0;
|
||||||
|
rs.gpu.invalidateBlend();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue