In my graphing calculator program, I'm planning on adding a 3D graphing capability. It's an obvious addition, considering it's a 3DS app after all.
I used sf2dlib to draw the graphics. I'm planning on using Caelina, which is basically a port of OpenGL, for the 3D drawing. The bottom screen will always be drawn with sf2dlib. The top screen will also be drawn in sf2dlib, like it is now, for the 2D mode, but when you activate 3D mode, it will switch to using Caelina to draw the top screen.
I already have a branch for testing this. I made it so you switch modes by pressing A (this is most likely just a placeholder, so I can test it before I implement a menu) but I'm running into a problem. Obviously, when I first start the program, it works fine. When I switch to 3D mode, the top screen is drawn correctly, but none of the graphics appear on the bottom screen. It's just solid gray, the shade of gray I have set as the sf2dlib clear color.
When I switch back to 2D mode, it really starts acting weird. In Citra, everything drawn with sf2dlib is blue, which is the color of the last vertex it drew with 3D mode on. On an actual 3DS, it looks really weird, with everything being drawn with seemingly random vertex colors that I had used. It goes back to normal if I suspend and resume the app.
Since suspending it fixes the glitched graphics in 2D mode, I'm guessing there's some function I can call when I exit 3D mode to reset the GPU or something. But there's still the issue of the bottom screen not drawing while in 3D mode, which that doesn't fix.
Here's the source code for the branch that exhibits this issue.
This is what it looks like when I first launch the app:
This is what it looks like after I enable 3D mode (note that the bottom screen is supposed to look exactly the same as the previous image):
And this is what it looks like after switching back:
How am I supposed to use these libraries together in the way I want?
I used sf2dlib to draw the graphics. I'm planning on using Caelina, which is basically a port of OpenGL, for the 3D drawing. The bottom screen will always be drawn with sf2dlib. The top screen will also be drawn in sf2dlib, like it is now, for the 2D mode, but when you activate 3D mode, it will switch to using Caelina to draw the top screen.
I already have a branch for testing this. I made it so you switch modes by pressing A (this is most likely just a placeholder, so I can test it before I implement a menu) but I'm running into a problem. Obviously, when I first start the program, it works fine. When I switch to 3D mode, the top screen is drawn correctly, but none of the graphics appear on the bottom screen. It's just solid gray, the shade of gray I have set as the sf2dlib clear color.
When I switch back to 2D mode, it really starts acting weird. In Citra, everything drawn with sf2dlib is blue, which is the color of the last vertex it drew with 3D mode on. On an actual 3DS, it looks really weird, with everything being drawn with seemingly random vertex colors that I had used. It goes back to normal if I suspend and resume the app.
Since suspending it fixes the glitched graphics in 2D mode, I'm guessing there's some function I can call when I exit 3D mode to reset the GPU or something. But there's still the issue of the bottom screen not drawing while in 3D mode, which that doesn't fix.
Here's the source code for the branch that exhibits this issue.
This is what it looks like when I first launch the app:
This is what it looks like after I enable 3D mode (note that the bottom screen is supposed to look exactly the same as the previous image):
And this is what it looks like after switching back:
How am I supposed to use these libraries together in the way I want?