Hi, I’m trying to render a array image on a cube,
Here is the result and the real image that i would like to render it.
[ATTACH=CONFIG]763[/ATTACH][ATTACH=CONFIG]764[/ATTACH]
For example, i have a black and white array image, what is the problem makes my image like this??
Anyone could help me?
Thanks
double[] slice = new double[]
{
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,1,1,1,0,0,
0,0,1,1,1,0,0,
0,0,1,1,1,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0,0
}
gl.Enable(OpenGL.GL_TEXTURE_2D);
gl.ShadeModel(OpenGL.GL_SMOOTH);
gl.Enable(OpenGL.GL_DEPTH_TEST);
gl.DepthFunc(OpenGL.GL_LEQUAL);
gl.Hint(OpenGL.GL_PERSPECTIVE_CORRECTION_HINT, OpenGL.GL_NICEST);
uint[] texture = new uint[1];
gl.GenTextures(1, texture);
gl.BindTexture(OpenGL.GL_TEXTURE_2D, texture[0]);
Bitmap texslice = new Bitmap(7, 7 ,PixelFormat.Format24bppRgb);
// Create the converter to create a Bitmap from the array
ArrayToImage conv = new ArrayToImage(7, 7);
// Declare an image and store the pixels on it
conv.Convert(slice, out texslice);
gl.TexImage2D(OpenGL.GL_TEXTURE_2D, 0, 1, texslice.Height, texslice.Width, 0, OpenGL.GL_LUMINANCE, OpenGL.GL_UNSIGNED_BYTE,
texslice.LockBits(new Rectangle(0, 0, texslice.Width, texslice.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb).Scan0);
gl.TexParameter(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MIN_FILTER, OpenGL.GL_LINEAR); // Linear Filtering
gl.TexParameter(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MAG_FILTER, OpenGL.GL_LINEAR); // Linear Filtering
gl.TexParameter(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_WRAP_S, OpenGL.GL_CLAMP_TO_EDGE);
gl.TexParameter(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_WRAP_T, OpenGL.GL_CLAMP_TO_EDGE);