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 / stretching a rectangular sprite to fit various quadrilaterals?

Author
Message
BLOODWEANED
15
Years of Service
User Offline
Joined: 27th Nov 2010
Location:
Posted: 19th Feb 2011 19:40
Is there a way to stretch a rectangular sprite to fit to varying/changing quadrilaterals, and then use it as a 2d image? I came from GML and in that language, this was referred to as a textured primitive. I found a way to draw primitives in DBpro, but it automatically calculates 3d persepective before drawing the primitive. I want to draw it directly to the screen for use in a 2d game, but when it draws the primitive in perspective it changes the shape, etc.

Maybe there is a certain camera position and angle that allows the primitives to be projected normally?
By 'normally' I mean, if I place a square primitive with a width & height of 64 at position (0,0) it will draw a 2d-square in the top left corner of the screen, 64 pixels wide.

Please help and thanks in advance
enderleit
19
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 19th Feb 2011 21:55
I don't see the need for primitives here... just use sprite...

You can change the size or scale the sprite to be the size you want, and also do rotation, alpha mapping, etc...

SCALE SPRITE spr, scale
SIZE SPRITE spr, xSize, ySize
ROTATE SPRITE spr, angle

Maybe I missed something...?

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 20th Feb 2011 01:11 Edited at: 20th Feb 2011 01:14
You can use "set sprite texture coord" for more complicated transformations, although it works in reverse to what you are after. You can also use textured planes if you set the camera to an orthographic mode using a plugin (Cloggy's d3d plugin has the command "d3d_set_ortho_projection").

[b]
BLOODWEANED
15
Years of Service
User Offline
Joined: 27th Nov 2010
Location:
Posted: 20th Feb 2011 02:43
@diggsey: yeah that does exactly the opposite of what I need. Instead of putting a rectangular sprite onto varying quadrilaterals, it puts varying-quadrilateral-sprites onto a rectangle. Ugh Thanks though.

@enderleit: no matter how I resize it or rotate it, it will still be a rectangle. I want to take a rectangular image and convey it onto varying rhombuses (to be specific).

Login to post a reply

Server time is: 2026-07-17 13:59:00
Your offset time is: 2026-07-17 13:59:00