Results 1 to 5 of 5

Thread: Nonsquare texturemaps?

  1. #1
    Junior Member
    Join Date
    Oct 2004
    Posts
    1

    Nonsquare texturemaps?

    Hi All,

    I was wondering if it is possible to use a texture map that is not a power of 2. I have several images of arbitrary size which need to be placed on individual rectangles. I would prefer not to have to doctor the image to be a power of 2 compatible image. If it is possible I would sure appreciate some sample code of how to do it because I am not finding anything on the internet.

    Thanks,
    Clint

  2. #2
    Senior Member
    Join Date
    Sep 2003
    Location
    Seattle, WA
    Posts
    246

    Re: Nonsquare texturemaps?

    Well, unfortunately you will need to set both width and height to powers of 2 for OpenGL ES. However, width and height do not have to be identical, so textures can be rectangular.

    - HM

  3. #3

    Re: Nonsquare texturemaps?

    Furthermore, just because the texture file dimensions need to be powers of two, doesn't mean you need to use all that space.

    i.e. You could fill a 256 x 256 texture with some 167x233 image, and just be sure to plot your texture vertices appropriately.

    Of course, if you want to use texture wrapping, then forget what I just said altogether.

    - Ben

  4. #4
    Junior Member
    Join Date
    Oct 2005
    Location
    fr/35/rennes
    Posts
    9

    how comes there is no way to directly copy an image to the c

    Is it the only way to fill the colorbuffer with texture ?

    In the case of a barground image,
    Copying a texture to a larger buffer, will eat time and memory,
    how comes there is no way to directly copy an image to the colorbuffer ?
    # how comes there is no way to directly copy an image to the colorbuffer ?
    # http://www.khronos.org/message_boards/v ... .php?t=511

    # http://rzr.online.fr/java.htm # 3d demo on all java phones

  5. #5

    Re: Nonsquare texturemaps?

    @clintsinger: For NPOT texturing you have to set some specific filtering modes i.e.:

    glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR);
    glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
    glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
    glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE );

Posting Permissions

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