Homebrew Viewpoint Change libcaelina

Urbanshadow

Well-Known Member
OP
Member
Joined
Oct 16, 2015
Messages
1,568
Trophies
0
Age
32
XP
1,658
Country
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,

machinamentum

Well-Known Member
Member
Joined
Jul 5, 2015
Messages
163
Trophies
0
XP
537
Country
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.

Example:
Code:
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslate(-camX,-camY,-camZ);

glPushMatrix();//save camera matrix onto the stack
glTranslate(objX,objY,objZ);
DrawMyObject();
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).
 

Urbanshadow

Well-Known Member
OP
Member
Joined
Oct 16, 2015
Messages
1,568
Trophies
0
Age
32
XP
1,658
Country
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.
Example: -snip-

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).

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.

Thanks.
 
General chit-chat
Help Users
  • Skelletonike @ Skelletonike:
    As long as it's not resetera, anywhere is ok really.
  • Skelletonike @ Skelletonike:
    resetera is just... cancerous
  • Vetusomaru @ Vetusomaru:
    is that Ultimate Hentai Kamen at your avatar?
  • Skelletonike @ Skelletonike:
    I see you're a person of culture.
  • Vetusomaru @ Vetusomaru:
    likewise
  • Skelletonike @ Skelletonike:
    It's a genuinely great manga.
  • Vetusomaru @ Vetusomaru:
    too bad it never got an anime adaption, even in the form of OVA since a tv series would be too censored for the manga's material.
  • Vetusomaru @ Vetusomaru:
    and yeah, great manga.
  • Skelletonike @ Skelletonike:
    no idea why it would be censored tbh, it has nothing to explicit
  • Skelletonike @ Skelletonike:
    compared to most midnight anime that air in japan
  • Vetusomaru @ Vetusomaru:
    we talk about same japanese tv that censors shit like teenage characters smoking
  • Skelletonike @ Skelletonike:
    I'd rather they censor smoking than cleavage like they do in the west.
  • Skelletonike @ Skelletonike:
    Smoking is bad for your health, boobs are good
  • Vetusomaru @ Vetusomaru:
    actually anime have also toned down fanservice a lot at the last 2 decades. when was the last time you saw nipples in anime that isnt hentai?
  • Skelletonike @ Skelletonike:
    in quite a few, once the uncensored version releases
  • Vetusomaru @ Vetusomaru:
    also seeing smoking at media wont make me want to smoke
  • Vetusomaru @ Vetusomaru:
    even at "uncensored" home releases they still show no nipples with few, rare exceptions
  • Skelletonike @ Skelletonike:
    It makes it seem cool, that's why smoking

    comercials were banned here in the 90s.
  • Vetusomaru @ Vetusomaru:
    even ecchi manga dont show nipples nowadays
  • Skelletonike @ Skelletonike:
    I'm reading several that do atm. x'D
  • Vetusomaru @ Vetusomaru:
    even it looks cool, i still hate smoking and i always hated smoking
  • Skelletonike @ Skelletonike:
    They're seinen though.
  • Skelletonike @ Skelletonike:
    But yeah, it also has to do with the fact that stuff are more sexualised

    now
  • Vetusomaru @ Vetusomaru:
    even at seinen i am reading, the only one that shows nipples sometimes is Oversized Sextet
    Vetusomaru @ Vetusomaru: even at seinen i am reading, the only one that shows nipples sometimes is Oversized Sextet