Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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]
share|improve this question
1  
In what way is it not working on your ATI card? Giving a compiler error (if so, post it)? Producing visual artifacts (if so, post a screenshot)? What ATI card do you have and what version of Blender are you using? Please edit the question to include as much additional information as you can, so readers can give you more informed answers. –  Nathan Reed Jul 26 '12 at 0:15
    
When I run the game the flashes blue then the screen is completely white. I am running Blender 2.36a on a ATI 6750 –  user18401 Jul 26 '12 at 0:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.