Results 1 to 7 of 7

Thread: Bitmap Woes

  1. #1
    Member Contributor
    Join Date
    Jan 2003
    Location
    Wisconsin
    Posts
    56

    Bitmap Woes

    I wrote a simple bitmap loader for potential use with textures, and it works fine for the most part (if code is necessary I can provide it). However, it only seems to be able to handle bitmaps whose widths are powers of two. This wouldn't be so much of a problem if I weren't writing a program that asks the user to provide a bitmap. Any suggestions?

  2. #2
    Member Contributor
    Join Date
    Aug 2002
    Location
    Brooklyn, NY, USA
    Posts
    53

    Re: Bitmap Woes

    You can use the GL_NV_texture_rectangle extenison, but it's only for nVidia cards.

  3. #3

    Re: Bitmap Woes

    Use the gluBuild2DMipmaps function in the glu library. Normal glTexImage2D will require textures to be powers of two. The glu function will resize the input texture for you.
    InTheZone

  4. #4
    Member Contributor
    Join Date
    Jan 2003
    Location
    Wisconsin
    Posts
    56

    Re: Bitmap Woes

    The textures aren't the problem. The textures work fine. The problem is the way the bitmap is loaded. I even tried it in a console program to test it and it's still skewed.

    EDIT: With a bit of experimentation, I found out the problem, but not the solution. The bitmap has to fit into an even byte. Which means that it's not power of 2 that matters, it's multiple of 8. Is there any way to fix this?

    [This message has been edited by Tokage (edited 07-26-2003).]

  5. #5
    Senior Member Regular Contributor
    Join Date
    Apr 2001
    Posts
    340

    Re: Bitmap Woes

    If you're talking about Windows bitmaps, rows must be DWORD-aligned, and there is nothing you can do about it. Add padding bytes as needed.

    EDIT : and skip padding bytes as needed when loading

    [This message has been edited by kehziah (edited 07-27-2003).]

  6. #6
    Member Contributor
    Join Date
    Jan 2003
    Location
    Wisconsin
    Posts
    56

    Re: Bitmap Woes

    Yeah, that's exactly what I did. I made it load the bitmap with the padding and memcpy() over to an array without padding and that seems to work just fine.

  7. #7
    Senior Member OpenGL Pro
    Join Date
    Feb 2002
    Location
    Bonn, Germany
    Posts
    1,633

    Re: Bitmap Woes

    This is one of the reasons I prefer TGA

    If you want to support more image formats, DevIL can solve most of these problems for you.

Similar Threads

  1. More GPGPU Woes
    By Kip Warner in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 02-08-2010, 03:50 PM
  2. Compositing woes
    By CatAtWork in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 12-07-2004, 07:33 AM
  3. GLSL woes
    By PigeonRat in forum OpenGL: GLSL
    Replies: 2
    Last Post: 08-28-2004, 08:16 PM
  4. Replies: 3
    Last Post: 01-16-2004, 08:33 AM
  5. bitmap border or bitmap "thickness"
    By Rong Yao in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 10-11-2001, 11:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean