;; with default attributes for
;; 0 vertex 4d
;; 1 normals 3d
;; 2 coords (uvw) 3d
;; 3 color 4d
(bind-func create_shader_xtm
(lambda (vsource:i8* fsource:i8*)
(let ((fshader (glCreateShader GL_FRAGMENT_SHADER))
(vshader (glCreateShader GL_VERTEX_SHADER))
(fcode:|1,i8*|* (salloc 1))
(vcode:|1,i8*|* (salloc 1))
(program (glCreateProgram))
(temp:i32* (salloc 1)))
(pset! fcode 0 fsource)
(pset! vcode 0 vsource)
(glShaderSource fshader 1 (cast fcode i8**) (bitcast null i32*))
(glShaderSource vshader 1 (cast vcode i8**) (bitcast null i32*))
(glCompileShader fshader)
(glCompileShader vshader)
(glAttachShader program fshader)
(glAttachShader program vshader)
(glBindAttribLocation program 0 "xtmVertex")
(glBindAttribLocation program 1 "xtmNormal")
(glBindAttribLocation program 2 "xtmUVW")
(glBindAttribLocation program 3 "xtmColour")
(glLinkProgram program)
(print_shader_info_log fshader)
(print_shader_info_log vshader)
(print_program_info_log program)
program)))