Hi,
I’m having problems using textures with border.
If I run my application with software OpenGL (1.1) everything works fine, but if I enable hardware acceleration the graphics freezes and I don’t see anything.
I’m loading a 258x258 RGBA texture (256x256 with 1 border pixel).
I have an ATI FirePro v3750, but I tested it also on a RADEON HD 5450 and the problem is the same.
This is how I generate the texture object:
uint[] names = new uint[1];
glGenTextures(1, names);
uint Name = names[0];
glBindTexture(GL_TEXTURE_2D, Name);
glTexParameteri(GL_EXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
Bitmap bitmap = ...; // 258x258 RGBA texture
BitmapData data = bitmap.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
glTexImage2D(gl_TEXTURE_2D, (int)0, GL_RGBA8, (int)data.Width, (int)data.Height, 1, GL_BGRA, GL_UNSIGNED_BYTE, (IntPtr)data.Scan0);
And this is how I draw a quad with the texture:
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture.Name);
glBegin(GL_QUADS);
glTexCoord2d(0, 1);
vertices[0].DrawGL();
glTexCoord2d(1, 1);
vertices[1].DrawGL();
gl.TexCoord2d(1, 0);
vertices[2].DrawGL();
glTexCoord2d(0, 0);
vertices[3].DrawGL();
glEnd();
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);
With Step by Step debugging I saw that the glBindTexture() call is taking much time.
What could be the problem, expecially given that in software OpenGL it works fine?