public ColorBuffer(FrameBuffer fb, InternalFormat fmt, int samples) : base(fb) { MakeCurrent(); OpenGL.glRenderbufferStorageMultisample(OpenGL.Const.GL_RENDERBUFFER, samples, (uint)fmt, fb.Width, fb.Height); OpenGL.glFramebufferRenderbuffer(OpenGL.Const.GL_FRAMEBUFFER, OpenGL.Const.GL_COLOR_ATTACHMENT0, OpenGL.Const.GL_RENDERBUFFER, handle); }
/// <summary> /// To be added. /// </summary> /// <param name="target"> /// To be added. /// </param> /// <param name="internalformat"> /// To be added. /// </param> /// <param name="offset"> /// To be added. /// </param> /// <param name="size"> /// To be added. /// </param> /// <param name="format"> /// To be added. /// </param> /// <param name="type"> /// To be added. /// </param> /// <param name="data"> /// To be added. /// This parameter's element count is computed from format and type. /// </param> public unsafe void ClearBufferSubData([Flow(FlowDirection.In)] BufferTargetARB target, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] int offset, [Flow(FlowDirection.In)] uint size, [Flow(FlowDirection.In)] PixelFormat format, [Flow(FlowDirection.In)] PixelType type, [Count(Computed = "format, type"), Flow(FlowDirection.In)] void *data) { // IntPtrOverloader ClearBufferSubData(target, internalformat, new IntPtr(offset), new UIntPtr(size), format, type, data); }
public abstract unsafe void ColorTable([Flow(FlowDirection.In)] ColorTableTarget target, [Flow(FlowDirection.In)] InternalFormat internalFormat, [Flow(FlowDirection.In)] uint width, [Flow(FlowDirection.In)] PixelFormat format, [Flow(FlowDirection.In)] PixelType type, [Count(Computed = "format, type, width"), Flow(FlowDirection.In)] void *table);
public abstract unsafe void CompressedTexImage3D([Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] int level, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint width, [Flow(FlowDirection.In)] uint height, [Flow(FlowDirection.In)] uint depth, [Flow(FlowDirection.In)] int border, [Flow(FlowDirection.In)] uint imageSize, [Count(Parameter = "imageSize"), Flow(FlowDirection.In)] void *data);
public partial void TexStorage3DMultisample([Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] uint samples, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint width, [Flow(FlowDirection.In)] uint height, [Flow(FlowDirection.In)] uint depth, [Flow(FlowDirection.In)] bool fixedsamplelocations);
public static void RenderbufferStorageMultisampleCoverageNV(RenderbufferTarget target, Int32 coverageSamples, Int32 colorSamples, InternalFormat internalformat, Int32 width, Int32 height) { Debug.Assert(Delegates.pglRenderbufferStorageMultisampleCoverageNV != null, "pglRenderbufferStorageMultisampleCoverageNV not implemented"); Delegates.pglRenderbufferStorageMultisampleCoverageNV((Int32)target, coverageSamples, colorSamples, (Int32)internalformat, width, height); LogCommand("glRenderbufferStorageMultisampleCoverageNV", null, target, coverageSamples, colorSamples, internalformat, width, height); DebugCheckErrors(null); }
public unsafe void GetInternalformatSample([Flow(FlowDirection.In)] NV target, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint samples, [Flow(FlowDirection.In)] InternalFormatPName pname, [Count(Parameter = "count"), Flow(FlowDirection.Out)] Span <int> @params) { // ImplicitCountSpanOverloader GetInternalformatSample(target, internalformat, samples, pname, (uint)@params.Length, out @params.GetPinnableReference()); }
public unsafe partial void GetInternalformatSample([Flow(FlowDirection.In)] NV target, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint samples, [Flow(FlowDirection.In)] InternalFormatPName pname, [Flow(FlowDirection.In)] uint count, [Count(Parameter = "count"), Flow(FlowDirection.Out)] int * @params);
public abstract unsafe void SeparableFilter2D([Flow(FlowDirection.In)] SeparableTargetEXT target, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint width, [Flow(FlowDirection.In)] uint height, [Flow(FlowDirection.In)] PixelFormat format, [Flow(FlowDirection.In)] PixelType type, [Count(Computed = "target, format, type, width"), Flow(FlowDirection.In)] void *row, [Count(Computed = "target, format, type, height"), Flow(FlowDirection.In)] void *column);
public abstract void CopyConvolutionFilter2D([Flow(FlowDirection.In)] ConvolutionTargetEXT target, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] int x, [Flow(FlowDirection.In)] int y, [Flow(FlowDirection.In)] uint width, [Flow(FlowDirection.In)] uint height);
public abstract void ConvolutionFilter2D <T0>([Flow(FlowDirection.In)] ConvolutionTargetEXT target, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint width, [Flow(FlowDirection.In)] uint height, [Flow(FlowDirection.In)] PixelFormat format, [Flow(FlowDirection.In)] PixelType type, [Count(Computed = "format, type, width, height"), Flow(FlowDirection.In)] ref T0 image) where T0 : unmanaged;
public abstract unsafe void ConvolutionFilter2D([Flow(FlowDirection.In)] ConvolutionTargetEXT target, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint width, [Flow(FlowDirection.In)] uint height, [Flow(FlowDirection.In)] PixelFormat format, [Flow(FlowDirection.In)] PixelType type, [Count(Computed = "format, type, width, height"), Flow(FlowDirection.In)] void *image);
public abstract unsafe void GetInternalformat([Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] InternalFormatPName pname, [Flow(FlowDirection.In)] uint count, [Count(Parameter = "count"), Flow(FlowDirection.Out)] int * @params);
public abstract void TexStorage3D([Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] uint levels, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint width, [Flow(FlowDirection.In)] uint height, [Flow(FlowDirection.In)] uint depth);
internal RenderBuffer(InternalFormat internalFormat, int samples, int width, int height) { this.renderbuffer = GL.GenRenderbuffer(); GL.BindRenderbuffer(RenderbufferType.Renderbuffer, renderbuffer); if (samples == 0) { GL.RenderbufferStorage(RenderbufferType.Renderbuffer, internalFormat, width, height); } else { GL.RenderbufferStorageMultisample(RenderbufferType.Renderbuffer, samples, internalFormat, width, height); } }
public abstract void TexBuffer([Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint buffer);
public abstract void SeparableFilter2D <T0, T1>([Flow(FlowDirection.In)] SeparableTargetEXT target, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint width, [Flow(FlowDirection.In)] uint height, [Flow(FlowDirection.In)] PixelFormat format, [Flow(FlowDirection.In)] PixelType type, [Count(Computed = "target, format, type, width"), Flow(FlowDirection.In)] ref T0 row, [Count(Computed = "target, format, type, height"), Flow(FlowDirection.In)] ref T1 column) where T0 : unmanaged where T1 : unmanaged;
public partial void GetInternalformatSample([Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint samples, [Flow(FlowDirection.In)] InternalFormatPName pname, [Flow(FlowDirection.In)] uint count, [Count(Parameter = "count"), Flow(FlowDirection.Out)] out int @params);
public void Create(long Key, byte[] Data, GalTexture Texture) { int Handle = GL.GenTexture(); TextureCache.AddOrUpdate(Key, new TCE(Handle, Texture), (uint)Data.Length); GL.BindTexture(TextureTarget.Texture2D, Handle); const int Level = 0; //TODO: Support mipmap textures. const int Border = 0; if (IsCompressedTextureFormat(Texture.Format)) { InternalFormat InternalFmt = OGLEnumConverter.GetCompressedTextureFormat(Texture.Format); GL.CompressedTexImage2D( TextureTarget.Texture2D, Level, InternalFmt, Texture.Width, Texture.Height, Border, Data.Length, Data); } else { if (Texture.Format >= GalTextureFormat.Astc2D4x4) { int TextureBlockWidth = GetAstcBlockWidth(Texture.Format); int TextureBlockHeight = GetAstcBlockHeight(Texture.Format); Data = ASTCDecoder.DecodeToRGBA8888( Data, TextureBlockWidth, TextureBlockHeight, 1, Texture.Width, Texture.Height, 1); Texture.Format = GalTextureFormat.A8B8G8R8; } const PixelInternalFormat InternalFmt = PixelInternalFormat.Rgba; (PixelFormat Format, PixelType Type) = OGLEnumConverter.GetTextureFormat(Texture.Format); GL.TexImage2D( TextureTarget.Texture2D, Level, InternalFmt, Texture.Width, Texture.Height, Border, Format, Type, Data); } int SwizzleR = (int)OGLEnumConverter.GetTextureSwizzle(Texture.XSource); int SwizzleG = (int)OGLEnumConverter.GetTextureSwizzle(Texture.YSource); int SwizzleB = (int)OGLEnumConverter.GetTextureSwizzle(Texture.ZSource); int SwizzleA = (int)OGLEnumConverter.GetTextureSwizzle(Texture.WSource); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureSwizzleR, SwizzleR); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureSwizzleG, SwizzleG); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureSwizzleB, SwizzleB); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureSwizzleA, SwizzleA); }
public partial void TexBufferRange([Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint buffer, [Flow(FlowDirection.In)] nint offset, [Flow(FlowDirection.In)] nuint size);
public abstract void TextureView([Flow(FlowDirection.In)] uint texture, [Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] uint origtexture, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint minlevel, [Flow(FlowDirection.In)] uint numlevels, [Flow(FlowDirection.In)] uint minlayer, [Flow(FlowDirection.In)] uint numlayers);
public static void BindImageTextureEXT(UInt32 index, UInt32 texture, Int32 level, bool layered, Int32 layer, BufferAccess access, InternalFormat format) { Debug.Assert(Delegates.pglBindImageTextureEXT != null, "pglBindImageTextureEXT not implemented"); Delegates.pglBindImageTextureEXT(index, texture, level, layered, layer, (Int32)access, (Int32)format); LogCommand("glBindImageTextureEXT", null, index, texture, level, layered, layer, access, format); DebugCheckErrors(null); }
public static void RenderbufferStorageMultisampleAPPLE(RenderbufferTarget target, int samples, InternalFormat internalformat, int width, int height) { Debug.Assert(Delegates.pglRenderbufferStorageMultisampleAPPLE != null, "pglRenderbufferStorageMultisampleAPPLE not implemented"); Delegates.pglRenderbufferStorageMultisampleAPPLE((int)target, samples, (int)internalformat, width, height); LogCommand("glRenderbufferStorageMultisampleAPPLE", null, target, samples, internalformat, width, height); DebugCheckErrors(null); }
public partial void RenderbufferStorageMultisample([Flow(FlowDirection.In)] RenderbufferTarget target, [Flow(FlowDirection.In)] uint samples, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint width, [Flow(FlowDirection.In)] uint height);
public static unsafe void GetInternalformat(this ArbInternalformatQuery2 thisApi, [Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] InternalFormatPName pname, [Flow(FlowDirection.In)] uint count, [Count(Parameter = "count"), Flow(FlowDirection.Out)] Span <long> @params) { // SpanOverloader thisApi.GetInternalformat(target, internalformat, pname, count, out @params.GetPinnableReference()); }
public abstract void CompressedTexImage3D <T0>([Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] int level, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint width, [Flow(FlowDirection.In)] uint height, [Flow(FlowDirection.In)] uint depth, [Flow(FlowDirection.In)] int border, [Flow(FlowDirection.In)] uint imageSize, [Count(Parameter = "imageSize"), Flow(FlowDirection.In)] Span <T0> data) where T0 : unmanaged;
public static unsafe void CompressedTexSubImage1D <T0>(this ArbTextureCompression thisApi, [Flow(FlowDirection.In)] ARB target, [Flow(FlowDirection.In)] int level, [Flow(FlowDirection.In)] int xoffset, [Flow(FlowDirection.In)] uint width, [Flow(FlowDirection.In)] InternalFormat format, [Flow(FlowDirection.In)] uint imageSize, [Count(Parameter = "imageSize"), Flow(FlowDirection.In)] ReadOnlySpan <T0> data) where T0 : unmanaged { // SpanOverloader thisApi.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, in data.GetPinnableReference()); }
public abstract void ColorTable <T0>([Flow(FlowDirection.In)] ColorTableTarget target, [Flow(FlowDirection.In)] InternalFormat internalFormat, [Flow(FlowDirection.In)] uint width, [Flow(FlowDirection.In)] PixelFormat format, [Flow(FlowDirection.In)] PixelType type, [Count(Computed = "format, type, width"), Flow(FlowDirection.In)] ref T0 table) where T0 : unmanaged;
public abstract void RenderbufferStorage([Flow(FlowDirection.In)] RenderbufferTarget target, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint width, [Flow(FlowDirection.In)] uint height);
public void Create(long key, byte[] data, GalImage image) { int handle = GL.GenTexture(); TextureTarget target = ImageUtils.GetTextureTarget(image.TextureTarget); GL.BindTexture(target, handle); const int level = 0; //TODO: Support mipmap textures. const int border = 0; _textureCache.AddOrUpdate(key, new ImageHandler(handle, image), (uint)data.Length); if (ImageUtils.IsCompressed(image.Format) && !IsAstc(image.Format)) { InternalFormat internalFmt = OglEnumConverter.GetCompressedImageFormat(image.Format); switch (target) { case TextureTarget.Texture1D: GL.CompressedTexImage1D( target, level, internalFmt, image.Width, border, data.Length, data); break; case TextureTarget.Texture2D: GL.CompressedTexImage2D( target, level, internalFmt, image.Width, image.Height, border, data.Length, data); break; case TextureTarget.Texture3D: GL.CompressedTexImage3D( target, level, internalFmt, image.Width, image.Height, image.Depth, border, data.Length, data); break; // Cube map arrays are just 2D texture arrays with 6 entries // per cube map so we can handle them in the same way case TextureTarget.TextureCubeMapArray: case TextureTarget.Texture2DArray: GL.CompressedTexImage3D( target, level, internalFmt, image.Width, image.Height, image.LayerCount, border, data.Length, data); break; case TextureTarget.TextureCubeMap: Span <byte> array = new Span <byte>(data); int faceSize = ImageUtils.GetSize(image) / 6; for (int Face = 0; Face < 6; Face++) { GL.CompressedTexImage2D( TextureTarget.TextureCubeMapPositiveX + Face, level, internalFmt, image.Width, image.Height, border, faceSize, array.Slice(Face * faceSize, faceSize).ToArray()); } break; default: throw new NotImplementedException($"Unsupported texture target type: {target}"); } } else { //TODO: Use KHR_texture_compression_astc_hdr when available if (IsAstc(image.Format)) { int textureBlockWidth = ImageUtils.GetBlockWidth(image.Format); int textureBlockHeight = ImageUtils.GetBlockHeight(image.Format); int textureBlockDepth = ImageUtils.GetBlockDepth(image.Format); data = AstcDecoder.DecodeToRgba8888( data, textureBlockWidth, textureBlockHeight, textureBlockDepth, image.Width, image.Height, image.Depth); image.Format = GalImageFormat.Rgba8 | (image.Format & GalImageFormat.TypeMask); } (PixelInternalFormat internalFmt, PixelFormat format, PixelType type) = OglEnumConverter.GetImageFormat(image.Format); switch (target) { case TextureTarget.Texture1D: GL.TexImage1D( target, level, internalFmt, image.Width, border, format, type, data); break; case TextureTarget.Texture2D: GL.TexImage2D( target, level, internalFmt, image.Width, image.Height, border, format, type, data); break; case TextureTarget.Texture3D: GL.TexImage3D( target, level, internalFmt, image.Width, image.Height, image.Depth, border, format, type, data); break; // Cube map arrays are just 2D texture arrays with 6 entries // per cube map so we can handle them in the same way case TextureTarget.TextureCubeMapArray: case TextureTarget.Texture2DArray: GL.TexImage3D( target, level, internalFmt, image.Width, image.Height, image.LayerCount, border, format, type, data); break; case TextureTarget.TextureCubeMap: Span <byte> array = new Span <byte>(data); int faceSize = ImageUtils.GetSize(image) / 6; for (int face = 0; face < 6; face++) { GL.TexImage2D( TextureTarget.TextureCubeMapPositiveX + face, level, internalFmt, image.Width, image.Height, border, format, type, array.Slice(face * faceSize, faceSize).ToArray()); } break; default: throw new NotImplementedException($"Unsupported texture target type: {target}"); } } }
public static unsafe void CompressedTexImage3D <T0>(this ArbTextureCompression thisApi, [Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] int level, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint width, [Flow(FlowDirection.In)] uint height, [Flow(FlowDirection.In)] uint depth, [Flow(FlowDirection.In)] int border, [Flow(FlowDirection.In)] uint imageSize, [Count(Parameter = "imageSize"), Flow(FlowDirection.In)] ReadOnlySpan <T0> data) where T0 : unmanaged { // SpanOverloader thisApi.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, in data.GetPinnableReference()); }
public static long SupportedSamples(InternalFormat internalFormat) { while (GL.GetError() != 0) { } uint rb = GL.GenRenderbuffer(); GL.BindRenderbuffer(RenderbufferType.Renderbuffer, rb); if (GL.GetError() != 0) { GL.BindRenderbuffer(RenderbufferType.Renderbuffer, 0); GL.DeleteRenderbuffer(rb); return 0; } long samples = 0; for (int i = 0; i <= 32; ++i) { GL.RenderbufferStorageMultisample(RenderbufferType.Renderbuffer, i, internalFormat, 4, 4); if (GL.GetError() == 0) { int param; GL.GetRenderbufferParameter(RenderbufferType.Renderbuffer, RenderbufferParameter.Samples, out param); if (i == param) { samples |= (long)1 << i; } } } GL.BindRenderbuffer(RenderbufferType.Renderbuffer, 0); GL.DeleteRenderbuffer(rb); return samples; }
public partial void BindImageTexture([Flow(FlowDirection.In)] uint unit, [Flow(FlowDirection.In)] uint texture, [Flow(FlowDirection.In)] int level, [Flow(FlowDirection.In)] Boolean layered, [Flow(FlowDirection.In)] int layer, [Flow(FlowDirection.In)] BufferAccessARB access, [Flow(FlowDirection.In)] InternalFormat format);