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

Thread: border parameter of glTexImage2D only works for RGBA format?

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2006
    Location
    Ankara
    Posts
    5

    border parameter of glTexImage2D only works for RGBA format?

    When I create a texture with border=0

    glTexImage2D(GL_TEXTURE_2D,0,4,64,64,0,GL_RGB, GL_UNSIGNED_BYTE,pixels );

    texture is drawn correctly.

    When I adjust the pixels array for border=1

    glTexImage2D(GL_TEXTURE_2D,0,4,66,66,1,GL_RGB, GL_UNSIGNED_BYTE,pixels );

    texture is corrupted. I used non-simetric textures to observe that.

    I observed that when border=1 for all the formats except GL_RGBA, drawn textures are corrupted.

    Does any one know how to use glTexImage2D with border=1? or Is this an undocumented OpenGL bug?

    I suppose no one uses border=1 and no one cares about it But I need to use border=1 with GL_RGB.

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

    Re: border parameter of glTexImage2D only works for RGBA format?

    It looks like texture data alignement problems.
    try out :
    glPixelStore(GL_PACK_ALIGNMENT, 1);


    >> I suppose no one uses border=1
    you suppose wrong but you may have a problematic OpenGL implementation : what is your card and driver version ?

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2004
    Posts
    20

    Re: border parameter of glTexImage2D only works for RGBA format?

    glPixelStore did not fix the problem. Do you have any sample texture drawing with border=1 and RGB format?

    By the way, I tested my code with Microsoft's OpenGL (the one in Windows XP) with different platforms (ATI Radeon 9200, Nvidia FX5200, Intel 82865G) and all the time I get corrupted images.

  4. #4
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,527

    Re: border parameter of glTexImage2D only works for RGBA format?

    Pixel store will fix this, it's just that you need to use glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

  5. #5
    Junior Member Newbie
    Join Date
    Jul 2004
    Posts
    20

    Re: border parameter of glTexImage2D only works for RGBA format?

    Thanks Relic. I see a reasonable image with UNPACK one.

Posting Permissions

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