D
D
Dmitry Petrov2015-05-17 22:29:19
JavaScript
Dmitry Petrov, 2015-05-17 22:29:19

Why is WebGL not connecting?

Hello.
I want to declare a WebGl context and I do it like this:

var names = ["webgl", "experimental-webgl", "webkit-3d", "moz-webgl"];
    gl = null;
    for (var ii = 0; ii < names.length; ++ii) {
        try {
            gl = canvas.getContext(names[ii]);
        } catch(e) {}
        if (gl) {
            break;
        }
    }

then I call the functions:
initShaders ();
initBuffers ();

But the console says: "initShaders is not defined"
What am I doing wrong or what am I not doing?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Zuev, 2015-05-17
@yurzui

Maybe you just forgot to create the InitShaders function developer.mozilla.org/ru/docs/Web/WebGL/Adding_2D_...

D
Daniil Kolesnichenko, 2015-05-18
@KolesnichenkoDS

Take a JavaScript course at some Codecademy, and only then return to WebGL.
You haven't defined the initShaders and initBuffers functions, how are you going to call them?

S
svaa1982, 2015-05-26
@svaa1982

In my opinion the best lessons on WebGL learningwebgl.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question