fading effect to display screen

this is naveen … how to map openGL buffer into cuda address space.if my display resolution is 1280 X 800 .thing is display screen should be fadding … i written code for this using openGL … but i want use PBO object and this should be mapeed into cudaGLmapBufferObjcet… if i mapped PBO into cuda address space … can i decrement RGB value and how to decrement RGB values from PBO(pixel buffer object) … and this decrement should be on device(kernel)… can any one give me idea…

below mentioned code is written in openGL … but i want that decrement shold be on device(kernel function) …because of it is taking more time using porcessr…if i do decrement part on device then it is takin less time… my graphic card is NVIDIA GT 800 … plse any body help

thanking you…

#define SCREEN_WIDTH 1280
#define SCREEN_HEIGHT 800

void display(void);
void init(void);

void display(void)
{
static float i;
for (float i=0.0f;i<256.0f;i++)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef( 0,0, 0 );
glLoadIdentity();
glBegin( GL_QUADS );
glColor4ub(i,i,i,i);
glVertex3f( 0,0,0 );
glVertex3f( SCREEN_WIDTH, 0,0 );
glVertex3f( SCREEN_WIDTH, SCREEN_HEIGHT,0 );
glVertex3f( 0,SCREEN_HEIGHT, 0 );
glEnd();
glutSwapBuffers();

}

}

void init(void)
{
	glClearColor (0.0, 0.0, 0.0, 0.0);
       GLfloat _div = ( GLfloat ) SCREEN_WIDTH / ( GLfloat )SCREEN_HEIGHT;
           glViewport( 0, 0, ( GLint ) SCREEN_WIDTH , ( GLint )SCREEN_HEIGHT );
          glMatrixMode(GL_PROJECTION);
          glLoadIdentity();   
         //glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
         gluOrtho2D (0.0, (GLdouble) SCREEN_WIDTH, 0.0, (GLdouble) SCREEN_HEIGHT);
         glMatrixMode(GL_MODELVIEW);
       glLoadIdentity(); 

}

int main(int argc, char** argv)
{

while(1)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize (1280, 800);
//glutInitWindowPosition (100, 100);
glutCreateWindow (“hello”);
init ();
glutDisplayFunc(display);
glutMainLoop();
}
return 0;

}

If all you want to do is fading out, it’s much faster and cleaner to simply do a subtractive blend with a full-screen quad (or even better: a full screen triangle).

thank u for reply… thing is i want do decrement part on device (kernel function ) and if i map pixelbufferobject into cuda address space then how can i access and decrement RGB value from PBO… can you write sequentional code for that

tahnking you