Author Topic: Help: rendering 3D mesh with different colors  (Read 130 times)

SuperReye

  • Newbie
  • *
  • Posts: 4
  • Karma: +2/-0
    • View Profile
    • Reye.me
Help: rendering 3D mesh with different colors
« on: January 27, 2019, 11:07:47 pm »
I have problems when drawing one mesh multiple times on screen, but with different colors.
When I try to change mesh color, draw it, and than change it again and draw it again not all quads change their color


Is there a proper way on how to do this?

Current source code: Source.zip
(Its currently setup for VSCode and i have jo engine on my NAS, so you need to change some paths in compile.bat and makefile to compile it)

Edit: I also have troubles with light being weird, but I'll probably figure out that eventually
« Last Edit: February 17, 2019, 10:52:02 pm by SuperReye »

SuperReye

  • Newbie
  • *
  • Posts: 4
  • Karma: +2/-0
    • View Profile
    • Reye.me
Re: Help: rendering 3D mesh with different colors
« Reply #1 on: February 02, 2019, 12:13:03 pm »
So I got some more free time to mess with this, and I probably figured it out.
Only thing what I had to do is to wait for some small amount of time, before saturn finishes drawing of the mesh and than continue with another one.



Code: [Select]
jo_3d_set_mesh_color(&MeshBalloon, balloon->Color);

// Draw balloon
jo_3d_push_matrix();
{
    jo_3d_translate_matrix_z(10);
    jo_3d_translate_matrixf(balloon->PositionX, (balloon->PopFrame * dropPerFrame) + woble + balloonYOffset, 0.0f);
    jo_3d_rotate_matrix_x(90);
       
    display_balloon_mesh(balloon->Air < balloonLifeTime ? JO_MIN(balloon->Air + baseLife, totalLife) / totalLife : 0.0f);
}
jo_3d_pop_matrix();

// wait here, makes colors work
for(int wait = 0; wait < 4000; wait++) {}

That opens another question, is there an interupt or some way to tell when mesh drawing has ended?

 

Sitemap 1 2 3 4 5 6 7 8 9 10 
SMF spam blocked by CleanTalk