public void SetAnimated(int ID, double rate, string[] textures, int tid) { AnimatedTexture anim = new AnimatedTexture() { Block = this, Level = ID, Time = 0, Rate = rate, Textures = new int[textures.Length], FBOs = new int[textures.Length], OwnsTheTextures = false }; for (int i = 0; i < textures.Length; i++) { anim.Textures[i] = TEngine.GetTexture(textures[i], TWidth).Original_InternalID; anim.FBOs[i] = GL.GenFramebuffer(); GL.BindFramebuffer(FramebufferTarget.Framebuffer, anim.FBOs[i]); GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, TextureTarget.Texture2D, anim.Textures[i], 0); } GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); anim.Current = 0; anim.FBO = GL.GenFramebuffer(); GL.BindFramebuffer(FramebufferTarget.Framebuffer, anim.FBO); GL.FramebufferTextureLayer(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, tid, 0, ID); GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); Anims.Add(anim); }
public void SetAnimated(int ID, double rate, Bitmap[] textures, int tid) { AnimatedTexture anim = new AnimatedTexture() { Block = this, Level = ID, Time = 0, Rate = rate, Textures = new int[textures.Length], FBOs = new int[textures.Length], OwnsTheTextures = true }; for (int i = 0; i < textures.Length; i++) { anim.Textures[i] = GL.GenTexture(); GL.BindTexture(TextureTarget.Texture2D, anim.Textures[i]); TEngine.LockBitmapToTexture(textures[i], false); GL.BindTexture(TextureTarget.Texture2D, 0); anim.FBOs[i] = GL.GenFramebuffer(); GL.BindFramebuffer(FramebufferTarget.Framebuffer, anim.FBOs[i]); GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, TextureTarget.Texture2D, anim.Textures[i], 0); } GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); anim.Current = 0; anim.FBO = GL.GenFramebuffer(); GL.BindFramebuffer(FramebufferTarget.Framebuffer, anim.FBO); GL.FramebufferTextureLayer(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, tid, 0, ID); GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); Anims.Add(anim); }
public void SetAnimated(int ID, double rate, string[] textures, int tid) { AnimatedTexture anim = new AnimatedTexture(); anim.Block = this; anim.Level = ID; anim.Time = 0; anim.Rate = rate; anim.Textures = new int[textures.Length]; anim.FBOs = new int[textures.Length]; anim.OwnsTheTextures = false; for (int i = 0; i < textures.Length; i++) { anim.Textures[i] = TEngine.GetTexture(textures[i], TWidth).Original_InternalID; anim.FBOs[i] = GL.GenFramebuffer(); GL.BindFramebuffer(FramebufferTarget.Framebuffer, anim.FBOs[i]); GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, TextureTarget.Texture2D, anim.Textures[i], 0); } GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); anim.Current = 0; anim.FBO = GL.GenFramebuffer(); GL.BindFramebuffer(FramebufferTarget.Framebuffer, anim.FBO); GL.FramebufferTextureLayer(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, tid, 0, ID); GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); Anims.Add(anim); }
public void SetAnimated(int ID, double rate, Bitmap[] textures, int tid) { AnimatedTexture anim = new AnimatedTexture(); anim.Block = this; anim.Level = ID; anim.Time = 0; anim.Rate = rate; anim.Textures = new int[textures.Length]; anim.FBOs = new int[textures.Length]; anim.OwnsTheTextures = true; for (int i = 0; i < textures.Length; i++) { anim.Textures[i] = GL.GenTexture(); GL.BindTexture(TextureTarget.Texture2D, anim.Textures[i]); TEngine.LockBitmapToTexture(textures[i], false); GL.BindTexture(TextureTarget.Texture2D, 0); anim.FBOs[i] = GL.GenFramebuffer(); GL.BindFramebuffer(FramebufferTarget.Framebuffer, anim.FBOs[i]); GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, TextureTarget.Texture2D, anim.Textures[i], 0); } GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); anim.Current = 0; anim.FBO = GL.GenFramebuffer(); GL.BindFramebuffer(FramebufferTarget.Framebuffer, anim.FBO); GL.FramebufferTextureLayer(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, tid, 0, ID); GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); Anims.Add(anim); }