Getting A Classic Zelda View - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Getting A Classic Zelda View (/thread-6311.html)
Getting A Classic Zelda View - Nick - Aug 21, 2004 10:54 PM
How can I get a classic Zelda view without the standard "distorting" of motion due to being full 3D with OpenGL? I'm really trying to get this down and implement it in a game I'm working on.
Getting A Classic Zelda View - Nick - Aug 22, 2004 12:36 AM
I've found that if I position my camera a ways up the Y axis and a little out the Z axis and look at the origin, it doesn't look too different (besides motion distortion). One thing I'm curious about is whether or not there is a way to create quads that a perpendicular to the camera's vector so that they appear perfect (whereas leaving them going straight along the Y axis would make the bottom look smaller)? If anybody knows how to create a method of fixing the motion distortion and how to make quads look perfect in this view, I would much appreciate it.
Getting A Classic Zelda View - Nick - Aug 22, 2004 12:58 AM
I have found that (see above post) to be a very inefficient way of getting the results I desire. I'm going to play a lot of Zelda, look at some screenshots, and then I'm going to try again.
Getting A Classic Zelda View - codemattic - Aug 22, 2004 01:38 AM
have you tried using an orthographic projection matrix?
Getting A Classic Zelda View - Fenris - Aug 22, 2004 05:34 AM
I think what you want is a google search for "billboarding".
Getting A Classic Zelda View - Nick - Aug 22, 2004 08:41 AM
Thanks for the help Fenris. That's exactly what I need for the sprites. I'm looking into the gluOrtho2D and glOrtho right now and I'll let you know how that goes.
Getting A Classic Zelda View - Nick - Aug 22, 2004 09:12 AM
I've found a declaration of gluOrtho2D and glOrtho but I'm unsure how to use them and how they will help.
Getting A Classic Zelda View - skyhawk - Aug 22, 2004 09:27 AM
Getting A Classic Zelda View - Skorche - Aug 22, 2004 09:33 AM
glOrtho(left, right, bottom, top, near, far)
It's quite simple. The left right top and bottom parameters should be fairly self explanatory, the near and far set the minimum and maximum z coordinates.
glOrtho2D is the exact same thing, but it automatically puts in -1, and 1 for the near and far parameters.
Getting A Classic Zelda View - Nick - Aug 22, 2004 09:45 AM
Here's my code so far and I'm not seeing anything on the screen:
Getting A Classic Zelda View - SOUR-Monkey - Aug 22, 2004 07:07 PM
Use glOrtho(-10, 10, -10, 10, 1, 20); to set it up. Then do a translate like below:
glTranslatef(0.0f, 0.0f, -10.0f);
before you do any rendering (ie. one of the first lines in your render function).
This will set up your orthographic screen, and translate the camera out so that you can see it.
EDIT: Also, don't pass ints if you should be passing floats. In your glVertex2f() calls you are passing int values, which is just plain silly. Use (+-)5.0f, or call glVertex2i() instead.
Getting A Classic Zelda View - codemattic - Aug 22, 2004 08:15 PM
for a more visual explaination check out http://fly.cc.fer.hr/~unreal/theredbook/chapter03.html and scroll down to the section "Projection Transformations."
Getting A Classic Zelda View - arekkusu - Aug 22, 2004 09:07 PM
Typical 2D ortho projection is something like:
Since the Z coordinate doesn't mean anything in a 2D projection, you don't have to translate the camera out.
Also, this is perfectly fine:
Getting A Classic Zelda View - Nick - Aug 22, 2004 09:42 PM
Thanks. That got it working. I also had a problem with the fact that my camera class was still setting itself up awkwardly not in the right position so (0,0) wound up at the top of the middle of the screen because the camera was putting itself at (0,0).
Getting A Classic Zelda View - Nick - Aug 22, 2004 10:16 PM
A couple more questions. This gluOrtho2D sets my upper left corner to (0,0) (in your example, arekkusu) and my lower right to (gamewidth,gameheight) correct? So why when I draw things they seem to ignore this and act as they usually would (for instance subtracting from Y seems like it should move up with 0 being the top but it still moves down)?
Also, how can I make sure that things that are higher in Y are drawn above the objects with lower Y values to simulate the Zelda look? For example:
P is large enough to go into O, how do I get it to draw P above O and still draw O (so that when I put in sprites with transparency O is still visible)?