Hello OFX forum,
I have adapted an example project of ofxBox2D to see if i could get an image texture on a circle shape, which i succeeded in, yay! However, somehow, the image is being darkened, and i have no idea where this is coming from. I have zipped the project, and posted some screenshots on my cloud space here:
original transparent PNG image:
How coin looks in adapted Box2D example project:
sorry, i have no rights to put images inside posts, apparently
If you call ofSetColor(255) before drawing the image, does bring the image color back to what you expect?
Yes, that works perfectly. How does it work? Is color simply overlayed over images in OpenFrameworks, always? Or is it something ofxBox2D specific?
OpenGL/OF is (mostly) state-based which means the last color that was set will continue to be used until it is changed again. In the case of textures, you can think of the color as a “tint” similar to that option in Processing if you’ve used that before. Without setting the color yourself, your textures were being “tinted” by the last color that was set in the last call to
Thanks, very clear answer!
You can also use
ofPopStyle() to keep track of your state.