bgl Color Buffer?

Can anyone tell me if there is any way i can get a color buffer from my scene? What i mean by this is the diffuse / shadeless color

Ideally it would be something like bgl_RenderedTextureColor or something…

I have found a work around but it’s not perfect and not good enough for what i’m trying to do

Unfortunately no, there are no default shadeless 2d texture buffer in bge

From what I know the only workaround is to create 2 separated objects with 1st one with the shadings and the 2nd one without.

workaround.blend (535 KB)

For some reason this bugs on embedded mode, and works only in standalone mode :confused:

You can fill a bgl Buffer with glReadPixels: https://www.opengl.org/sdk/docs/man/html/glReadPixels.xhtml

But the question is, to do what?

Here is choosed to fill a bgl Buffer with the colors picked on the screen and then assign this buffer to replace a texture: http://pasteall.org/blend/index.php?id=44780

Oh, thank you! I guess this’ll have to do, i am not sure if i am ok with the performance hit that this would create but i’ll do some testing and see what i can come up with.

Also, have you seen my SSGI filter (link in my signature)? I saw yours and that pushed me to make my own. It’d be nice if we exchanged some tips maybe?

There’s a better way to do this.

If you take a look at https://blenderartists.org/forum/showthread.php?397594-Render-Passes-in-BGE you’re able to modify the objects before it reaches the RenderedTexture, so you can apply a GLSL program that makes each mesh shadeless recursively, and then bind it to a filter the same way kitebizeIt did. I’ll upload an example later, if nobody else does.

You can also render to a FBO. But this way is a little bit complicated and hacky because, you need PyOpenGL (Dalai Felinto has removed BGL FBO functions because of offScreenCreate), hacky garbing of the original program (my patch is not Blender, because of missing review). But garbing the programm is not necessary if you generate an own shader program. It is also don’t take the viewport size into account.
But you can also render a smooth normal map. Because Martins way to generate normals (same as dFdx) always produce flat shaded normals.

I think offScreenCreate() can be used achieve the same thing without all the hacks (if it works with shaders). But I don’t tested it.

not sure if this will help, bgl_LuminanceTexture is colorless if I’m unmistaken(rare…)? I found martinsh was using this in his SSAO shader