OpenGL + CUDA Draw pixels in 2D


I am trying to create a CUDA program to draw pixels in a plane. The coordinates of my pixels are computed with a CUDA kernel sharing datas with a OpenGL buffer.

I modified a code from “CUDA by Example” using a structure where all fonctions are listed. The Draw fonction is composed of:

static void Draw( void ) {

GPUAnimBitmap*   bitmap = *(get_bitmap_ptr());


glDrawPixels( bitmap->width, bitmap->height, GL_RGBA,GL_UNSIGNED_BYTE, NULL);



The first strange fact is that glDrawPixels is expected to take my data pointer in last argument but I give it a NULL and it works.

My problem is that it seems OpenGL adds a third dimension to my coordinates. I can see a sort of sphere in stead of 2D circle.

I see something approximatively like that

I guess this is a OpenGL configuration that I miss or don’t do.

Thank your for your help.

Maybe I should post that in an OpenGL forum right ?

Oups !
Someone can delete this topic please ? I missed something, my equations are making the 3D illusion and something was wrong in my code! Thank you anyway !