Viewpoint Change libcaelina

Discussion in '3DS - Homebrew Development and Emulators' started by Urbanshadow, Nov 24, 2015.

  1. Urbanshadow

    Urbanshadow GBAtemp Maniac

    Oct 16, 2015
    Ok, so I'm trying to set up 3d effects for libcaelina in my custom helper library for c++ and I don't really get how I'm supposed to change the viewpoint.

    We don't have gluLookAt so should I just glOrtho into the new position as in 2d?
    I guess that because glFrustum is set up in the examples.

    What is the "eye" separation advised to avoid headaches ?

    Thanks in advance.

    One more question: In a mid-complex scene how am I supposed to navigate? Moving the world instead of the viewpoint?
    Different question but related: Can I use texture pointers from libsfil into libcaelina's texture matrix and expect to see something?
    Last edited by Urbanshadow, Nov 24, 2015
  2. machinamentum

    machinamentum GBAtemp Regular

    Jul 5, 2015
    United States
    If by viewpoint you mean the conceptual 3D eye, then your view matrix is the inverse of your camera matrix. What this means if that if your camera is at XYZ(10,15,2) you need to apply the translation matrix of XYZ(-10,-15,-2) to your entire scene. To do this you can use set the modelview matrix to the inverse camera position then push the matrix whenever you need to set individual objects matrices. You should really avoid changing GL_PROJECTION as the matrix stack for it is very small and is only really meant to setup the projection transform.

    glPushMatrix();//save camera matrix onto the stack
    glPopMatrix();//restore camera matrix from the stack
    As for textures, Caelina is by design to work just like OpenGL 1.x textures so you can upload textures just as you would on a PC using image buffers (i.e. using stb_image or libpng).
  3. Urbanshadow

    Urbanshadow GBAtemp Maniac

    Oct 16, 2015
    Of course. I didn't actually think of moving into MODELVIEW for that. That's smart. kudos to you.
    libsfil is uses libpng so I assume it's ok. Glad to hear that.

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice