GLBasic User Manual

Main sections

X_SPHEREMAPPING

X_SPHEREMAPPING status#$



Turns "spheremapping" mode on (TRUE) or off (FALSE). This mode is used for effects like metallic reflections and will affect any objects drawn after the call to X_SPHEREMAPPING.
Before calling X_SPHEREMAPPING you should load a spherical projection of the environment to the active texture index with X_SETTEXTURE.
Spherical textures can be created with drawing programs like Photoshop or The GIMP.


Original


Sphere-Map of it

// --------------------------------- //
// Project: SphereMapping - metallic reflection

    X_LOADOBJ "donut.ddd", 1
    // Bild-Daten / Load Graphic data
    LOADSPRITE "back.bmp", 1
    LOADSPRITE "reflect.bmp", 0

    // Hauptschleife / Main Loop
    WHILE TRUE
        GETSCREENSIZE screenx, screeny
        STRETCHSPRITE 1, 0,0, screenx, screeny
        phi=phi+GETTIMER()/30
        X_MAKE3D 1, 250, 45
        X_CAMERA 0, 10, 50, 0,0,0

        X_SETTEXTURE 0, -1 // 0=Tex
        X_ROTATION phi, 0, 1, 0.1

        X_SPHEREMAPPING TRUE
        X_DRAWOBJ 1, 0
        X_SPHEREMAPPING FALSE
        SHOWSCREEN
    WEND

See also...