KTXPlugin() { TextureContainer = new ITextureContainer[] { new CoreFileContainer() }; MipmapGenerators = new IMipmapGenerator[] { }; InternalPixelFormats = new IGLInteralPixelFormat[] { }; PixelFormats = new IGLPixelFormat[] { }; DataFormats = new IGLDataFormat[] { }; }
private void TransformTextureBack() { IGLDataFormat dataFormat = GetDataFormat(texture.glType); IGLPixelFormat pixelFormat = GetPixelFormat(texture.glFormat); IGLInteralPixelFormat internalPixelFormat = GetInternalPixelFormat(texture.glInternalFormat); CoreTexture tex = internalPixelFormat.ToCoreTexture(genericTexture, pixelFormat, dataFormat); if (tex != null) { texture = tex; } else { MessageBox.Show("Unable to convert image data", "Error while converting image data", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
CoreFormatsPlugin() { DataFormats = new IGLDataFormat[] { new CoreDataFormatBase(Values.GL_BYTE, 1, 1), new CoreDataFormatBase(Values.GL_UNSIGNED_BYTE, 1, 1), new CoreDataFormatBase(Values.GL_SHORT, 1, 2), new CoreDataFormatBase(Values.GL_UNSIGNED_SHORT, 1, 2), new CoreDataFormatBase(Values.GL_INT, 1, 4), new CoreDataFormatBase(Values.GL_UNSIGNED_INT, 1, 4), new CoreDataFormatBase(Values.GL_FLOAT, 1, 4), new CoreDataFormatBase(Values.GL_DOUBLE, 1, 8) }; PixelFormats = new IGLPixelFormat[] { new CorePixelFormatBase(Values.GL_RED, 1), new CorePixelFormatBase(Values.GL_RGB, 3), new CorePixelFormatBase(Values.GL_RGBA, 4), new CorePixelFormatSwapRG(Values.GL_BGR, 3), new CorePixelFormatSwapRG(Values.GL_BGRA, 4) }; InternalPixelFormats = new IGLInteralPixelFormat[] { new CoreInaternalPixelFormatBase(Values.GL_RED), new CoreInaternalPixelFormatBase(Values.GL_RGB), new CoreInaternalPixelFormatBase(Values.GL_R3_G3_B2), new CoreInaternalPixelFormatBase(Values.GL_RGB4), new CoreInaternalPixelFormatBase(Values.GL_RGB5), new CoreInaternalPixelFormatBase(Values.GL_RGB8), new CoreInaternalPixelFormatBase(Values.GL_RGB10), new CoreInaternalPixelFormatBase(Values.GL_RGB12), new CoreInaternalPixelFormatBase(Values.GL_RGB16), new CoreInaternalPixelFormatBase(Values.GL_RGBA), new CoreInaternalPixelFormatBase(Values.GL_RGBA2), new CoreInaternalPixelFormatBase(Values.GL_RGBA4), new CoreInaternalPixelFormatBase(Values.GL_RGB5_A1), new CoreInaternalPixelFormatBase(Values.GL_RGBA8), new CoreInaternalPixelFormatBase(Values.GL_RGB10_A2), new CoreInaternalPixelFormatBase(Values.GL_RGBA12), new CoreInaternalPixelFormatBase(Values.GL_RGBA16) }; MipmapGenerators = new IMipmapGenerator[] { }; TextureContainer = new ITextureContainer[] { }; }
private void UpdateGenericImage() { IGLDataFormat dataFormat = GetDataFormat(texture.glType); IGLPixelFormat pixelFormat = GetPixelFormat(texture.glFormat); IGLInteralPixelFormat internalPixelFormat = GetInternalPixelFormat(texture.glInternalFormat); genericTexture = null; if (internalPixelFormat != null) { genericTexture = internalPixelFormat.ToGenericImage(texture, pixelFormat, dataFormat); } if (genericTexture == null) { MessageBox.Show(this, "Unsupported format ( 0x" + texture.glType.ToString("X4") + ", 0x" + texture.glFormat.ToString("X4") + ", 0x" + texture.glInternalFormat.ToString("X4") + ")", "Unsupported Format", MessageBoxButtons.OK, MessageBoxIcon.Error); } }