Unfortunately coding OpenGL shaders is more strict for ATI cards. I am trying to get this code from this thread http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR to work on my ATI card. Any ideas?
I've even looked into a GPU shader analyzer to try and debug it with no luck http://developer.amd.com/tools/shade...s/default.aspx
When I run the game the flashes blue then the screen is completely white. I am running Blender 2.36a on a ATI 6750
from bge import logic as g
from bge import render as r
from mathutils import *
from math import *
import bgl
cont = g.getCurrentController()
own = cont.owner
scene = g.getCurrentScene()
objects = scene.objects
width = r.getWindowWidth()
height = r.getWindowHeight()
rf = g.getRandomFloat
viewport = bgl.Buffer(bgl.GL_INT, 4)
bgl.glGetIntegerv(bgl.GL_VIEWPORT, viewport);
pixels = bgl.Buffer(bgl.GL_FLOAT, [1])
SAMPLES = 25
ADAPT = 0.99
g.xpoint = []
g.ypoint = []
def init():
#http://www.cgafaq.info/wiki/Evenly_distributed_points_on_sphere
dlong = pi*(3-sqrt(5))
dz = 1.0/SAMPLES
long = 0
z = 1 - dz/2
for i in range(SAMPLES):
g.xpoint.append([])
g.ypoint.append([])
r = sqrt(1-z)
g.xpoint[i] = viewport[0] + ((cos(long)*r)*0.5+0.5)*width
g.ypoint[i] = viewport[1] + ((sin(long)*r)*0.5+0.5)*height
z = z - dz
long = long + dlong
g.reileigh = 1.0
g.turbidity = 1.5
g.worldscale = 8.0
g.contrast = 7.0
g.bias = 1.2
g.lumamount = 0.3
g.initialized = 1
def getlum():
g.readL = 0
if hasattr(g,"initialized"):
for j in range(SAMPLES):
bgl.glReadPixels(int(g.xpoint[j]),int(g.ypoint[j]), 1, 1, bgl.GL_LUMINANCE, bgl.GL_FLOAT, pixels)
g.readL += pixels[0]
g.readL /= SAMPLES
def setlum():
Lum = g.readL
own["L"] = (own["L"]*ADAPT + Lum*(1.0-ADAPT))
Lum = own["L"]
g.luminance = own["L"]
objects["skybox"].color = [own["L"],1.0,1.0,1.0]
objects["ground"].color = [own["L"],1.0,1.0,1.0]