Has anyone had any success using vertex programs/shaders???
Regards
Regards



'Each surface in my Mesh entitys 'can have their own 'tShaderObject' 'i.e: myMesh.surfShader 'cubeSurf is a surface on a mesh (a cluster of Tris) cubeSurf.surfShader = tProgramObject.Create() Local vertShader:tShaderObject = CreateVertShader("Lattice.vert") Local fragShader:tShaderObject = CreateFragShader("Lattice.frag") cubeSurf.surfShader.AttachVertShader(vertShader) cubeSurf.surfShader.AttachFragShader(fragShader) 'Yes, we want to use the shader when rendering cubeSurf.useShader = True cubeSurf.setShaderVars = ToonShaderVars '^^ 'A cool feature in blitzmax, setShaderVars is a Function Pointer 'In this case, I use them to point the surface shader to a user 'defined 'callback' Function to change variable settings within 'the shader! ' 'example, in my surface process I do something like this ' ' If surf.useShader 'use the shader? ' surf.EnableShader() ' enable this surfaces shader ' surf.setShaderVars(surf.surfShader) ' set the shader Variables (call LatticeShaderVars()) ' End If ' ' DrawSurfaceGeometry() ' ' disable shader e.t.c ' 'So the function below would be called automaticaly, and the user 'can tweak shader variables easily this way! Function LatticeShaderVars(s:tProgramObject) 'Here's how you tweak shader variables! s.SetUF3("LightPosition",1.0,4.0,3.0) s.SetUF3("LightColor",1.0,0.8,0.9) s.SetUF3("EyePosition",myCam.GetX(3), myCam.GetY(3), myCam.GetZ(3)) s.SetUF3("AmbientColor",0.2,0.2,0.2) s.SetUF3("Specular",0.2,0.2,0.2) s.SetUF1("Kd",0.8) s.SetUF2("Scale",10.0,10.0) s.SetUF2("Threshold",0.13, 0.13) s.SetUF3("SurfaceColor",1.0,0.0,1.0) End Function