Page 1 of 1

rotate an image

Posted: Tue Jul 22, 2014 9:50 pm
by Nahuel
There is an easy way to rotate an image in csqc? drawpic has no an option to change the angles of an image, but I guess there must be a way to do it. Thanks in advance :D :D

Re: rotate an image

Posted: Wed Jul 23, 2014 5:50 pm
by gnounc
Unfortunately there is not. Not in the 2d drawing routines. It's a feature I think is sorely missing.
If you need to rotate something, you can attatch it to a model in 3d space and rotate it.
Not pefect, but it should do the trick

Re: rotate an image

Posted: Wed Jul 23, 2014 6:05 pm
by goldenboy
Draw a polygon with the image applied as a shader, and rotate that. This also allows you to have perspectivic HUD images, like Crysis 2 and all those other modern games. Alternatively, perhaps use a particle if you want to do crazier things wth images.

Otherwise, if someone creates a patch that adds the feature without breaking other stuff, it can't hurt to post it. :wink:

Re: rotate an image

Posted: Wed Jul 23, 2014 10:30 pm
by Spike
there's two methods, neither is pretty.

the official method is to use the beginpolygon+polygonvertex+endpolygon builtins. 2d-mode is achieved with some flag to beginpolygon. then do your own sin+cos stuff to work out the 2d coords of the various verts and job done.

things to bear in mind:
FTE expects shader names with the argument to beginpolygon (overriding blend modes is thus considered evil, but should work).
DP expects texture names, and does not support shaders (this means you can't override things like culling, alpha masking, etc, and can't combine masks with textures or other weird and whacky stuff).



the fun method (which is excessive and isn't possible/practical in dp) is to write some glsl to do the rotation for you, however it can be a challenge compacting the info enough for it to be useful.
obviously, this method is much more work, but if you're doing weird distortion effects then this method wins.


there is no specific 'drawpicrotated' builtin. the issue is that then people would ask for a drawsubpicrotated builtin too, or something like that. you have to draw the line somewhere.
the 2d-mode of drawpolygon is meant to allow you to just generate your own damn geometry, instead of relying upon the engine for every little thing. :P
as a side note, 2d-mode could also be known as immediate mode as these calls go directly to the screen. note that it uses the 2d virtual size (consistant with drawpic), with depth, rather than 3d world coords.

Re: rotate an image

Posted: Mon Jul 28, 2014 10:24 am
by pitchatan
Wouldnt a shader using tcMod rotate work in fte?

Re: rotate an image

Posted: Mon Jul 28, 2014 11:05 am
by Spike
yeah, tcmods should work. the problem is that the only input a tcmod can use is time, if you want it spinning at a constant rate with no other control then sure.

Re: rotate an image

Posted: Mon Jul 28, 2014 2:12 pm
by goldenboy
good thinking there pitchatan.

Re: rotate an image

Posted: Sun Feb 08, 2015 12:57 am
by gnounc
an omission no more!

http://forums.inside3d.com/viewtopic.ph ... 604#p55604

fte now supports void(vector pivot, vector mins, vector maxs, string pic, vector rgb, float alpha, float angle) drawrotpic = #0;

the link above will show you how to use it