- Joined
- Dec 25, 2007
- Messages
- 415
- Trophies
- 0
- Age
- 44
- Location
- Bolton, England
- Website
- AGameAWeek.com
- XP
- 1,041
- Country
Having a very frustrating morning of development, this morning, so thought I should ask the community for guidance, since it's Friday 13th and I just know I'm going to break everything if I plough ahead like I currently am!!
DevKitPro - [current version as of April 13th 2018)
Citro3D - 1.3.1
I've got textures (spritesheets) loading in, and I can draw one at a time, but I need to draw more than one different spritesheet in the frame at once.
I've got my spritesheet textures loaded into static C3D_Tex spritesheet_tex[105];, from where I'm starting a Frame, setting the target, splodging vertexes into the array, and then drawing the array.
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C3D_FrameDrawOn(target);
// Update the uniforms
C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, uLoc_projection, &projection);
// Draw the VBO
C3D_DrawArrays(GPU_TRIANGLES, 0, numSprites);
C3D_FrameEnd(0);
The challenge I'm having is figuring out where and how to change the texture midway through.
eg, imagine the first 50 sprites are enemy sprites from spritesheet_tex[1], next 20 are bullets from spritesheet_tex[2], and the last couple are the player on spritesheet_tex[0]..
I've worked out that changing the TexBind will do *something* but it seems to result in the system trying to draw all the textures at once!! Bit chaotic.
I'm currently wondering if the C3D_FrameEnd and C3D_FrameBegin might act like OpenGL's glEnd and glBegin, but with them having the word "Frame" in there, I'm slightly worried that it might be doing something else, and I'll be slowing the whole thing down a bit..
(Having now tried this.. .. No, that's not it!!)
So, basically, what's the best technique for flicking through different spritesheets using C3D?
Any and all help would be greatly appreciated.
Thanks!
DevKitPro - [current version as of April 13th 2018)
Citro3D - 1.3.1
I've got textures (spritesheets) loading in, and I can draw one at a time, but I need to draw more than one different spritesheet in the frame at once.
I've got my spritesheet textures loaded into static C3D_Tex spritesheet_tex[105];, from where I'm starting a Frame, setting the target, splodging vertexes into the array, and then drawing the array.
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C3D_FrameDrawOn(target);
// Update the uniforms
C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, uLoc_projection, &projection);
// Draw the VBO
C3D_DrawArrays(GPU_TRIANGLES, 0, numSprites);
C3D_FrameEnd(0);
The challenge I'm having is figuring out where and how to change the texture midway through.
eg, imagine the first 50 sprites are enemy sprites from spritesheet_tex[1], next 20 are bullets from spritesheet_tex[2], and the last couple are the player on spritesheet_tex[0]..
I've worked out that changing the TexBind will do *something* but it seems to result in the system trying to draw all the textures at once!! Bit chaotic.
I'm currently wondering if the C3D_FrameEnd and C3D_FrameBegin might act like OpenGL's glEnd and glBegin, but with them having the word "Frame" in there, I'm slightly worried that it might be doing something else, and I'll be slowing the whole thing down a bit..
(Having now tried this.. .. No, that's not it!!)
So, basically, what's the best technique for flicking through different spritesheets using C3D?
Any and all help would be greatly appreciated.
Thanks!
Last edited by Jayenkai,
, Reason: Additional Testing