コード例 #1
0
        // print
        public void printLine(float x, float y, string text)
        {
            if (String.IsNullOrEmpty(text))
            {
                return;
            }
            if (!initialized)
            {
                return;
            }

            // get the viewport size
            int[] viewport = new int[4];
            glView.glGetIntegerViewport(ref viewport);

            // We want a coordinate system where things coresponding to window pixels.
            pushScreenCoordinateMatrix();

            // add attributes
            glView.glPushAttribTransformListCurrentEnable();
            glView.glMatrixModeModelView();
            glView.glDisableLighting();
            glView.glEnableTexture2D();
            glView.glDisableDepthTest();
            glView.glEnableBlend();

            glView.glBlendFunc_SrcAlpha_DstOneMinusSrcAlpha();

            uint font = list_base;

            glView.glListBase(list_base);

            float[] modelview_matrix = new float[16];
            glView.glGetFloatModelviewMatrix(ref modelview_matrix);

            // draw the text
            glView.glPushMatrix();
            glView.glLoadIdentity();
            glView.glTranslate(x, viewport[3] - y - height, 0);
            glView.glMultMatrix(modelview_matrix);

            //
            byte[] bText = System.Text.Encoding.ASCII.GetBytes(text);
            glView.glCallListsByte(bText.Length, bText);

            glView.glPopMatrix();

            // release attributes
            glView.glPopAttrib();

            pop_projection_matrix();
        }