public override void open(String pathname, MImageFileInfo info) { if (info != null) { info.width = 512; info.height = 512; info.channels = 3; info.pixelType = MImage.MPixelType.kFloat; // Only necessary if your format defines a native // hardware texture loader info.hardwareType = MImageFileInfo.MHwTextureType.kHwTexture2D; } }
public override void open(String pathname, MImageFileInfo info) { if(info != null) { info.width = 512; info.height = 512; info.channels = 3; info.pixelType = MImage.MPixelType.kFloat; // Only necessary if your format defines a native // hardware texture loader info.hardwareType = MImageFileInfo.MHwTextureType.kHwTexture2D; } }
public unsafe override void glLoad(MImageFileInfo info, uint imageNumber) { unsafe { // Create a floating point image uint w = info.width; uint h = info.height; float[] csPixels = new float[ w * h * 3]; IntPtr ptr = new IntPtr(); Marshal.Copy(ptr, csPixels, 0, csPixels.Length); float* pixels = (float*)ptr.ToPointer(); populateTestImage(pixels, w, h); // Now load it into OpenGL as a floating point image glTexImage2D(GL_TEXTURE_2D, 0, (int)GL_RGB, (int)w, (int)h, 0, GL_RGB, GL_FLOAT, pixels); } return; }
unsafe public override void glLoad(MImageFileInfo info, uint imageNumber) { unsafe { // Create a floating point image uint w = info.width; uint h = info.height; float[] csPixels = new float[w * h * 3]; IntPtr ptr = new IntPtr(); Marshal.Copy(ptr, csPixels, 0, csPixels.Length); float *pixels = (float *)ptr.ToPointer(); populateTestImage(pixels, w, h); // Now load it into OpenGL as a floating point image glTexImage2D(GL_TEXTURE_2D, 0, (int)GL_RGB, (int)w, (int)h, 0, GL_RGB, GL_FLOAT, pixels); } return; }