Results 1 to 3 of 3

Thread: GL_UNPACK_SWAP_BYTES (endianness) question

  1. #1
    Guest

    GL_UNPACK_SWAP_BYTES (endianness) question

    I'm using glDrawPixels(x, y, GL_RGBA, GL_UNSIGNED_INT_10_10_10_2_EXT, buf); on a big-endian machine (IRIX) to display images and all is well. However, attempting to display the same image on a little-endian machine (x86, Linux, XFree, NVIDIA) results in garbage (as is expected) but I'm trying to use:

    glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
    glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_TRUE);

    to fix the endianness problem, and it's not working - ie, nothing has changed.
    What am I doing wrong?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: GL_UNPACK_SWAP_BYTES (endianness) question

    Not really sure if this is related to the problem you have, but on the little endian platforms you can try use GL_UNSIGNED_INT_10_10_10_2_EXT_REV instead. REV should reverse the order of the color components.

  3. #3
    Guest

    Re: GL_UNPACK_SWAP_BYTES (endianness) question

    Originally posted by Bob:
    Not really sure if this is related to the problem you have, but on the little endian platforms you can try use GL_UNSIGNED_INT_10_10_10_2_EXT_REV instead. REV should reverse the order of the color components.
    Doesn't GL_UNSIGNED_INT_10_10_10_2_EXT_REV reverse bit-ordering, rather than byte ordering?
    Thanks anyway. I've been hacking away at this for some time now, and come to the conclusion that there's a problem with glPixelStore(GL_UNPACK_SWAP_BYTES support in NVIDIAs Linux drivers. If I feed an SGI byte-swapped images and use

    glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
    glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_TRUE);

    then all is well, so it's not my code.
    Besides, the latest Linux driver build completely broke 10_10_10_2 support - if I glDrawPixels such an image, I get a magenta rectangle.

    Time to post NVIDIA a bug report.

Similar Threads

  1. Replies: 5
    Last Post: 04-23-2018, 12:03 AM
  2. Endianness in kernel arguments
    By outofsync in forum OpenCL
    Replies: 8
    Last Post: 09-10-2014, 03:55 AM
  3. Texture question and sphere question...
    By detzel in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-19-2001, 12:02 PM
  4. Quake3 bsp question (not really openGL question)
    By ribblem in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 01-15-2001, 10:13 AM
  5. Replies: 2
    Last Post: 01-08-2001, 03:33 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