void RenderableWater_WriteNextFrameEvent(Vector3 camerapos) { double xmultiplier = scale.x / numsectors; double ymultiplier = scale.y / numsectors; GraphicsHelperGl g = new GraphicsHelperGl(); g.SetMaterialColor(new double[] { 0, 0.2, 0.8, 0.6 }); g.EnableBlendSrcAlpha(); g.EnableModulate(); g.DisableTexture2d(); // note to self: could add texture??? (or vertex fragment) Gl.glDisable(Gl.GL_CULL_FACE); // water has two sides? g.Normal(new Vector3(0, 0, 1)); for (int x = 0; x < numsectors; x++) { Gl.glBegin(Gl.GL_TRIANGLE_STRIP); for (int y = 0; y <= numsectors; y++) { Vector3 posoffset = new Vector3(x * xmultiplier, y * ymultiplier, 0); Vector3 vertexpos = pos + posoffset; //Console.WriteLine(vertexpos); g.Vertex(vertexpos); vertexpos.x += xmultiplier; //Console.WriteLine(vertexpos); g.Vertex(vertexpos); } Gl.glEnd(); } Gl.glEnable(Gl.GL_CULL_FACE); Gl.glDisable(Gl.GL_BLEND); g.SetMaterialColor(new double[] { 1, 1, 1, 1 }); }
void RenderableWater_WriteNextFrameEvent(Vector3 camerapos) { double xmultiplier = scale.x / numsectors; double ymultiplier = scale.y / numsectors; GraphicsHelperGl g = new GraphicsHelperGl(); g.SetMaterialColor(new double[] { 0, 0.2, 0.8, 0.6 }); g.EnableBlendSrcAlpha(); g.EnableModulate(); g.DisableTexture2d(); // note to self: could add texture??? (or vertex fragment) Gl.glDisable( Gl.GL_CULL_FACE ); // water has two sides? g.Normal(new Vector3(0, 0, 1)); for (int x = 0; x < numsectors; x++) { Gl.glBegin(Gl.GL_TRIANGLE_STRIP); for (int y = 0; y <= numsectors; y++) { Vector3 posoffset = new Vector3( x * xmultiplier, y * ymultiplier, 0 ); Vector3 vertexpos = pos + posoffset; //Console.WriteLine(vertexpos); g.Vertex(vertexpos); vertexpos.x += xmultiplier; //Console.WriteLine(vertexpos); g.Vertex(vertexpos); } Gl.glEnd(); } Gl.glEnable( Gl.GL_CULL_FACE ); Gl.glDisable( Gl.GL_BLEND ); g.SetMaterialColor(new double[] { 1, 1, 1, 1 }); }