public bool Init(Texture2D tex) { if (tex == null || !tex.Created) return false; Scaling = new Vector2(1.0f, 1.0f); AbsolutePosition = new Vector2(0.0f, 0.0f); RelativePosition = new Vector2(0.0f, 0.0f); Rotation = 0; RotationPoint = new Vector2(0.0f, 0.0f); MyTexture = tex; MyTexture.SetUseCount(MyTexture.InternalUseCount + 1); return true; }
public void AddTexture(Texture2D tex, AttachmentUsage au) { if(!m_PrepareMode) GL.BindFramebuffer(FramebufferTarget.Framebuffer, ID); DeleteTexture(au, true); if((tex != null) && (tex.Created)) { tex.SetUseCount(tex.InternalUseCount + 1); m_Textures.Add(new TextureAttachment(tex, au)); GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, (FramebufferAttachment)au, TextureTarget.Texture2D, tex.ID, 0); } if(!m_PrepareMode) GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); }