Sunday, 18 August 2013

WebGL context can't render simplest screen

WebGL context can't render simplest screen

I'm stuck trying to render some extremely basic stuff on webgl, I've
dumbed down the rendering to the most basic thing I can think of in order
to find where the issue lies, but I can't even draw a simple square for
some reason. The scene I really want to render is more complex, but as I
said, I've dumbed it down to try to find the problem and still no luck.
I'm hoping someone can take a look and find whatever I'm missing, wich I
assume is a setup step at some point.
The gl commands I'm running (as reported by webgl inspector, without
errors) are:
clearColor(0,0,0,1)
clearDepth(1)
clear(COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT)
useProgram([Program 2])
bindBuffer(ARRAY_BUFFER, [Buffer 5])
vertexAttribPointer(0, 2, FLOAT, false, 0, 0)
drawArrays(TRIANGLES, 0, 6)
The buffer that is being used there (Buffer 5) is setup as follows:
bufferData(ARRAY_BUFFER, [-1,-1,1,-1,-1,1,-1,1,1,-1,1,1], STATIC_DRAW)
And the program (Program 2) data is:
LINK_STATUS true
VALIDATE_STATUS false
DELETE_STATUS false
ACTIVE_UNIFORMS 0
ACTIVE_ATTRIBUTES 1
Vertex shader:
#ifdef GL_ES
precision highp float;

No comments:

Post a Comment