Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the fastest way to draw a new fullscreen image each frame in OpenGL?

Tags:

c++

opengl

Every frame, my program will receive a new image from a USB video camera. This image will initially be in CPU memory. What's the fastest method in OpenGL to draw this image to the screen so that it fills the entire screen?

Currently, I'm uploading the image data to a texture and then rendering a fullscreen quad. However, this doesn't run very quickly on a different machine that I tried.

like image 404
May Oakes Avatar asked Sep 14 '11 17:09

May Oakes


1 Answers

Currently, I'm uploading the image data to a texture and then rendering a fullscreen quad. However, this doesn't run very quickly on a different machine that tried. Any ideas? Thanks.

glTexImage2D does a full texture initialization (which means, allocation, object setup and the like). If you just want to replace the texture image with an image of the same size, use glTexSubImage2D, which is much faster. If you want to do this asynchonously, then have a look at Pixel Buffer Objects

like image 118
datenwolf Avatar answered Nov 15 '22 08:11

datenwolf