Original Post
Hi, I am having a rather strange problem, and I am hoping someone here might have some insights (or have had this problem in the past).
My issue is that when in the default texture name (0) GL.TexImage2D works perfectly, but if I try to create the texture with any other name (using GL.BindTexture) the texture is created but with nonsense data in it.
This code works perfectly, and I can see the texture in gDEbugger:
This code results in a texture that is the correct dimensions and same format, but with repetitive nonsense data in it:
Note that it doesn't matter if the id given to BindTexture is generated using GenTexture or if I just use a random number (like 5 in this example). I am certain this is running in a valid (and existent) GL context. Since this is GL 3.2 code, I do not call GL.Enable(GL_TEXTURE2D); (this just results with an INVALID_ENUM error).
I have scoured this forum and of course googled it, but couldn't find anyone else having this problem.
EDIT: One other thing I should mention is that I can switch the texture unit just fine (using GL.ActiveTexture), but it is still corrupt if the texture id is nonzero.
[Edited by - Retro_Alt on July 29, 2010 5:20:14 PM]
My issue is that when in the default texture name (0) GL.TexImage2D works perfectly, but if I try to create the texture with any other name (using GL.BindTexture) the texture is created but with nonsense data in it.
This code works perfectly, and I can see the texture in gDEbugger:
GL.BindTexture(TextureTarget.Texture2D, 0);GL.TexParameter( TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);GL.TexParameter( TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);GL.TexImage2D<byte>( TextureTarget.Texture2D, 0, PixelInternalFormat.R8, (int)width, (int)height, 0, PixelFormat.Red, PixelType.UnsignedByte, data);This code results in a texture that is the correct dimensions and same format, but with repetitive nonsense data in it:
GL.BindTexture(TextureTarget.Texture2D, 5);GL.TexParameter( TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);GL.TexParameter( TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);GL.TexImage2D<byte>( TextureTarget.Texture2D, 0, PixelInternalFormat.R8, (int)width, (int)height, 0, PixelFormat.Red, PixelType.UnsignedByte, data);Note that it doesn't matter if the id given to BindTexture is generated using GenTexture or if I just use a random number (like 5 in this example). I am certain this is running in a valid (and existent) GL context. Since this is GL 3.2 code, I do not call GL.Enable(GL_TEXTURE2D); (this just results with an INVALID_ENUM error).
I have scoured this forum and of course googled it, but couldn't find anyone else having this problem.
EDIT: One other thing I should mention is that I can switch the texture unit just fine (using GL.ActiveTexture), but it is still corrupt if the texture id is nonzero.
[Edited by - Retro_Alt on July 29, 2010 5:20:14 PM]