English 中文(简体)
GLPaint with white background
原标题:

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
(source: straandlooper.com)

问题回答

Did you also:

glEnable(GL_BLEND);

?

I believe this is what you want for it to work on White: glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

Then use a white Particle.png circle that feathers out to transparency (your best example).

This should give in the desired result.

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.





相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签