Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Texture dimensions

  1. #1
    Junior Member Regular Contributor
    Join Date
    Apr 2001
    Posts
    132

    Texture dimensions

    Ok, I know when loading a texture from a tga or bmp the width and length have to be powers of 2. But, can you create your own texture with the dimensions 640x480, etc?

    Like could you do..

    MyTexture [640][480][3]...?

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    May 2000
    Location
    Oxford, England
    Posts
    547

    Re: Texture dimensions

    you can create any sized image you want. The tga & bmp formats will obviously deal with them, and you can obviously load them. It's doubtful a graphics card would be able to handle it as a texture though. For example, some graphics cards require a texture where both width and height must be the same and be a power of 2,

    ie 256x256

    some newer cards allow you to specify dimensions of varying size, eg 64x256, 128x8 etc.

    I wouldn't use non power of two textures purely for compatibility reasons, and varying dimensions isn't something I do either for the same reason.

    You can use glDrawPixels to draw non standard image sizes to the framebuffer, but thats obviously not a texture...

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

    Re: Texture dimensions

    The power of two thing is mandated by the OpenGL spec. I doubt any driver allows textures with non-power of two dimensions ... except of course if you use the NV_texture_rectangle extension, which is of course only available on newer NVidia hardware.

    Two convert images to different sizes, the gluScaleImage function might be useful to you. See the glu spec for details, it's pretty straightforward.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •