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 4 of 4

Thread: Not Power Of Tow textures problem

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2009
    Posts
    19

    Not Power Of Tow textures problem

    Hi everyone,
    I need a help ...some one how can tell me what kind of error I am doing

    What I had a textures that carry my height field which are now working fine. Well, those textures use borders i.e the resolution (1026X1026) since I wanted to use (1024X1024) with 2 pixels borders as:
    Code :
    glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA32F_ARB,1026,1026,0,GL_RGBA,GL_FLOAT,&data]);

    now is the problem
    I want to use same thing i.e textures with borders for data from Bitmaps
    Well, I have loaded the Bitmap into and RGB array and then do the same like before. The problem that I faced is that I get weird colors which means clearly that some thing wrong but I am sure that all the settings of the texture and data array are correct.

    Code :
    glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB16F_ARB, 1026, 1026, 0, GL_RGB, GL_UNSIGNED_BYTE,bitmapdata);

    What I have done to understand the problem:
    1. use another Bitmap with resolution (1024X1024) ::: every thing is working fine.
    2. So,I expected that the problem might be that I am using not power of tow textures, therefore I have tested the code with

    GL_TEXTURE_RECTANGLE_ARB

    BUT stil working fine for bitmaps with (1024X1024) and also
    bitmaps for NPOT but till 1024 not more that this resolution

    However, I think the problem is not the my driver is not supporting resolution more that 1024 because I had used it for height field as I mensioned before

    I really now feel that I am missing some important things which is honestly I do not know them.....

    So, if anyone can know why or at least know some important references that would be helpful

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: Not Power Of Tow textures problem

    More likely, your data alignment is wrong.
    It defaults to 4 bytes, which means no problem for GL_RGBA8, or if width and height are multiples of 4.
    But with GL_RGB and 1026 : problems.

    So call these once at the begining of GL program, to be safe :

    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
    glPixelStorei(GL_PACK_ALIGNMENT, 1);

  3. #3
    Senior Member OpenGL Pro BionicBytes's Avatar
    Join Date
    Mar 2009
    Location
    UK, London
    Posts
    1,171

    Re: Not Power Of Tow textures problem

    You can query openGL to find put the max texture size supported

    Code :
    GLint texSize;
    glGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize);

  4. #4
    Junior Member Newbie
    Join Date
    Mar 2009
    Posts
    19

    Re: Not Power Of Tow textures problem

    Thank you all,
    the problem is solved by the suggestion of ZbuffeR.

Posting Permissions

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