OpenGL VBO

Hi, I have created a Vertex Buffer Object in my project quite similar to the simpleGL example but I am having problems rendering it correctly.

In my kernel (for testing) I say

[codebox]vbo[0] = make_float3(0.0f, 0.0f, 0.0f);

vbo[1] = make_float3(0.0f, 1.0f, 0.0f);

vbo[2] = make_float3(1.0f, 1.0f, 0.0f);

vbo[3] = make_float3(1.0f, 0.0f, 0.0f);[/codebox]

and then back in my OpenGL display() function I do this

[codebox]cutilCheckError(cutStartTimer(timer));

float modelView[16];

glMatrixMode(GL_MODELVIEW);

glPushMatrix();

    glLoadIdentity();

    glRotatef(-ViewRot.x, 1.0, 0.0, 0.0);

    glRotatef(-ViewRot.y, 0.0, 1.0, 0.0);

    glTranslatef(-ViewTrans.x, -ViewTrans.y, -ViewTrans.z);

	glGetFloatv(GL_MODELVIEW_MATRIX, modelView);

glPopMatrix();

invViewMatrix[0] = modelView[0];

invViewMatrix[1] = modelView[4]; 

invViewMatrix[2] = modelView[8]; 

invViewMatrix[3] = modelView[12];

invViewMatrix[4] = modelView[1];

invViewMatrix[5] = modelView[5]; 

invViewMatrix[6] = modelView[9]; 

invViewMatrix[7] = modelView[13];

invViewMatrix[8] = modelView[2];

invViewMatrix[9] = modelView[6]; 

invViewMatrix[10] = modelView[10]; 

invViewMatrix[11] = modelView[14];



CalculateWithCUDA();		// CUDA calculates what to render

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glDisable(GL_DEPTH_TEST);

glRasterPos2i(0, 0);

glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, iPBO);	// Draw image from Pixel Buffer Object

glDrawPixels(screenWidth,screenHeight, GL_RGBA, GL_UNSIGNED_BYTE, 0);

glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);

glPushMatrix();	// Draw the Vertex Buffer Object over the PBO?

	glLoadIdentity();

	glRotatef(-ViewRot.x, 1.0, 0.0, 0.0);

	glRotatef(-ViewRot.y, 0.0, 1.0, 0.0);

	glTranslatef(-ViewTrans.x, -ViewTrans.y, -ViewTrans.z);



	glBindBuffer(GL_ARRAY_BUFFER, iVBO);

	glVertexPointer(4, GL_FLOAT, 0, 0);

	glEnableClientState(GL_VERTEX_ARRAY);

	glColor3f(0.0, 1.0, 0.0);

	glDrawArrays(GL_QUADS, 0, 4);

	glDisableClientState(GL_VERTEX_ARRAY);

	glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);

glPopMatrix();

glutSwapBuffers();

cutilCheckError(cutStopTimer(timer));

ComputeFPS();[/codebox]

as you can see I am also using a Pixel Buffer Object (as seen in the volume rendering example).

What I want to try to create (in the end) is a “wireframe” style cube around my pixel buffer data (which is a cube) but even trying to draw a simple quad as shown above doesnt come out right and I’m not smart enough to see why!

I end up with a triangle instead of a quad and I dont think its between 0-1 like the data I assigned in my kernel, anyone got any ideas on this one?