From e4bb5440794206afd8b3530fe627b5316483a55c Mon Sep 17 00:00:00 2001 From: cutealien Date: Thu, 27 Apr 2023 20:02:09 +0000 Subject: [PATCH] Support startUseProgram in COGLES2MaterialRenderer Not tested much, but seems to be easier in es2 than in normal OpenGL Probably because it doesn't have to care about switching back to fixed function pipeline git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6478 dfc29bdd-3216-0410-991c-e03cc46cb475 --- source/Irrlicht/COGLES2Driver.cpp | 3 +++ source/Irrlicht/COGLES2MaterialRenderer.cpp | 5 +++++ source/Irrlicht/COGLES2MaterialRenderer.h | 2 ++ 3 files changed, 10 insertions(+) diff --git a/source/Irrlicht/COGLES2Driver.cpp b/source/Irrlicht/COGLES2Driver.cpp index cbe951c..fa66ce3 100644 --- a/source/Irrlicht/COGLES2Driver.cpp +++ b/source/Irrlicht/COGLES2Driver.cpp @@ -2375,7 +2375,10 @@ COGLES2Driver::~COGLES2Driver() r->drop(); if (callback && nr >= 0) + { + r->startUseProgram(); callback->OnCreate(r, userData); + } return nr; } diff --git a/source/Irrlicht/COGLES2MaterialRenderer.cpp b/source/Irrlicht/COGLES2MaterialRenderer.cpp index 628df02..cfa1032 100644 --- a/source/Irrlicht/COGLES2MaterialRenderer.cpp +++ b/source/Irrlicht/COGLES2MaterialRenderer.cpp @@ -348,6 +348,11 @@ void COGLES2MaterialRenderer::setBasicRenderStates(const SMaterial& material, Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); } +void COGLES2MaterialRenderer::startUseProgram() +{ + Driver->getCacheHandler()->setProgram(Program); +} + s32 COGLES2MaterialRenderer::getVertexShaderConstantID(const c8* name) { return getPixelShaderConstantID(name); diff --git a/source/Irrlicht/COGLES2MaterialRenderer.h b/source/Irrlicht/COGLES2MaterialRenderer.h index 490b43b..b85ad4b 100644 --- a/source/Irrlicht/COGLES2MaterialRenderer.h +++ b/source/Irrlicht/COGLES2MaterialRenderer.h @@ -55,6 +55,8 @@ public: virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) IRR_OVERRIDE; + virtual void startUseProgram() IRR_OVERRIDE; + virtual s32 getVertexShaderConstantID(const c8* name) IRR_OVERRIDE; virtual s32 getPixelShaderConstantID(const c8* name) IRR_OVERRIDE; virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) IRR_OVERRIDE;