Exemple #1
0
    protected override void OnRenderFrame(FrameEventArgs e)
    {
        base.OnRenderFrame(e);

        GL.ClearColor(60 / 256f, 60 / 256f, 60 / 256f, 1);
        GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

        Matrix4 modelview = Matrix4.LookAt(Vector3.Zero, Vector3.UnitZ, Vector3.UnitY);

        GL.MatrixMode(MatrixMode.Modelview);
        GL.LoadMatrix(ref modelview);


        GL.MatrixMode(MatrixMode.Projection);
        GL.PushMatrix();
        GL.LoadIdentity();
        GL.Ortho(0, screenDimensions[0], screenDimensions[1], 0, -1, 1);
        GL.MatrixMode(MatrixMode.Modelview);
        GL.PushMatrix();
        GL.LoadIdentity();

        GLx.setColord(1, 1, 1);
        project(ref cLatLng, ref cOffset, getZoom());
        //mapPool.draw(cLatLng[0], cLatLng[1], zoom);

        GL.MatrixMode(MatrixMode.Modelview);
        GL.PopMatrix();
        GL.MatrixMode(MatrixMode.Projection);
        GL.PopMatrix();
        GL.MatrixMode(MatrixMode.Modelview);


        SwapBuffers();
    }
Exemple #2
0
        public Map(int[] mapDimensions)
        {
            this.mapDimensions = mapDimensions;
            int width = mapDimensions[0], height = mapDimensions[1];

            tex = GLx.createTexture(width, height);

            isImageValid = false;
        }
Exemple #3
0
        public void draw(double[] centerOffset, int[] screenSize, double zoom)
        {
            if (isBMPLoaded == 1)
            {
                GLx.copyBitmapIntoTexture(bmp, tex);
                bmp.Dispose();

                isBMPLoaded = 2;
            }
            if (isBMPLoaded == 2)
            {
                int width = mapDimensions[0], height = mapDimensions[1];

                double zF, cx, cy, ox, oy, dx, dy, dw, dh;
                zF = Math.Pow(2, zoom - this.zoom);

                cx = screenSize[0] / 2d;
                cy = screenSize[1] / 2d;
                ox = zF * offset[0] - centerOffset[0];
                oy = zF * offset[1] - centerOffset[1];
                dx = cx + ox - zF * width / 2d;
                dy = cy + oy - zF * height / 2d;

                dw = zF * width;
                dh = zF * height;

                GL.LoadIdentity();
                GLx.drawTexture(tex, dx, dy, dw, dh);

                if (!isImageValid)
                {
                    GLx.setColord(1, 0, 0);
                    GLx.drawRect(dx, dy, dw, dh, false);
                }

                GLx.setColord(1, 1, 1);
            }
        }