public Texture(GLGame glGame, string fileName)
        {
            this.m_GLGraphics = glGame.GetGLGraphics();
            this.m_FileName   = fileName;

            Load();
        }
        public SpriteBatcher(GLGraphics glGraphics, GLProgramParameter glProgramParam, int maxSprites)
        {
            m_NumVertices = maxSprites * 4;

            this.m_GlProgramParam     = glProgramParam;
            this.m_VerticesVec        = new Vector3[m_NumVertices];
            this.m_TextureCoordinates = new TextureCoord[m_NumVertices];
            this.m_Vertices           = new Vertices();
            this.m_BufferIndex        = 0;
            this.m_NumSprites         = 0;

            ushort[] indices = new ushort[maxSprites * 6];
            int      len     = indices.Length;
            ushort   j       = 0;

            for (int i = 0; i < len; i += 6, j += 4)
            {
                indices[i + 0] = (ushort)(j + 0);
                indices[i + 1] = (ushort)(j + 1);
                indices[i + 2] = (ushort)(j + 2);
                indices[i + 3] = (ushort)(j + 2);
                indices[i + 4] = (ushort)(j + 3);
                indices[i + 5] = (ushort)(j + 0);
            }

            m_Vertices.SetProgram(glProgramParam);
            m_Vertices.SetIndecies(indices);

            for (int i = 0; i < m_NumVertices; i++)
            {
                m_VerticesVec[i]        = new Vector3();
                m_TextureCoordinates[i] = new TextureCoord();
            }
        }
        protected override void OnHandleCreated(EventArgs e)
        {
            base.OnHandleCreated(e);

            base.InitializeContexts();
            graphics = new GLGraphics(this, Color.White);
            graphics.InitScene(worldTransform, Color.White);
        }
Example #4
0
        public TouchTestScreen(GLGame game) : base(game)
        {
            m_GLGraphics = game.GetGLGraphics();
            m_Camera     = new Camera2D(game.GetGLGraphics(), FRUSTRUM_WIDTH, FRUSTRUM_HEIGHT);

            m_AnimationSample = new AnimationSample();

            Setup();
        }
        public Camera2D(GLGraphics glGraphics, float frustrumWidth, float frustrumHeight)
        {
            this.m_GLGraphics   = glGraphics;
            this.FrustrumWidth  = frustrumWidth;
            this.FrustrumHeight = frustrumHeight;
            this.Position       = new Vector2(frustrumWidth / 2.0f, frustrumHeight / 2.0f);
            this.Position       = Vector2.Zero;
            this.Zoom           = 1.0f;

            m_ViewProjectionMatrix = Matrix4.Identity;
        }
        public void Update_GlView(bool desire)
        {
            if (this.IsDisposed || !loaded || this.IsHidden || this.Width <= 0 || this.Height <= 0)
            {
                return;
            }
            if (Form_MAnimation.inResetPanels)
            {
                return;
            }
            if (!desire)
            {
                if (!(comboBox_PlayMode.SelectedIndex <= 0 || (comboBox_PlayMode.SelectedIndex == 1 && mouseInView)))
                {
                    return;
                }
            }
            if (!glView.MakeCurrent())
            {
                return;
            }
            //Çå³ýÑÕÉ«ºÍÉî¶ÈΪ»º³å
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            //ÖØÖÃÄ£ÐÍÊÓͼ¾ØÕó
            GL.MatrixMode(MatrixMode.Modelview);
            GL.LoadIdentity();
            //»ñÈ¡ÆÁÄ»³ß´ç
            int glViewW = glView.Width;
            int glViewH = glView.Height;

            GLGraphics.resetClip(glViewW, glViewH);
            //Óð×É«Çå¿ÕÆÁÄ»
            GL.ClearColor(GraphicsUtil.getColor(Consts.colorDarkGray));
            //Ó³Éä×ø±êϵ
            matrixDraw.identity();
            matrixDraw.preScale(1.0f, -1.0f, 1.0f);
            matrixDraw.postTranslate(0, glViewH, 0.0f);
            float[] data = matrixDraw.getValue();
            GL.MultMatrix(data);
            //»æÖÆÄÚÈÝ
            MTimeLineHoder currentTimeLineHoder = form_MA.form_MTimeLine.currentTimeLineHoder;

            if (currentTimeLineHoder != null)
            {
                List <MFrame> frameEditList = form_MA.form_MTimeLine.getSameTimeFrames_Visible(play_frameID);
                foreach (MFrame frameEdit in frameEditList)
                {
                    if (frameEdit != null)
                    {
                        frameEdit.glDisplay(glViewW / 2, glViewH / 2, previewZoomLevel, null, false, play_frameID);
                    }
                }
                //²½½ø
                play_frameID++;
                if (play_frameID >= currentTimeLineHoder.getMaxFrameLen())
                {
                    play_frameID = 0;
                }
            }
            else
            {
                play_frameID = 0;
            }
            glView.SwapBuffers();
        }
Example #7
0
 public StaticLinkTestScreen(GLGame game) : base(game)
 {
     m_GLGraphics = game.GetGLGraphics();
 }