Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I get a colored texture brush to show up in Open GL ES on white background?
    primarykey
    data
    text
    <p>I want to draw with a texture brush, in a color of my choice, on a white background using OpenGLES. </p> <p>I have a bitmap image which I use CG to load and turn into a texture. This bitmap is mostly black, but has a white circle in the center that I want to use as the "brush". In other words, I want the black part to vanish in the final compositing, but the white part to take on the color that I set using glColor. </p> <p>The best I can get is with the blend parameters (GL_SRC_ALPHA, GL_ONE) after setting some opaque bright color is a faded color line on a grey (not pure white background). But when I set the background to pure white, the line isn't visible. </p> <p>At least in the current situation, the black edges of the original texture don't appear. Most other blend combinations I'm trying cause either nothing to show up even on grey, or to see the entire brush including the black edges, which is no good.</p> <p>Is anyone willing to explain to me how I should set up my texture and/or GL states to make the bright color show through on pure white, without showing the black texture edges at all? This might be a newbie question, but I've tried working through the blend math, and I still just don't understand how the colors are all being factored together.</p> <p>Here's the image I'm using as the brush:</p> <p><a href="http://www.coldcoffeeandjuice.com/OpaqueBrush.png" rel="nofollow noreferrer">alt text http://www.coldcoffeeandjuice.com/OpaqueBrush.png</a></p> <p>Here's some resulting output, when the background is grey, and the glColor4f is set to (1, 0, 0, 1), eg pure red, and the brush is used on a bunch of consecutive GL_POINTs. Note that what's good about this is that only the white part of the brush image shows the color red-- that's right. The bad parts is that the red which I want to be pure and bright is pale due to being blended with the background (?) and/or the white of the brush (?) so that it washes out entirely if the background is pure white. This uses the blend params as given above (src_alpha, one).</p> <p><a href="http://www.coldcoffeeandjuice.com/palered.png" rel="nofollow noreferrer">alt text http://www.coldcoffeeandjuice.com/palered.png</a></p> <p>Here's what I want to see, given the pure red color (thanks Paintbrush):</p> <p><a href="http://www.coldcoffeeandjuice.com/brightred.png" rel="nofollow noreferrer">alt text http://www.coldcoffeeandjuice.com/brightred.png</a></p> <p>Can anyone help me understand what I'm doing wrong?</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload