Skip to content

Instantly share code, notes, and snippets.

@Anteru
Last active January 1, 2016 20:29
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Anteru/8196972 to your computer and use it in GitHub Desktop.
Swizzle texture access
// (Not tried) I would assume this gets ignored by OpenCL but it does affect OpenGL state.
// This affects how the shader reads from the texture, but doesn't change the format itself.
::glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
::glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, GL_GREEN);
::glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_BLUE);
::glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_ALPHA);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment