Homebrew How to move the render camera with libctru?

displayname

New Member
Newbie
Joined
Dec 28, 2020
Messages
3
Reaction score
0
Trophies
0
Age
25
XP
64
Country
United States
Hi all! This is my first post here, and although this may be a stupid question, I haven't been able to find anything about it and it's really bugging me. I want to make a 3DS game with a 3D environment, and the graphics examples in devkitpro have been very helpful for learning the basics. But I've been stumped with something I thought would be pretty simple; how does one move the camera that renders the scene?

Lets take the lenny example scene in graphics/gpu/lenny as an example, suppose I want to move the camera on the X, Y, or Z axis to look at the lenny model in all of it's glory. How does one do this? I've looked through the libctru documentation, and although I've relatively experienced in C/C++ (it being the first language I learned), it's all rather foreign to me. Again, sorry if this is a stupid question, I've just been stumped with it. Thanks! :D
 
The shader in the Lenny example uses the traditional model view and projection matrixes used by 3D apis. You will need to translate and rotate the model view matrix to change the view. The matrix is used by the shader to translate object coordinates to view coordinates. If you are unfamiliar with this then I recommend taking a look at similar procedures with OpenGL.
 
  • Like
Reactions: displayname
The shader in the Lenny example uses the traditional model view and projection matrixes used by 3D apis. You will need to translate and rotate the model view matrix to change the view. The matrix is used by the shader to translate object coordinates to view coordinates. If you are unfamiliar with this then I recommend taking a look at similar procedures with OpenGL.

Drats, I knew I should have familiarized myself with openGL before diving head first into something like this lol.

In any case, if it's no trouble, is there a quick explanation on how to change the model view matrix in real time with libctru? (For instance, on press A button move on the X axis, etc etc)
 
Drats, I knew I should have familiarized myself with openGL before diving head first into something like this lol.

In any case, if it's no trouble, is there a quick explanation on how to change the model view matrix in real time with libctru? (For instance, on press A button move on the X axis, etc etc)
Take a look at the wide_mode_3d gpu example. It looks like it can rotate a bit.
The best advice is really just give it a go yourself - and reserve questions for when you have something specific to ask after you have tried something yourself.
 
  • Like
Reactions: displayname
Take a look at the wide_mode_3d gpu example. It looks like it can rotate a bit.
The best advice is really just give it a go yourself - and reserve questions for when you have something specific to ask after you have tried something yourself.

Fair enough, thanks for the pointers! Will be taking a look at the provided example :D
 

Site & Scene News

Popular threads in this forum