public FramebufferRL(int width, int height) { viewport = new RenderStack.Math.Viewport(width, height); RL.GenFramebuffers(1, out framebufferObject); GhostManager.Gen(); RL.BindFramebuffer(FramebufferTarget.Framebuffer, framebufferObject); }
private void Initialize() { RL.GenTextures(1, out textureObject); Debug.WriteLine("GenTextures: " + textureObject.ToString()); GhostManager.Gen(); SetSize(); }
public void Dispose() { if (shaderObject != 0) { GL.DeleteShader(shaderObject); GhostManager.Delete(); shaderObject = 0; } }
public void Dispose() { if (framebufferObject != 0) { GL.DeleteFramebuffers(1, ref framebufferObject); GhostManager.Delete(); framebufferObject = 0; } }
public void Dispose() { if (shaderObject != System.IntPtr.Zero) { RL.DeleteShader(shaderObject); GhostManager.Delete(); shaderObject = System.IntPtr.Zero; } }
public void Dispose() { if (framebufferObject != IntPtr.Zero) { RL.DeleteFramebuffers(ref framebufferObject); GhostManager.Delete(); framebufferObject = IntPtr.Zero; } }
public void Dispose() { if (renderBufferObject != 0) { GL.DeleteRenderbuffers(1, ref renderBufferObject); GhostManager.Delete(); renderBufferObject = 0; } }
public void Dispose() { if (bufferObject != IntPtr.Zero) { RL.DeleteBuffers(ref bufferObject); GhostManager.Delete(); bufferObject = IntPtr.Zero; } }
public void Dispose() { if (bufferObject != UInt32.MaxValue) { GL.DeleteBuffers(1, ref bufferObject); GhostManager.Delete(); bufferObject = UInt32.MaxValue; } }
public void Dispose() { if (textureObject != IntPtr.Zero) { RL.DeleteTextures(ref textureObject); //Debug.WriteLine("DeleteTexture: " + textureObject.ToString()); GhostManager.Delete(); textureObject = IntPtr.Zero; } }
public RenderBufferGL3(int width, int height, RenderbufferStorage internalFormat, int sampleCount) { viewport = new RenderStack.Math.Viewport(width, height); this.internalFormat = internalFormat; this.sampleCount = sampleCount; GL.GenRenderbuffers(1, out renderBufferObject); GhostManager.Gen(); //System.Diagnostics.Debug.WriteLine("GenRenderbuffer " + renderBufferObject); SetSize();
public void Dispose() { if (textureObject != 0) { GL.DeleteTexture(textureObject); //Debug.WriteLine("DeleteTexture: " + textureObject.ToString()); GhostManager.Delete(); textureObject = 0; } }
public void Dispose() { if (programObject != System.IntPtr.Zero) { #if DEBUG_PROGRAM Trace.WriteLine("RL.DeleteProgram(" + programObject + ")"); #endif RL.DeleteProgram(programObject); GhostManager.Delete(); programObject = System.IntPtr.Zero; } }
public void Dispose() { if (programObject != 0) { #if DEBUG_PROGRAM Trace.WriteLine("GL.DeleteProgram(" + programObject + ")"); #endif GL.DeleteProgram(programObject); GhostManager.Delete(); programObject = 0; } }
public void RLGen() { RL.GenBuffers(1, out bufferObject); if (bufferObject == IntPtr.Zero) { throw new System.InvalidOperationException(); } #if DEBUG_BUFFER_OBJECTS System.Diagnostics.Debug.WriteLine("RL.GenBuffers(1) = " + bufferObject.ToString("X")); #endif GhostManager.Gen(); }
public void Dispose() { if (!disposed) { if (shaderObject != IntPtr.Zero) { GhostManager.Add(new ShaderRLGhost(shaderObject)); shaderObject = IntPtr.Zero; } GC.SuppressFinalize(this); disposed = true; } }
public void Dispose() { if (!disposed) { if (shaderObject != 0) { GhostManager.Add(new ShaderGL3Ghost(shaderObject)); shaderObject = 0; } GC.SuppressFinalize(this); disposed = true; } }
public void Dispose() { if (!disposed) { if (bufferObject != UInt32.MaxValue) { GhostManager.Add(new BufferGhost(bufferObject)); bufferObject = UInt32.MaxValue; } GC.SuppressFinalize(this); disposed = true; } }
public void Dispose() { if (!disposed) { //System.Diagnostics.Debug.WriteLine("DeleteRenderbuffers " + renderBufferObject); if (renderBufferObject != 0) { GhostManager.Add(new RenderBufferGhost(renderBufferObject)); renderBufferObject = 0; } GC.SuppressFinalize(this); disposed = true; } }
public void Dispose() { if (!disposed) { if (textureObject != IntPtr.Zero) { GhostManager.Add(new TextureRLGhost(textureObject)); Debug.WriteLine("GhostTexture: " + textureObject.ToString()); textureObject = IntPtr.Zero; } GC.SuppressFinalize(this); disposed = true; } }
protected void Gen() { programObject = GL.CreateProgram(); GhostManager.Gen(); //GL.BindAttribLocation(this.programObject, 0, "_position"); foreach (var mapping in AttributeMappings.Global.Mappings) { GL.BindAttribLocation(ProgramObject, mapping.Slot, mapping.Name); } if (RenderStack.Graphics.Configuration.glVersion >= 300) { #if DEBUG_PROGRAM Trace.WriteLine("Binding Frag Data Locations " + Name + " " + programObject); #endif GL.BindFragDataLocation(this.programObject, 0, "out_color"); GL.BindFragDataLocation(this.programObject, 0, "out0"); GL.BindFragDataLocation(this.programObject, 1, "out1"); } }
public void GLGen() { if (OpenTK.Graphics.GraphicsContext.CurrentContext != null) { GL.GenBuffers(1, out bufferObject); if (bufferObject == 0) { throw new System.InvalidOperationException(); } #if DEBUG_BUFFER_OBJECTS System.Diagnostics.Debug.WriteLine("GL.GenBuffers(1) = " + bufferObject); #endif GhostManager.Gen(); } else { System.Diagnostics.Trace.WriteLine("GL.GenBuffers(1) skipped - OpenTK.Graphics.GraphicsContext.CurrentContext == null"); } }
public void Dispose() { if (!disposed) { foreach (var shader in shaders) { shader.Dispose(); } shaders.Clear(); if (programObject != System.IntPtr.Zero) { #if DEBUG_PROGRAM Trace.WriteLine("Ghosting program " + Name + " " + programObject); #endif GhostManager.Add(new ProgramRLGhost(programObject)); programObject = System.IntPtr.Zero; } GC.SuppressFinalize(this); disposed = true; } }
public void Dispose() { if (!disposed) { foreach (var kvp in textures) { kvp.Value.Dispose(); } foreach (var kvp in renderbuffers) { kvp.Value.Dispose(); } if (framebufferObject != IntPtr.Zero) { GhostManager.Add(new FramebufferRLGhost(framebufferObject)); framebufferObject = IntPtr.Zero; } System.GC.SuppressFinalize(this); disposed = true; } }
protected void Gen() { programObject = RL.CreateProgram(); GhostManager.Gen(); }
public ShaderRL(ShaderType type) { shaderObject = RL.CreateShader(type); GhostManager.Gen(); this.type = type; }
public TextureRL(Image image, bool generateMipmaps) { size = new Viewport(image.Width, image.Height); bindTarget = TextureTarget.Texture2D; texImageTarget = TextureTarget.Texture2D; format = PixelFormat.Rgba; internalFormat = PixelInternalFormat.Rgba; textureObject = IntPtr.Zero; RL.GenTextures(1, out textureObject); Debug.WriteLine("GenTextures: " + textureObject.ToString()); GhostManager.Gen(); RL.BindTexture(bindTarget, textureObject); int level = 0; int border = 0; if (generateMipmaps) { image.GenerateMipmaps(); hasMipmaps = true; } for (;;) { if (image.Mipmaps.ContainsKey(level) == false || image.Mipmaps[level] == null) { Debug.WriteLine("Warning: No mipmaps"); hasMipmaps = false; break; } GCHandle ptr = GCHandle.Alloc( image.Mipmaps[level].Pixels, GCHandleType.Pinned ); try { RL.TexImage2D( texImageTarget, level, internalFormat, image.Mipmaps[level].Width, image.Mipmaps[level].Height, border, format, PixelType.UnsignedByte, (System.IntPtr)ptr.AddrOfPinnedObject() ); } finally { ptr.Free(); } if ( (image.Mipmaps[level].Width == 1) && (image.Mipmaps[level].Height == 1) ) { break; } ++level; } }
public TextureGL(Image[] images) { if (images.Length != 6) { System.Diagnostics.Trace.TraceError("Error: Need 6 images for cube maps"); throw new ArgumentException(); } size = new Viewport(images[0].Width, images[0].Height); BindTarget = TextureTarget.TextureCubeMap; TexImageTarget = TextureTarget.TextureCubeMapPositiveX; Format = PixelFormat.Rgba; InternalFormat = PixelInternalFormat.Rgba; textureObject = 0; GL.GenTextures(1, out textureObject); Debug.WriteLine("GenTextures: " + textureObject.ToString()); GhostManager.Gen(); GL.BindTexture(BindTarget, textureObject); int border = 0; for (int face = 0; face < 6; ++face) { int level = 0; // TODO USE nvtt right for cube textures!!! images[face].GenerateMipmaps(); hasMipmaps = true; for (;;) { if ( (images[face].Mipmaps.ContainsKey(level) == false) || (images[face].Mipmaps[level] == null) ) { Debug.WriteLine("No mipmaps"); hasMipmaps = false; break; } GCHandle ptr = GCHandle.Alloc( images[face].Mipmaps[level].Pixels, GCHandleType.Pinned ); try { GL.TexImage2D( TextureTarget.TextureCubeMapPositiveX + face, level, InternalFormat, images[face].Mipmaps[level].Width, images[face].Mipmaps[level].Height, border, Format, PixelType.UnsignedByte, (System.IntPtr)ptr.AddrOfPinnedObject() ); } finally { ptr.Free(); } if ( (images[face].Mipmaps[level].Width == 1) && (images[face].Mipmaps[level].Height == 1) ) { break; } ++level; } } }