diff --git a/src/graphics/gpuparticles.cpp b/src/graphics/gpuparticles.cpp index 63356312d..f33d9e0ab 100644 --- a/src/graphics/gpuparticles.cpp +++ b/src/graphics/gpuparticles.cpp @@ -415,9 +415,6 @@ void ParticleSystemProxy::setEmitter(scene::IParticleEmitter* emitter) return; has_height_map = false; flip = false; - // Pass a fake material type to force irrlicht to update its internal states on rendering - setMaterialType(irr_driver->getShader(ES_RAIN)); - setAutomaticCulling(0); count = emitter->getMaxParticlesPerSecond() * emitter->getMaxLifeTime() / 1000; switch (emitter->getType()) @@ -527,11 +524,6 @@ void ParticleSystemProxy::simulate() void ParticleSystemProxy::drawFlip() { - glDepthMask(GL_FALSE); - glDisable(GL_CULL_FACE); - glEnable(GL_BLEND); - - glBlendEquation(GL_FUNC_ADD); glBlendFunc(GL_SRC_ALPHA, GL_ONE); glUseProgram(ParticleShader::FlipParticleRender::Program); @@ -547,20 +539,10 @@ void ParticleSystemProxy::drawFlip() glBindVertexArray(current_rendering_flip_vao); glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, count); - - glBindVertexArray(0); - glBindBuffer(GL_ARRAY_BUFFER, 0); - glActiveTexture(GL_TEXTURE0); - glDisable(GL_BLEND); - } void ParticleSystemProxy::drawNotFlip() { - glDepthMask(GL_FALSE); - glDisable(GL_CULL_FACE); - glEnable(GL_BLEND); - if (m_alpha_additive) glBlendFunc(GL_SRC_ALPHA, GL_ONE); else @@ -579,12 +561,6 @@ void ParticleSystemProxy::drawNotFlip() glBindVertexArray(current_rendering_vao); glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, count); - - glBindVertexArray(0); - glBindBuffer(GL_ARRAY_BUFFER, 0); - glActiveTexture(GL_TEXTURE0); - glDisable(GL_BLEND); - } void ParticleSystemProxy::draw() @@ -603,10 +579,6 @@ void ParticleSystemProxy::render() { } simulate(); draw(); - // We need to force irrlicht to update its internal states - irr::video::IVideoDriver * const drv = irr_driver->getVideoDriver(); - drv->setMaterial(fakemat); - static_cast(drv)->setRenderStates3DMode(); } void ParticleSystemProxy::OnRegisterSceneNode() diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index fc3351291..52f1a2cd9 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -309,6 +309,10 @@ void IrrDriver::renderGLSL(float dt) PROFILER_PUSH_CPU_MARKER("- Particles", 0xFF, 0xFF, 0x00); m_renderpass = scene::ESNRP_CAMERA | scene::ESNRP_TRANSPARENT_EFFECT; + glDepthMask(GL_FALSE); + glDisable(GL_CULL_FACE); + glEnable(GL_BLEND); + glBlendEquation(GL_FUNC_ADD); m_scene_manager->drawAll(m_renderpass); PROFILER_POP_CPU_MARKER();