PDA

View Full Version : displaying textures and drag it



maya
04-03-2002, 07:47 PM
Could anyone tell me how we can display so many bitmaps on the screen?.And i want to click and paste the picture wherever i like.
Kindly reply,
Thanks in advance

immy
04-03-2002, 08:19 PM
hi
I think its possible. I havn't tried it but you should try the following functions.
use function
gluProject(...) & gluUnProject(...) to select the texture with the mouse & then drag it & also change the texture corrds with respect to mouse drag. May be you can move the whole primitive with this function.
Good Luck.

Zomart
04-03-2002, 08:50 PM
What I would do is texture map a rectangle with the bitmap and then translate the rectangle. OpenGL has picking support and you can use it to tell when the rectangle has been clicked. You can then have it follow the mouse coordinates wherever it is moved. OpenGL will not help you with the mouse coordinates. If it's on Microsoft Windows, you will have to use the Win32 API (or whatever you're using - MFC?) to retrieve mouse data. You can read about picking in the OpenGL Redbook (OpenGL Programming Guide Chapter 13-Selection and Feedback).

Hope it helps...

[This message has been edited by Zomart (edited 04-03-2002).]

[This message has been edited by Zomart (edited 04-03-2002).]

Zomart
04-03-2002, 08:58 PM
Another thing you might do is use Orthographic projection instead of Perspective. If you're only going to be moving the textures in the "x" and "y" directions, there is no reason to have the "z" values making calcluations harder. As immy said, the gluProject() and gluUnproject() functions can be used in creating your own picking methods, but for you're needs the OpenGL picking should work just fine.

Hope it helps...

Furrage
04-04-2002, 05:16 AM
Use gluProject() and gluUnproject(). Also search the forum on these topics as well as picking and selection. There's a lot of useful posts on the subject.

maya
04-05-2002, 02:07 AM
hi,
Thanks for the reply.I'll try with that and let you know if it works fine for me!