Results 1 to 9 of 9

Thread: How to load a non power-of-2 3D texture

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2003
    Posts
    27

    How to load a non power-of-2 3D texture

    How to ...
    Need I manually expend it to be power of 2 for each dimension?

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Apr 2003
    Posts
    680

    Re: How to load a non power-of-2 3D texture

    you can use gluBuild2DMipmaps, this does the rescaling for you, or, if you don't want to do this, you have to rescale them yourself (which is not that complicated either).

    Jan

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2003
    Posts
    27

    Re: How to load a non power-of-2 3D texture

    So, that command will do the scaling.
    If I just want to pad to the nearest power-of-2, I have to do it by myself?

  4. #4

    Re: How to load a non power-of-2 3D texture

    gluBuild2DMipmaps will resize the input texture to the nearest power of 2 for you. If you require more control of the texture than that (i.e. the nearest power of 2 is not the texture size you want) then you must use a image program to size it to the power of 2 your prefer...
    InTheZone

  5. #5
    Senior Member Frequent Contributor
    Join Date
    Aug 2001
    Location
    Italy
    Posts
    625

    Re: How to load a non power-of-2 3D texture

    While rescaling is probably the best thing you can do, also take a look at rectangular textures. There's NV_texture_rectangle and an upcoming ARB extension.

  6. #6
    Senior Member Regular Contributor
    Join Date
    Feb 2000
    Posts
    211

    Re: How to load a non power-of-2 3D texture

    don't forget that the "dimensioned-by-a-power-of-2"-factor is a speed related thing;
    apart from that i'm doing scaling for myself within my 3DSMAX exporter; using float-values it's very simple to "create" each arbitrary size of a texture, by using only 10 lines of code.
    i prefer not to use such "non-power-of-2-dimensioned"-texture extensions.
    DJSnow

  7. #7
    Senior Member Regular Contributor
    Join Date
    Apr 2001
    Posts
    103

    Re: How to load a non power-of-2 3D texture

    another option would be to create a dummy texture with power of 2 dimensions, memset it to 0, and then put the actual texture using glTexSubImage (which doesnt need power of 2 dimensions). this uses more mem, but it might be faster (its pretty fast for me, but i havent done any serious testing with it, and im using it in a pretty non standard application). youll also need to use different values for glTextCoord*, since the actual texture is still the power of 2 dimensions, but you only have meaningful data in a part of the texture.

  8. #8
    Guest

    Re: How to load a non power-of-2 3D texture

    Or, just wait till OpenGL 1.5 compliant drivers ship, which supports non-power of 2 sized textures per: todays announcement .

  9. #9
    Junior Member Newbie
    Join Date
    Jul 2003
    Posts
    27

    Re: How to load a non power-of-2 3D texture

    Use SubImage is a good idea. Thanks!

Similar Threads

  1. Replies: 3
    Last Post: 03-11-2015, 06:17 PM
  2. How to load the texture that not power by 2?
    By 尘羽泯 in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 07-25-2011, 04:34 PM
  3. Texture map (non power of two)
    By jsmith in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 08-05-2009, 03:52 AM
  4. Non Power Of 2 Texture
    By powerpad in forum OpenGL: Advanced Coding
    Replies: 10
    Last Post: 06-05-2005, 06:41 AM
  5. can't load non power of 2 textures!?
    By bill2727 in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 07-13-2003, 06:31 PM

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