[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Shader Demo



Hi,

Yes, this is caused by the shaders not compiling right.  This probably means your card doesn't like them :P.  Sorry about the uninformative errors.  I've included glLibInit.py.  Just put it in glLib/ and overwrite.  Running again should give more informative errors.

Ian
from glLibLocals import *
from glLibPrebuiltShaders import GLLIB_SHADER_BLANK, GLLIB_SHADER_BLUR, GLLIB_SHADER_DEPTH, GLLIB_SHADER_TEXTURE, GLLIB_SHADER_MATERIAL, GLLIB_SHADER_SHADOW
from glLibPrebuiltShaders import GLLIB_SHADER_RED, GLLIB_SHADER_ORANGE, GLLIB_SHADER_YELLOW, GLLIB_SHADER_GREEN, GLLIB_SHADER_BLUE, GLLIB_SHADER_PURPLE
from glLibPrebuiltShaders import GLLIB_SHADER_WHITE, GLLIB_SHADER_BLACK, GLLIB_SHADER_GRAY, GLLIB_SHADER_GREY
def compileshader(shader):
    shader.compile()
def main():
    glEnable(GL_BLEND)
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)
    glShadeModel(GL_SMOOTH)
    glClearColor(0.0, 0.0, 0.0, 0.0)
    glClearDepth(1.0)
    glEnable(GL_DEPTH_TEST)
    glEnable(GL_ALPHA_TEST)
    glDepthFunc(GL_LEQUAL)
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)
    glAlphaFunc(GL_NOTEQUAL,0.0)
    sh1 = [GLLIB_SHADER_BLANK, GLLIB_SHADER_BLUR, GLLIB_SHADER_DEPTH, GLLIB_SHADER_TEXTURE, GLLIB_SHADER_MATERIAL, GLLIB_SHADER_SHADOW]
    sh2 = [GLLIB_SHADER_RED, GLLIB_SHADER_ORANGE, GLLIB_SHADER_YELLOW, GLLIB_SHADER_GREEN, GLLIB_SHADER_BLUE, GLLIB_SHADER_PURPLE]
    sh3 = [GLLIB_SHADER_WHITE, GLLIB_SHADER_BLACK, GLLIB_SHADER_GRAY, GLLIB_SHADER_GREY]
    sh4 = sh1+sh2+sh3
    map(compileshader,sh4)
    index = 0
    for shader in sh4:
        errors = shader.get_errors()
        if errors != "":
            print index, errors
        index += 1