
Blend problems
Posted Wednesday, 15 September, 2010 - 04:25 by Qythyx inI'm working on an OpenGL based game using MonoTouch for the iPhone, which uses OpenTK. I actually started my game in native Objective-C, but then decided to explore MonoTouch (since I have a lot of .NET/C# experience) and am now porting it over. The problem I'm facing is that I'm trying to blend multiple transparent textures. This worked perfectly in the native Objective-C version, but not with OpenTK.
The problem is that I have a black background with a transparent white texture that I'm drawing in multiple overlaps. On my original version if I drew the texture once it showed a grey image (transparent white on black). If I then draw the same texture again overlapping that then it should make the overlapped area brighter by adding more white to it. Instead what I'm getting is that each successive overlap makes the grey color darker.
I believe the relevant code is just this:
GL.Enable(All.Blend); GL.BlendFunc(All.One, All.OneMinusSrcAlpha);
Is there any reason this wouldn't work in OpenTK when it worked fine in native OpenGL?


Comments
Re: Blend problems
Never mind. Completely my fault. Nothing to do with Blend at all.
Move along folks. Nothing to see here.
Re: Blend problems
Never mind. Completely my fault. Nothing to do with Blend at all.
Move along folks. Nothing to see here.
I love such mails and writers.
Realy.
I mean: if I can not put such people in a bucket I will love them.
Qythyx -> bucket. :-)
Re: Blend problems
I like those people. They work on their problems, instead of posting "can you do xyz for me".
Qythyx -> different bucket.
Re: Blend problems
... They work on their problems, ...
Yes, that is good. But (because of public forum) it would be nicer to say "The problem was this and this, and I have solved the problem by that and that."
And to go with
Move along folks. Nothing to see here.
is, in my eyes, very heavy.
..., instead of posting "can you do xyz for me".
Oh, also still barrels exist. ;-)
Re: Blend problems
Actually, in most cases I would have written something more that would help others. In this case my mistake was not at all related to Blend that it wouldn't help others. If you really want a hint my mistake and solutions, then here you go....
If you want your textures to show up correctly, then one important prerequisite is to actually draw them. My problem was that I wasn't passing the right number to DrawArrays, so it wasn't drawing all of my triangles. It happening to be that the ones I was trying to overlay were at the end of the list, so the underlying faint one was drawn, but the ones that were supposed to be layered on top of it weren't but that gave me the impression they were dimming it.
Re: Blend problems
Thx. ;-)