This is a code from martinsh but I m getting a weird error on the line 24 (bgl.glReadPixels(x, y, 1, 1, bgl.GL_DEPTH_COMPONENT, bgl.GL_FLOAT, pixels)) and I dont understand why I changed the other errors that I was receiving but this one I dont know how to fix.
I was trying to use this fro blender 2.5x
Console gives me this messa integer argument expected, got float
import GameLogic as G
import bgl
import Rasterizer as R
from bge import logic
scene = G.getCurrentScene()
cont = G.getCurrentController()
objList = scene.objects
own = cont.owner
viewport = bgl.Buffer(bgl.GL_INT, 4)
bgl.glGetIntegerv(bgl.GL_VIEWPORT, viewport);
width = R.getWindowWidth()
height = R.getWindowHeight()
x = viewport[0] + width/2
y = viewport[1] + height/2pixels = bgl.Buffer(bgl.GL_FLOAT, [1])
bgl.glReadPixels(x, y, 1, 1, bgl.GL_DEPTH_COMPONENT, bgl.GL_FLOAT, pixels)
avgPixels = pixels[0]
#Slow adaptation
own.focus = (own.focus0.95 + avgPixels0.05)
avgPixels = own.focus