… | |
… | |
21 | return true; |
21 | return true; |
22 | } |
22 | } |
23 | |
23 | |
24 | void view::draw (draw_context &ctx) |
24 | void view::draw (draw_context &ctx) |
25 | { |
25 | { |
|
|
26 | // check occlusion queries here |
|
|
27 | |
|
|
28 | ctx.generation++; |
|
|
29 | |
|
|
30 | //renormalize (orig, p); |
26 | |
31 | |
27 | if (ctx.mode == draw_context::DEPTH) |
32 | if (ctx.mode == draw_context::DEPTH) |
28 | { |
33 | { |
29 | glEnable (GL_POLYGON_OFFSET_FILL); |
34 | glEnable (GL_POLYGON_OFFSET_FILL); |
30 | glPolygonOffset (0, 1); |
35 | glPolygonOffset (0, 1); |
31 | glDrawBuffer (GL_NONE); |
|
|
32 | glDepthFunc (GL_LESS); |
36 | glDepthFunc (GL_LESS); |
33 | glDisable (GL_LIGHTING); |
37 | glDisable (GL_LIGHTING); |
|
|
38 | glColorMask (0, 0, 0, 0); |
34 | } |
39 | } |
35 | else |
40 | else |
36 | { |
41 | { |
37 | glDisable (GL_POLYGON_OFFSET_FILL); |
42 | glDisable (GL_POLYGON_OFFSET_FILL); |
38 | glDrawBuffer (GL_BACK); |
43 | glDrawBuffer (GL_BACK); |
39 | glDepthFunc (GL_LEQUAL); |
44 | glDepthFunc (GL_LEQUAL); |
40 | glEnable (GL_LIGHTING); |
45 | glEnable (GL_LIGHTING); |
|
|
46 | glDepthMask (0); |
41 | } |
47 | } |
42 | |
48 | |
43 | glViewport (0, 0, w, h); |
49 | glViewport (0, 0, w, h); |
44 | |
50 | |
45 | glMatrixMode (GL_PROJECTION); |
51 | glMatrixMode (GL_PROJECTION); |
… | |
… | |
67 | glMatrixMode (GL_MODELVIEW); |
73 | glMatrixMode (GL_MODELVIEW); |
68 | glLoadIdentity (); |
74 | glLoadIdentity (); |
69 | glTranslatef (-p.x, -p.y, -p.z); |
75 | glTranslatef (-p.x, -p.y, -p.z); |
70 | |
76 | |
71 | world.draw (ctx); |
77 | world.draw (ctx); |
|
|
78 | |
|
|
79 | ctx.drawn.clear (); |
|
|
80 | |
|
|
81 | glColorMask (1, 1, 1, 0); |
|
|
82 | glDepthMask (1); |
72 | } |
83 | } |
73 | |
84 | |