Hi,
I’m trying to import pure webgl code to Cesium, but I don’t know what is the correct way.
With my webgl code is able to create a animation between 2 textures. For this purpose I define shaders (vertex and fragment). At first of all I’m trying to do some tests with createShaderProgram of Context.js (http://cesiumjs.org/Cesium/Build/Documentation/Context.html):
// Example 2. Create a shader program with explicit attribute indices.
var
vs = ``'attribute vec4 position;'
+
``'attribute vec3 normal;'
+
``'void main() { gl_Position = position; }'``;
var
fs = ``'void main() { gl_FragColor = vec4(1.0); }'``;
var
attributes = {
``position : 0,
``normal : 1
};
sp = context.createShaderProgram(vs, fs, attributes);
But when I launched the program it didn’t do anything and in console appear this error:
But Uncaught ReferenceError: Context is not defined
I attached full file.
¿How is the correct way to use this code? ¿How can I create and use shader program?¿Do you know any simple example which work like the documentation example?
Thanks,
Aritz
test.html (1.65 KB)