I’m trying to generate vertex arrays from point data that lives in a MySQL database.
I can read out the values without a problem and create an array with float point values representing the xyz coordinates of a simple triangle.
When I’m going to pass that array to glVertexPointer it doesn’t seem to display anything. Before I start posting any code I thought I might ask if there is anyone out there that has retrieved the coordinates from a database and then used them in vertex arrays in OpenGL. The whole thing is written in C with OpenGL 1.1 and I need to keep it that way.
You shouldn’t have to feed the array into the glVertexPointer. Actually I thought you weren’t able to use that function in webgl but instead glVertexAttribPointer.
here’s an example:
var tri_buffer;
function initBuffers()
{
var vertices = [ 0.0, 1.0, 0.0,
-1.0, -1.0, 0.0,
1.0, -1.0, 0.0];
gl.uniformMatrix4fv(shaderProgram.pMatrix, false, new Float32Array(pMatrix.flatten()));
gl.uniformMatrix4fv(shaderProgram.mvMatrix, false, new Float32Array(mvMatrix.flatten()));
gl.drawArrays(gl.TRIANGLES, 0, tri_buffer.numItems/num of vertices/);