Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If you need to send vertices mid-frame, don't use a buffer, it doesn't work. Use immediate mode instead. #57

Open
LexiBigCheese opened this issue Jan 19, 2025 · 1 comment

Comments

@LexiBigCheese
Copy link

right now i use this:

use citro3d_sys::{C3D_ImmDrawBegin,C3D_ImmDrawEnd,C3D_ImmSendAttrib};
use ctru_sys::GPU_TRIANGLES;

pub fn imm(f: impl FnOnce()) {
    unsafe {
        C3D_ImmDrawBegin(GPU_TRIANGLES);
    }
    f();
    unsafe {
        C3D_ImmDrawEnd();
    }
}

pub fn attr(xyzw: [f32;4]) {
    unsafe {
        C3D_ImmSendAttrib(xyzw[0],xyzw[1],xyzw[2],xyzw[3]);
    }
}

this is, of course, not sound in the slightest, but could be fixed by some sort of struct that when created, ImmDrawBegin and when dropped, ImmDrawEnd,
The programmer should be informed that the struct needs to be dropped, and a convenience method that takes FnOnce(TheStruct) should be supplied.

@LexiBigCheese
Copy link
Author

if you do try to LINEAR the vertices, the vertex and index data will overwrite itself before the GPU even sees it, resulting in a very strange image (when implementing egui, this manifested as having a white screen unless i drew a degenerate triangle, causing portions of the screen to be visible but a simple RGB color, weird graphical glitches in general pretty much. and it did not matter if i was drawArrays or drawElements aka using indices)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant