GLBasic User Manual

Main sections

X_LOADSHADER()

ok# = X_LOADSHADER(index#, vertex$, fragment$)



This command loads a GLSL (OpenGL Shading Language) shader into index index#.
If the shader loaded successfully, ok# will be TRUE.
You can use the shader with
X_SETSHADER index#


// --------------------------------- //
// Project: Shaders
// Start: Monday, September 25, 2006
// IDE Version: 3.262

LOCAL shaders$[], num, current$
    IF X_LOADSHADER(13, "toon.vert", "toon.frag") = FALSE
        PRINT "Shader failed to load: ", 100,100
        SHOWSCREEN
        MOUSEWAIT
        END
    ENDIF

    CreateTorus(0, 5, 10, 12, 9, 2, 2, RGB(0xff, 0xff, 0xff))
    // CreateSphere(0, 10, 9, RGB(0xff, 0xff, 0xff) )
    WHILE TRUE
        DRAWRECT 0,0,640,480,RGB(255,128,0)
        X_MAKE3D 1,500, 45
        X_CAMERA 0,0,-100, 0,0,0

        X_SPOT_LT 0, RGB(255,255,255),100,100,-1000, -.1,-.1,1, 360

        X_ROTATION 45, 1,1,0
        X_ROTATION GETTIMERALL()/100, 0,1,.2
        X_SETSHADER 13
        X_DRAWOBJ 0, 0
        SHOWSCREEN
    WEND

See also...