vertex array from MySQL database

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.

Any help is welcome!

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];

tri_buffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, tri_buffer);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);
gl.bindBuffer(gl.ARRAY_BUFFER, null); 

tri_buffer.itemSize = 3;
tri_buffer.numItems = 3;

alert("initBuffers Complete!");


then when drawing:

gl.bindBuffer(gl.ARRAY_BUFFER, tri_buffer);
gl.vertexAttribPointer(shaderProgram.vertexposition, tri_buffer.itemSize/num of components/, gl.FLOAT, false, 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/);

gl.bindBuffer(gl.ARRAY_BUFFER, null);

Did you enable the vertex array with “glEnableClientState(GL_VERTEX_ARRAY);” ?

I managed to get it to work. Here is the code

while((row = mysql_fetch_row(result)) != NULL){
vertices[verticesCount] = (GLfloat) atof(row[0]);
vertices[verticesCount] = (GLfloat) atof(row[1]);
vertices[verticesCount] = (GLfloat) atof(row[2]);

this assumes that each row returned from the database has x,y and z as a column, hence the 3 row[] assignments to the vertices array.