PDA

View Full Version : Just Load and view a bmp image file(such as lena..) using opengl



byullee
08-03-2015, 08:04 PM
I'm a beginner with opengl.
I'm just trying to load and view an image(lena) using opengl
and want to get pixel information of image to do fft.
and also I want to see the result of fft.

I hope you teach me how load and see the image using opengl simply!

hidefromkgb
08-04-2015, 07:12 PM
Actually, reading image files into textures is not a part of the library: there are no standard OpenGL functions that, say, take an image path and return a texture ID. So, you are to either use some helper library (which I don`t recommend to beginners; but that`s my personal opinion, not a thought-through maxima) or write the appropriate code yourself. Thankfully, it`s rather simple.

There is a family of functions that load data from RAM to texture memory, their names begin from glTexImage*. The function you now need is called glTexImage2D (https://www.opengl.org/wiki/GLAPI/https://www.opengl.org/wiki/GLAPI/glTexImage2D).
To provide a proper usage example, I need to know which programming language you are intending to use.

P.S.: glTexImage2D() alone won`t get you anywhere. There is some prior work to be done, like generating texture ID and making it current.