Skip to main content
gamedev.net
🔒 Locked

glCopyPixels()

Started by Axel 3 replies 450+ views
Original Post
Axel
Axel
I am very new at OpenGL. I have a project given to me by my employer to display an image onto the screen. The image is a jpeg image and he said that I could just copy the pixels from the jpeg image and then display it using glCopyPixels(). I have read the redbook on this topic but it doesn''t seem to help me with copy the pixels from a current image. Please help? Thanks in advance. Axel
Axel
mhearn
mhearn
Hi Axel,

I''ve been doing something similar in the past few days and I know how frustrating it can be. Here''s a few tips:

- To display a JPEG in OpenGL using glCopyPixels() you must first uncompress the JPEG into pixel data (RGB) in memory. The JPEG loader code should do this.
- Then, rearrange the data in memory so it starts from the bottom left (this is what got me)
- Make sure that you call glPixelTransfer() [i think] to set the pixel alignment to 1.
- Then call glDrawPixels() with a pointer to the data in memory and it should be drawn.

Hope that helps- mike
Axel
Axel
I need the source of a good jpeg loader. Thanks

Axel
Axel
Axel
Axel
I need the source of a good jpeg loader. Thanks

Axel
Axel
Axel
Axel
I need the source of a good jpeg loader. Thanks

Axel
Axel

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.