Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

How do you create a orthographic worldviewprojection for draw

$
0
0

@willmotil wrote:

This only works with a spritebatch call using identity for view.

        private void SetCameraOrientationOrthagonal3D()
        {
            world = Matrix.Identity;
            //view = Matrix.Identity;
            view = Matrix.CreateLookAt(new Vector3(0, 0, 2), Vector3.Forward, Vector3.Up);
            projection = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0, -1f);
            worldviewprojectionorthagonal = world * view * projection;
        }

however for this i get nothing but blue screen in gl or dx

        public void DrawTestParticleEffect(GameTime gameTime)
        {
            TestParticleEffect.Parameters["MyOffset"].SetValue(backnforth);
            //TestParticleEffect.Parameters["WorldViewProjection"].SetValue(worldviewprojection); // works
            TestParticleEffect.Parameters["WorldViewProjection"].SetValue(worldviewprojectionorthagonal); // nop
            GraphicsDevice.Clear(Color.CornflowerBlue);
            foreach (EffectPass pass in TestParticleEffect.CurrentTechnique.Passes)
            {
                pass.Apply();
                GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, vertices, 0, 4, indices, 0, 2);
            }
        }

Posts: 6

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles