Ghassen Hamrouni
Ghassen Hamrouni

Reputation: 3168

Eliminate a color channel when rendering an object in OpenGL

Am wondering how to eliminate the red channel when rendering some objects in OpenGL.

I can do this easily using a fragment shader but unfortunately I can't use shaders for this particular project.

Disable the red channel
DrawOject();
Enable the red channel

Is there any solution for this?

Upvotes: 2

Views: 88

Answers (2)

BDL
BDL

Reputation: 22165

You can control which channels are written to the framebuffer by using glColorMask. In your case:

glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE);

Upvotes: 4

datenwolf
datenwolf

Reputation: 162164

glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE);

Upvotes: 5

Related Questions