Search Results

Search found 1 results on 1 pages for '131nary'.

Page 1/1 | 1 

  • Textured Primitives in XNA with a first person camera

    - by 131nary
    So I have a XNA application set up. The camera is in first person mode, and the user can move around using the keyboard and reposition the camera target with the mouse. I have been able to load 3D models fine, and they appear on screen no problem. Whenever I try to draw any primitive (textured or not), it does not show up anywhere on the screen, no matter how I position the camera. In Initialize(), I have: quad = new Quad(Vector3.Zero, Vector3.UnitZ, Vector3.Up, 2, 2); quadVertexDecl = new VertexDeclaration(this.GraphicsDevice, VertexPositionNormalTexture.VertexElements); In LoadContent(), I have: quadTexture = Content.Load<Texture2D>(@"Textures\brickWall"); quadEffect = new BasicEffect(this.GraphicsDevice, null); quadEffect.AmbientLightColor = new Vector3(0.8f, 0.8f, 0.8f); quadEffect.LightingEnabled = true; quadEffect.World = Matrix.Identity; quadEffect.View = Matrix.CreateLookAt(cameraPosition, cameraTarget, Vector3.Up); quadEffect.Projection = this.Projection; quadEffect.TextureEnabled = true; quadEffect.Texture = quadTexture; And in Draw() I have: this.GraphicsDevice.VertexDeclaration = quadVertexDecl; quadEffect.Begin(); foreach (EffectPass pass in quadEffect.CurrentTechnique.Passes) { pass.Begin(); GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionNormalTexture>( PrimitiveType.TriangleList, quad.Vertices, 0, 4, quad.Indexes, 0, 2); pass.End(); } quadEffect.End(); I think I'm doing something wrong in the quadEffect properties, but I'm not quite sure what.

    Read the article

1