Reputation: 977
I need to display image in openGL window.
Image changes every timer tick.
I've checked on google how, and as I can see it can be done using or glBitmap or glTexImage2D functions.
What is the difference between them?
Upvotes: 2
Views: 4282
Reputation: 16364
What you are probably looking for is glDrawPixels, which draws an image directly into the framebuffer. If you use glTexImage2D
, you have to first update the texture with the new image, then draw a shape with that texture (say, a fullscreen quad) to actually render the image.
That said, you'll be better off with glTexImage2D
if...
Upvotes: 1
Reputation: 474426
The difference? These two functions have nothing in common.
glBitmap
is a function for drawing binary images. That's not a .BMP file or an image you load (usually). The function's name doesn't refer to the colloquial term "bitmap". It refers to exact that: a map of bits. Each bit in the bitmap represents a pixel. If the bit is 1, then the current raster color will be written to the framebuffer. If the bit is 0, then the pixel in the framebuffer will not be altered.
glTexImage2D
is for allocating textures and optionally uploading pixel data to them. You can later draw triangles that have that texture mapped to them. But glTexImage2D
by itself does not draw anything.
Upvotes: 1