Metaldemon's picture

weird green graphical problem

Hi, I've started using opentk after microsoft pretty much gave up on XNA. I like it so far but there is one problem that I've been coping with for 2 days now.

So basicly I want to make some basic lighting by putting some colored and transculent quads over textured quads.

However, all the colored quads are greenish! but I never specified that in the code.

Here is what I mean:

I don't understand why everything is green.

Here is the Sourcecode that handles the drawing in the game.

Edit: I think the link above doesn't work so I have the link here too:


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Ollhax's picture

A lot of code to soak in, but have you had any more luck with it? Perhaps you should set some breakpoints and inspect the values you are tossing in, you may have made some assumptions that are invalid. Also, have you double-checked your blending equations?

AndyKorth's picture

It looks like your LightTiles are going from transparent white to solid black. From what I see, I suspect they aren't responsible for the green color. Comment out the contents of LightingTile.Draw and post a screenshot. My suspicion is that everything will be green and you won't see the fade to black effect.

GL.BlendEquation(BlendEquationMode.Min); is responsible for the loss of texture when blending the darker tiles with the textured grass. It also ignores your GL.BlendFunc when you use Min. You probably want BlendEquationMode.FuncAdd...

Not 100% sure, but you might have to call GL.Enable(EnableCap.Blend); *before* setting blend equations and functions.

A little more info here:

Good luck! You've got a good start!