WorldToScreen Quake1

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
Neil
Posts: 3
Joined: Fri Oct 17, 2008 12:26 pm

WorldToScreen Quake1

Post by Neil »

hey, i was wondering if anyone had a WorldToScreen function for quake1, the function itself takes 3d world Coords and converts them to 2d co wards for x y in relation to your monitor, and help or ideas would be great, i have a function in quake that semi works ill post it later on if anyone is interested.
Urre
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon
Contact:

Post by Urre »

There's the cs_project/cs_unproject builtins in CSQC (clientside quakec) which do exactly what you describe, but CSQC is limited to the DarkPlaces and FTEQW ports at the moment...
I was once a Quake modder
Neil
Posts: 3
Joined: Fri Oct 17, 2008 12:26 pm

Post by Neil »

alight thanks, do u think it would help if i pasted my function?
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Post by Spike »

you should be able to obtain a copy of the projection and modelview matricies.
just multiply the source coord by those two matricies and you'll have the 2d coord. it'll typically come out as a value between -1 and 1, so it'll need scaling and biasing.

this is the 'project' function available to csqc.
Neil
Posts: 3
Joined: Fri Oct 17, 2008 12:26 pm

Post by Neil »

ive pretty much got it except for in relation to the players foward origin, if im on the same Z axis or i keep my mouse 'hovered' it works but any change to those 2 result in mixed results, ill clean my function up and post it, maybe it will help
Post Reply