I’m using OpenCL kernel to calculate some vertices. After calculation, these vertices (x,y,z coordinates) are updated to the OpenCL-OpenGL shared buffer.I am using NVIDIA GrForce 820m.
I need to draw a wired sphere and translate it according to the values obtained in this shared buffer.
The code is as follows:
void CreateVBO(){
glGenBuffers(1,&vbo);
glBindBuffer(GL_ARRAY_BUFFER,vbo);
glBufferData(GL_ARRAY_BUFFER,3*sizeof(vertex),pos,GL_DYNAMIC_DRAW);
}
void Display(void)
{
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPointSize(10.0);
CreateVBO();
glBindBuffer(GL_ARRAY_BUFFER,vbo);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(4, GL_FLOAT, 0, 0);
glDrawArrays(GL_POINTS,0,3);
glDisableClientState(GL_VERTEX_ARRAY);
glBindBuffer(GL_ARRAY_BUFFER,0);
glutSwapBuffers();
}
I tried adding
glutWiredSphere or glutSolidSphere
But they do not work. Also, please let me know how to make use of
translatef()
with VBO values. I need to draw a revolving sphere. Something like a moon revolving round the earth. The next position of the moon is obtained by the shared buffer. The sphere needs to be shifted by a position obtained dynamically from the VBO(openCL kernel update). Thanks in advance