コード例 #1
0
        public override void OnGLPaint(C2DGraphics gr)
        {
            base.OnGLPaint(gr);
            if (mGLImageCach == null)
            {
                mGLImageCach = gr.GetImage(mGLImage);
                if (mGLImageCach == null)
                {
                    return;
                }
                mSubImgWidth = mGLImageCach.w / Style.SubImgCount;
            }
            GuiControlStyle stl = Style;

            if (stl.SubImgCount == 4)
            {
                GLPaint4(gr);
            }
            if (stl.SubImgCount == 1)
            {
                GLPaint1(gr, stl);
            }
            C2DImage cimg = stl.CheckedImageCach;

            if (Enabled && (cimg != null))
            {
                int chimgw = cimg.w / 2;
                int posx   = Checked ? chimgw : 0;
                gr.SetColor(stl.CheckedColor);
                gr.Image(cimg, posx, 0, chimgw, cimg.h, 0, 0, Width, Height);
            }
        }
コード例 #2
0
 public Quad3d()
 {
     points = new Point3d[4];
     for (int i = 0; i < 4; i++)
     {
         points[i] = new Point3d(0, 0, 0);
     }
     img     = null;
     imgname = null;
 }
コード例 #3
0
ファイル: ctlImage.cs プロジェクト: TenYearsADream/print3d-v2
 public override void OnGLPaint(C2DGraphics gr)
 {
     base.OnGLPaint(gr);
     if (mGLImageCach == null)
     {
         mGLImageCach = gr.GetImage(mGLImage);
         if (mGLImageCach == null)
         {
             return;
         }
         gr.SetColor(Style.ForeColor);
         gr.Image(mGLImageCach, 0, 0, mGLImageCach.w, mGLImageCach.h, 0, 0, Width, Height);
     }
 }
コード例 #4
0
        public void RenderGL()
        {
            if ((img == null) && (imgname != null))
            {
                img = UVDLPApp.Instance().m_2d_graphics.GetImage(imgname);
            }
            if (img != null)
            {
                GL.Enable(EnableCap.Texture2D);
                GL.BindTexture(TextureTarget.Texture2D, img.tex);
                //GL.Begin(BeginMode.Quads);
                GL.Begin(PrimitiveType.Quads);

                GL.Color3(Color.White);
                GL.TexCoord2(img.x2, img.y1);
                GL.Vertex3(points[0].x, points[0].y, points[0].z);
                GL.TexCoord2(img.x1, img.y1);
                GL.Vertex3(points[1].x, points[1].y, points[1].z);
                GL.TexCoord2(img.x1, img.y2);
                GL.Vertex3(points[2].x, points[2].y, points[2].z);
                GL.TexCoord2(img.x2, img.y2);
                GL.Vertex3(points[3].x, points[3].y, points[3].z);
                GL.End();

                GL.Disable(EnableCap.Texture2D);
            }
            else
            {
                GL.Begin(PrimitiveType.Quads);
                GL.Color3(col);
                for (int i = 0; i < 4; i++)
                {
                    GL.Vertex3(points[i].x, points[i].y, points[i].z);
                }
                GL.End();
            }
        }