Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

My texture map colors reverse blue and red, yellow and cyan, etc. Whats happening?

0
Posted

My texture map colors reverse blue and red, yellow and cyan, etc. Whats happening?

0

Your texture image has the reverse byte ordering of what OpenGL is expecting. One way to handle this is to swap bytes within your code before passing the data to OpenGL. Under OpenGL 1.2, you may specify GL_BGR or GL_BGRA as the “format” parameter to glDrawPixels(), glGetTexImage(), glReadPixels(), glTexImage1D(), glTexImage2D(), and glTexImage3D(). In previous versions of OpenGL, this functionality might be available in the form of the EXT_bgra extension (using GL_BGR_EXT and GL_BGRA_EXT as the “format” parameter).

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.