2k1Toaster's picture

Program draws differently on older hardware

So I have my first customer support issue. First they were using ancient hardware (Radeon 9200 circa 2002/2003) and textures were not drawing. They would show up as boxes cleared with the background colour. Next they switched to a newer Core 2 Duo machine with an Intel 945GM which is relatively new (2-3 years) but only supports OpenGL 1.4. This exhibits the same behaviour.

Running this program on my computer (OpenGL Version 2.1.2) it works fine. Are there special steps to allow backwards compatibility for 1.4? To load textures I am using:

I am using a modified version of TexUtil, but this load code is the same:

    public static int CreateTextureFromBitmap(Bitmap bitmap)
    {
      Img.BitmapData data = bitmap.LockBits(
        new Rectangle(0, 0, bitmap.Width, bitmap.Height),
        Img.ImageLockMode.ReadOnly,
        Img.PixelFormat.Format32bppArgb);
      var tex = GiveMeATexture();
      GL.BindTexture(TextureTarget.Texture2D, tex);
      GL.TexImage2D(
        TextureTarget.Texture2D,
        0,
        PixelInternalFormat.Rgba,
        data.Width, data.Height,
        0,
        PixelFormat.Bgra,
        PixelType.UnsignedByte,
        data.Scan0);
      bitmap.UnlockBits(data);
      SetParameters();
      return tex;
    }

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
avc81's picture

do u use non-power of 2 textures?

2k1Toaster's picture
avc81 wrote:

do u use non-power of 2 textures?

Indeed I do. I don't think any texture I have is a power of 2. The problem is these textures are user modifiable. I have no control over what the image is, where it is, or what size it is. Does something special need to be done for non-power of 2 textures on older hardware?

the Fiddler's picture

NPOT textures require OpenGL 2.0 or support for the ARB_texture_non_power_of_two extension. If your target hardware doesn't support either, you will have to store your images in POT textures (wasting some memory) and modify your texture coordinates to account for that.

See also: http://www.opengl.org/wiki/NPOT_Texture