2d hud lit by 3d lights
in
Programming Questions
•
9 months ago
I'm trying to draw a 2d hud over a 3d scene.
- void draw(){
- background (SKYCOLOR);
- directionalLight(255, 255, 255, -1, -2, -1);
- //draw 3d stuff
- player.draw();
- drawland();
- fill(255,0,0);
- //switch to 2d
- camera();
- println(p3d.zbuffer.length);
- for(int i=0; i<p3d.zbuffer.length; i++) {
- p3d.zbuffer[i] = Float.MAX_VALUE;
- }
- //draw 2d stuff
- rect(width/2-15,height/2-15,30,30);
-
- //back to 3d
- camera(pos.x,pos.y,pos.z, pos.x+face.x, pos.y+face.y, pos.z+face.z, 0,0,-1);
-
repeatkeys(); - }
1