OpenGL ES questions regarding 2D mixed with 3D

Posts: 75
Joined: 2009.01
Post: #1
Just dove into OpenGL ES 2 days back and got quite a few done.
I am trying to create something similar to the newer generation pokemon games (diamond/pearl/platinum) but so far all I get is something that comes a bit close to it.

Basically all I want to ask:

How do you create that top down view effect.
I cannot quite get it and when it "looks" alright, it isn't when I move around the map.
Any advice?
Quote this message in a reply
Posts: 320
Joined: 2003.06
Post: #2
It sounds like you probably want to play with the field of view. Having a very narrow field of view and making the objects smaller or the camera further away will get closer to having an orthographic projection. If you don't want any perspective at all there is no reason why you can't use glOrtho with 3D objects.

Chopper, iSight Screensavers, DuckDuckDuck:
Quote this message in a reply
Posts: 75
Joined: 2009.01
Post: #3
Thing is, I've been playing around with the field of view and still cannot produce the effect I'm looking for.
Maybe it's because I don't understand glFrustumf fully but the fields I put it are from jeffs blog.
Quote this message in a reply
Posts: 1,563
Joined: 2003.10
Post: #4
glFrustum can be pretty confusing. gluPerspective is easier to visualize, but since glu isn't included with OpenGL ES, you'd need to do the matrix math yourself, then multiply the projection matrix by the result. There's an implementation of something nearly identical to gluPerspective in my matrix tutorial (see Matrix_applyPerspective).
Quote this message in a reply
Posts: 3,591
Joined: 2003.06
Post: #5
Here's my gluPerspective replacement:
void setPerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar)
    GLfloat xmin, xmax, ymin, ymax;

    ymax = zNear * tanf(fovy * M_PI / 360.0f);
    ymin = -ymax;
    xmin = ymin * aspect;
    xmax = ymax * aspect;

    glFrustumf(xmin, xmax, ymin, ymax, zNear, zFar);
Quote this message in a reply
Posts: 75
Joined: 2009.01
Post: #6
Thanks, i'll look at the tutorial.
I'll give that code a try too jake.
One thing I forgot to mention, I use gluLookAt.
from what I understand, the first three parameters for gluLookAt are the x,y,z coordinates for where you are looking "from".
The second three parameters are where you are looking "to".
I am not sure what the last three parameters do as I get some pretty confusing results.

Do you thing gluLookAt will help in achieving this top down view effect?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  OpenGL ES2... many questions vunterslaush 39 41,983 Sep 5, 2011 09:21 AM
Last Post: ipeku
  OpenGL: glRotate and some 3D questions. mikey 1 5,231 May 19, 2009 05:11 PM
Last Post: ThemsAllTook
  Basic OpenGL questions Mercy 5 6,989 Dec 23, 2008 10:25 AM
Last Post: AnotherJake
  Some OpenGL 2D questions oskob 16 13,787 Oct 30, 2008 12:12 PM
Last Post: Wowbagger
  Dreaded noob questions: OpenGL in a Cocoa App 5thPeriodProductions 5 6,913 Apr 10, 2006 11:08 AM
Last Post: 5thPeriodProductions