Can I use a grayscale image with the OpenGL glTexImage2D function?

前端 未结 3 1829
清酒与你
清酒与你 2020-12-06 10:14

I have a texture which has only 1 channel as it\'s a grayscale image. When I pass the pixels in to glTexImage2D, it comes out red (obviously because channel 1 is red; RGB).<

3条回答
  •  旧巷少年郎
    2020-12-06 10:54

    Change it to GL_LUMINANCE. See http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage2d.html

提交回复
热议问题