Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Skew/distort an image

Author
Message
The ace of the spade
17
Years of Service
User Offline
Joined: 8th May 2009
Location: Everywhere
Posted: 17th Jun 2010 20:50
Does anyone know of a handy way to distort an image (in real time)? IE: I have 4 points, each one representing a corner of the image. Just wondering if anyone has anything already written or if I'm going to have to do some sort of weird memblock/matrix manipulation type thing.

“It is not clear that intelligence has any long-term survival value” -Stephen Hawking
Kira Vakaan
17
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 17th Jun 2010 22:17
This sounds exactly like the transformation that goes on everytime an object is textured. Why don't you just texture a plane with the image and then use the vertexdata commands to edit the shape?

Hope that helps.

Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 18th Jun 2010 01:40
Or alter the texture UV coords. You can also do this on sprites now.

My signature is NOT a moderator plaything! Stop changing it!
The ace of the spade
17
Years of Service
User Offline
Joined: 8th May 2009
Location: Everywhere
Posted: 19th Jun 2010 15:01
Thanks for the responses guys! Before I respond, some background:
I am developing a way of projecting 3d images (3d glasses 3d) onto 2d surfaces so that depth perception is taken into account, for the purposes of AR. As with most of my projects, I'm doing my proof of concept in dbp.

@Kira Vakaan - That was what I was originally doing. but the shape sometimes gets so distorted and stretched that clipping became a problem. Plus, I need to lair the effect several times, with the ability to separate the images, or even project the final image onto a 3d plain.
The other problem I ran into, and this may be fixable with an update or something, was that I was collecting images from multiple cameras, and dbp seemed to be confused about which camera to base the clipping off of.

@Mobiius - I may have an outdated version of dbp (its been a while sense I updated) but altering the sprite UV coords, presumably with SET SPRITE TEXTURE COORD, caused sprite's image to tile itself. If there is a way to stop it from tiling itself, or if this is simply a misunderstanding on my part, then that will definitely work.

Sorry for the delayed response, I was expecting the thing to email me when someone responded, but it didn't for some reason.

“It is not clear that intelligence has any long-term survival value” -Stephen Hawking

Login to post a reply

Server time is: 2026-07-25 08:30:11
Your offset time is: 2026-07-25 08:30:11