public void BindTexture(string nameInShader, Func <Texture> lambda) { BoundTexture attribute = new BoundTexture(); attribute.nameInShader = nameInShader; attribute.lambda = lambda; bool replaced = false; int id = 0; foreach (BoundTexture ba in boundTextureList) { if (ba.nameInShader == nameInShader) { boundTextureList[id] = attribute; //DebugThis( ba.nameInShader + " is being rebound" ); replaced = true; break; } id++; } if (replaced == false) { boundTextureList.Add(attribute); } }
public void BindTexture(Texture texture, GLEnum attachment = GLEnum.ColorAttachment0, GLEnum target = GLEnum.Texture2D, bool dispose = true) { Use(); if (dispose && createdTexture && BoundTexture != null) { createdTexture = false; BoundTexture.Dispose(); } BoundTexture = texture; gl.FramebufferTexture2D(GLEnum.Framebuffer, attachment, target, texture != null ? texture.ID : 0, 0); }
public override void Dispose() { if (createdTexture) { BoundTexture.Dispose(); } if (createdRenderBuffer) { BoundRenderBuffer.Dispose(); } gl.DeleteFramebuffer(ID); }