Skip to content

Out of order drawing for 3D / Layered 3D rendering? #2373

Discussion options

You must be logged in to vote

So, I think I figured it out following raysan's suggestions in #682. What you need is:

  1. Create two (or more) render textures, I think normal textures are fine, but that's what I did.
  2. Wrap every region you want to draw with your texture with the BeginX() and EndX() functions you currently use.
    You can clear the background with whatever color you want.
BeginTextureMode(bg);
ClearBackground(RAYWHITE);
BeginMode3D(camera);

// DrawCube() or any other 3D drawing function

EndMode3D();
EndTextureMode();
  1. For the foreground, you should do the same as step 2, but clear the background with a color with alpha equal to zero.
    You can play with the alpha to get cool effects like dimming the backgroun…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@KnockerPulsar
Comment options

@KnockerPulsar
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by KnockerPulsar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants