Easy Pixel painting question

I have created a windows BMP file using Paint Shop Pro and I would like to be able to display this on a GLCanvas. I know this should be easy but I have searched the web, looked through a thick OPenGL book and still can’t seem to find out how to do this.

A few lines of code which give an example of how to do this would be highly useful.

Regards,

Sally

Hi,

Can’t you use png or Jpeg image instead of BMP… You’ll find a lot of code to use Texture with jogl for those formats. (A class for texture was posted on this forum but i can’t remember where, sorry)

Or you’ll have to write a piece of code that unpack bmp data into RGB value to draw it.

Yes, no problem , I’ll use PNG then. I’m probably going totally down the wrong path here but I have opened it up using ImageIcon image = new ImageIcon(“file.png”);

So, I have an image but I am completely at a loss as to how I convert it into pixels so that I can use the jogl interface to display it onto a GLCanvas.

What I want to do sounds so simple - load an image and display it onto a GLCanvas. But my opengl book covers, in great detail, many aspects of advanced 3d graphics rendering and image pipelines and image-storage modes etc but does not appear to address my simple issue … perhaps the book is too advanced for me at this stage and maybe what I want to do is so basic that it just assumes the reader knows how to do it already. ???

Regards,

Sally

glDrawPixels is the way to do this simply.

Cas :slight_smile:

You’ll find an easy way to draw an image here :

http://today.java.net/pub/a/today/2003/09/11/jogl2d.html

Hope it helps.

Thank you very much. Would you believe it, I’d actually spent a lot of time going through that document last week (it’s a very good jogl 2d starter) and learnt how to draw rectangles, lines, polygons etc. I’d totally forgotten it also demonstrated how to display a gif. :o I must be going senile at my tender age of 28.

Thanks

Regards,

Sally