31
SFML projects / Re: Moonman (my sfml game is on kickstarter!)
« on: January 21, 2015, 11:31:36 pm »
Thanks guys!
One thing that I used to do is render some sprites with all their pixels greyed-out (like an alpha mask). I could have done that in a shader but I used code like:
But that code is old and now I render things as black, like in some of items in the box on the right:
It's not a deficiency of SFML, as all those texture ops are getting pretty old now, and you can easily do that sort of thing in a shader.
Other smatterings of GL are just some immediate mode drawing that is in the debug drawing code.
Quote
Would really be interested in knowing such small details..
One thing that I used to do is render some sprites with all their pixels greyed-out (like an alpha mask). I could have done that in a shader but I used code like:
Code: [Select]
// Render a sprite with all colours replaced to greay
glPushAttrib(GL_TEXTURE_BIT);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
static GLfloat constColour[4] = {0.25,0.25,0.25,1}
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constColour);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_CONSTANT);
target->draw(sprite);
glPopAttrib();
But that code is old and now I render things as black, like in some of items in the box on the right:
It's not a deficiency of SFML, as all those texture ops are getting pretty old now, and you can easily do that sort of thing in a shader.
Other smatterings of GL are just some immediate mode drawing that is in the debug drawing code.