Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualBrother Bob

Posted 08 October 2012 - 11:44 AM

The alignment works per row on byte level, not on pixel level. Since each pixel of your RGBA image has four components, then it by definition must always satisfy the byte alignment (which is 4, since you said the storage parameters have their default values). This can not be the problem under the circumstances you have explained it.

Can you provide screen shots of what the different results look like? I have seen many different cases of "messed up colors" and "different parts" and images to clearly show what you mean would be great,

As a side note, your step 2 is not necessary. OpenGL is very flexible with what parameters you can pass and how color components can be ordered. If you have a BGR image you can pass GL_BGR to glDrawPixels. If you add an alpha channel, you have some options depending on where in the pixel data you put it, but GL_BGRA may be an option.

edit: And of course, make sure that your code handles SDL's alignment padding as well. OpenGL is not the only one with alignment requirements.

#2Brother Bob

Posted 08 October 2012 - 11:44 AM

The alignment works per row on byte level, not on pixel level. Since each pixel of your RGBA image has four components, then it by definition must always satisfy the byte alignment (which is 4, since you said the storage parameters have their default values). This can not be the problem under the circumstances you have explained it.

Can you provide screen shots of what the different results look like? I have seen many different cases of "messed up colors" and "different parts" and images to clearly show what you mean would be great,

As a side note, your step 2 is not necessary. OpenGL is very flexible with what parameters you can pass and how color components can be ordered. If you have a BGR image you can pass GL_BGR to glDrawPixels. If you add an alpha channel, you have some options depending on where in the pixel data you put it, but GL_BGRA may be an option.

edit: And of course, make sure that your code handles SDL's alignment padding as well. OpenGL is not the only one with alignment requirements.

#1Brother Bob

Posted 08 October 2012 - 11:41 AM

The alignment works per row on byte level, not on pixel level. Since each pixel of your RGBA image has four components, then it by definition must always satisfy the byte alignment (which is 4, since you said the storage parameters have their default values). This can not be the problem under the circumstances you have explained it.

Can you provide screen shots of what the different results look like? I have seen many different cases of "messed up colors" and "different parts" and images to clearly show what you mean would be great,

As a side note, your step 2 is not necessary. OpenGL is very flexible with what parameters you can pass and how color components can be ordered. If you have a BGR image you can pass GL_BGR to glDrawPixels. If you add an alpha channel, you have some options depending on where in the pixel data you put it, but GL_BGRA may be an option.

PARTNERS