public Smaa() { this.area_tex_unit = GLTextureUnit.Create().SetTexture(GLTexture.Create().SetFormat(TextureFormat.RG).SetSize(AREATEX_WIDTH, AREATEX_HEIGHT).SetData(SMAA_AREA_RAW)).SetWrap(GLWrap.ClampToEdge).SetFiltering(GLScaleFilter.Linear); this.search_tex_unit = GLTextureUnit.Create().SetTexture(GLTexture.Create().SetFormat(TextureFormat.R).SetSize(SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT).SetData(SMAA_SEARCH_RAW)).SetWrap(GLWrap.ClampToEdge).SetFiltering(GLScaleFilter.Nearest); CommonHeader = @" #version 410 compatibility #define SMAA_PIXEL_SIZE u_pixelSize.xy #define SMAA_PRESET_ULTRA 1 #define SMAA_GLSL_4 1 //#define SMAA_PREDICATION 0 #define SMAA_PREDICATION 1 #define attribute in "; VertexHeader = CommonHeader + "\n" + "#define SMAA_ONLY_COMPILE_VS 1" + "\n" + @" uniform vec4 u_pixelSize; attribute vec4 a_position; attribute vec4 a_texcoords; " + SMAA_H + "\n"; FragmentHeader = CommonHeader + "\n" + "#define SMAA_ONLY_COMPILE_PS 1" + "\n" + @" uniform vec4 u_pixelSize; " + "\n" + SMAA_H; }
public void Set(GLTextureUnit glTextureUnit) { if (!CheckValid()) { return; } glTextureUnit.MakeCurrent(); if (ValueType != GLValueType.GL_SAMPLER_2D) { throw(new Exception($"Trying to bind a TextureUnit to something not a Sampler2D : {ValueType}")); } Set(glTextureUnit.Index); }