tags:

views:

287

answers:

2

I'm completely new to OpenGL, and I'm trying draw on a white background by reverse engineering GLPaint. I've gone through every combination of kSaturation, kLuminosity and glBlendFunc, AND just about every combination I can think of for brush texture (black on white, white on black, white on trans, alias/no alias, etc), but haven't stumbled upon the desired effect.

The best I've been able to achieve is with a white-on-trans circle, with glBlendFunc (GL_ SRC_ ALPHA, GL_ ONE_ MINUS_ SRC_ ALPHA), but this still gives me a dull colour, and the semi-trans outer bits are interpreted as black (i.e. dull green with black edges, instead of vibrant green with transparent edges). It's as though it still assumes I'm on a black background.

Any advice?

alt text

+1  A: 

Did you also:

glEnable(GL_BLEND);

?

Grumdrig
A: 

Yup, glEnable(GL_BLEND) is in there. I've basically started with GLPaint and changed the background to white and the rest of the code is the same. I have to assume that since GLPaint was made with black background, there's some bit of code that is set to blend ideally to black, and I don't know which switch to flip (or, indeed, what switches can be flipped. Heck, what switches even exist).

Here's what's there by default. Lemme know if you see anything awry...

glDisable(GL_DITHER)

glMatrixMode(GL_PROJECTION)

glMatrixMode(GL_MODELVIEW)

glEnable(GL_TEXTURE _2D)

glEnableClientState(GL_VERTEX _ARRAY)

glEnable(GL_BLEND)

glBlendFunc(GL_SRC _ALPHA, GL_ONE _MINUS _SRC _ALPHA)

glEnable(GL_POINT _SPRITE _OES)

glEnable(GL_COLOR _MATERIAL)

I don't mind telling you, I haven't a clue what any of that is. -kev.

Kevin Beimers