[b]I mean, for example, there are 100 different images(10000px *10000px) I want them to display on screen consecutively just like a vedio player.
The data of image displaying on screen, I believe, can be transferred to GPU without any CPU’s help. What APIs I can use to set GPU to do this is the matter.
“ATI mobility Radean HD 4330” is my card and is out of dates and you can guess how slow my laptop is.
I have tried a demo of using PBO. In renderring function:[/b]
glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, DATA_SIZE, 0, GL_STREAM_DRAW_ARB);
GLubyte* ptr = (GLubyte*)glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, GL_WRITE_ONLY_ARB);
// update data directly on the mapped buffer
updatePixels(ptr, DATA_SIZE);
glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB); // release pointer to mapping buffer
[b]
With this solution, I can copy next image data to “ptr”, then I can see an animation on my screen. But I just can’t use any memory copy function, because it may lead to huge CPU usage.
And I have tried glDrawPixels(). This API works. It won’t lead to CPU usage too much. When I use it, it keeps 47%~50% CPU usage with 100px * 100px image, and it keeps 47%~50%CPU usage too with 16000px * 10000px image. If the renderring function does nothing but glClear() and glutSwapBuffers(), the CPU usage keeps 16%~25%. If the renderring function definitely does nothing, I mean anything including glClear() and glutSwapBuffers(), the CPU usage takes about 45% on average.
I compared those situations as following:[/b]
#1: CPU usage 47%~50% , and with very high fps
void Renderring()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
GetAnotherImage();// 100px * 100px
glDrawPixels(in->width, in->height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, in->imageData);
glutSwapBuffers();
}
#2: CPU usage 47%~50% and with extremely low fps(about 1.2 fps, say, one frame per second)
void Renderring()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
GetAnotherImage();//16000px * 10000px
glDrawPixels(in->width, in->height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, in->imageData);
glutSwapBuffers();
}
#3: CPU usage 44%~48%
void Renderring()
{
//definitely does nothing
}
#4: CPU usage 16%~25%
void Renderring()
{
//just clear and swap
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glutSwapBuffers();
}
But I believe there are APIs that does not take an extra CPU usage.