Tag: quad

XNA – 以正确的顺序绘制四边形(和基元)

我对XNA中的3D内容很新,不幸的是我遇到了一个问题我无法找到解决方案。 (甚至不知道问题是什么)。 简而言之:我在游戏中使用以下方法绘制四边形: effect.World = Matrix.Identity * Matrix.CreateRotationX(Rotation.X) * Matrix.CreateRotationY(Rotation.Y) * Matrix.CreateRotationZ(Rotation.Z) * Matrix.CreateTranslation(Position); // Apply camera-matrixes effect.View = viewMatrix; effect.Projection = projectionMatrix; graphics.VertexDeclaration = vertDec; // Begin effect drawing effect.Begin(); foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Begin(); graphics.DrawUserIndexedPrimitives ( PrimitiveType.TriangleList, quad.Vertices, 0, 4, quad.Indexes, 0, 2); pass.End(); } effect.End(); 我的效果也有这些属性: this.effect.TextureEnabled = true; this.effect.Texture […]

C#OpenTK – 纹理四边形

我最近下载了OpenTK。 我创建了一个基本的游戏类和四元组。 我尝试在我的四边形中渲染纹理,但它不起作用。 这是我的代码。 这是纹理的加载。 (纹理类只包含一个ID和一个Bitmap.GetWidth()和GetHeight()只返回Bitmap.Width和Bitmap.Height)。 Texture Texture = new Texture (); Texture.Bitmap = new Bitmap (Path); Texture.ID = GL.GenTexture (); GL.BindTexture (TextureTarget.Texture2D, Texture.ID); BitmapData data = Texture.Bitmap.LockBits (new Rectangle (0, 0, Texture.GetWidth (), Texture.GetHeight ()), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); GL.TexImage2D (TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, Texture.GetWidth(), Texture.GetHeight(), 0, OpenTK.Graphics.OpenGL.PixelFormat.Rgba, PixelType.Bitmap, data.Scan0); Texture.Bitmap.UnlockBits (data); GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)All.Linear); GL.TexParameter […]