PDA

View Full Version : Selecting part of an image.



bladeGL
08-18-2006, 09:25 AM
Is there anyway that I could create something similar to selection boxes that are used in many photoediting software?

So I could select an area of an image and then later manipulate it.

Any give me any tips/hints/ideas to how this is done?

Thank you in advance for your help!

Zengar
08-18-2006, 11:08 AM
If you just want do draw a selection box, this should not be a problem. Just map your mouse coordinates to scene coordinates and draw a rectangle using these. Look into gluProject, gluUnproject (are this correct names?).
If you are writing photoediting software, I guess you use ortogonal projections. In this case you can just map the coordinates manually (it is flat anyway and the coorinate system is known too). If you have only one image, just draw it as a texture on a full-screen rect - this way you will get the texture coordinates of the image.

Hovewer, this is all pretty basic. Maybe I missunderstood your question...

RigidBody
08-18-2006, 02:49 PM
Originally posted by Zengar:
Hovewer, this is all pretty basic. Maybe I missunderstood your question... maybe that's why he posted in the beginners' forum :p

anyway, Zengar is right, gluProject is what you need. just note that in OGL (0,0) in window coordinates is the bottom left window corner, but in windows (0,0) is the top left corner.

bladeGL
08-18-2006, 04:35 PM
Hey thanks for the help Zengar and RigidBody, I don't have time to put your help into practise until Monday.

If its not too much trouble could you please check this topic then, just incase I cant quite get it working.

Thanks again!