Jump to content
  • Advertisement
Sign in to follow this  
ohnnyj

Working In Screen Coordinates

This topic is 2572 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all:

New here and new to game development in general. This is a graphics API agnostic question but specifically I am working in WebGL.

I come from a UI design background and have done quite a bit of development in Flash. What I always found nice about working in this environment was its psuedo-3d API. I could still working in screen coordinates but at the same time, the object could be made to appear with perspective.

For example, I could animate an object's x,y, and z properties and rotate on any axis giving a 3d like effect all in screen coordinates.

Now coming to the OpenGL / WebGL world should I throw out this concept and worry about world space coordinates only?

Sorry for the what may seem like an idiotic question.

I guess what I am really trying to ask is how do other people tackle a project such as building a complex user interface which has to be pixel precise but contains 3d effects.

Thanks for your help.

- john

Share this post


Link to post
Share on other sites
Advertisement
The screen coordinate system and the world coordinate system are two distinct spaces, and you need to transform data from space to the other via the matrices mentioned by VildNinja.

For instance, you may wish to display 3D world data with a HUD on top. Both of these rendering steps would require their own transformation steps. One could use perspective transformation to emulate a camera for rendering scene geometry (defined in metres). Meanwhile, the HUD assets, defined in pixel units, would need an orthographic transform for rendering. Note, these units are examples, you could use furlongs and yards if you are so inclined, it doesn't really matter.

Here is a crappy, oversimplified visual example how GL works:

3D World Space (Metres) ------> Perspective Transform -> |
HUD Assets (Pixels) ----------> Othrographic Transform -> | -> Normalised Device Coordinates -> Viewport
Other Stuff (Whatever Units) -> Other Stuff Transform --> |

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!