나는 다음과 같다 몇 가지 코드를 가지고 :별도의 파일에서 밉맵을 생성하고 사용하려면 어떻게해야합니까?
_bfTex = new Texture(TextureTarget.Texture2D, true);
_bfTex.Image2D("Textures/sphax/terrain128.png", 0);
_bfTex.Image2D("Textures/sphax/terrain64.png", 1);
_bfTex.Image2D("Textures/sphax/terrain32.png", 2);
_bfTex.Image2D("Textures/sphax/terrain16.png", 3);
_bfTex.Image2D("Textures/sphax/terrain8.png", 4);
_bfTex.Image2D("Textures/sphax/terrain4.png", 5);
_bfTex.Image2D("Textures/sphax/terrain2.png", 6);
_bfTex.Image2D("Textures/sphax/terrain1.png", 7);
_bfTex.SetMinFilter(TextureMinFilter.NearestMipmapNearest);
_bfTex.SetMagFilter(TextureMagFilter.Nearest);
_bfTex.SetParameter(TextureParameterName.TextureWrapS, TextureWrapMode.ClampToEdge);
_bfTex.SetParameter(TextureParameterName.TextureWrapT, TextureWrapMode.ClampToEdge);
Image2D
기능은 다음과 같습니다
public void Image2D(Bitmap bmp, int mipmapReductionLevel = 0)
{
var rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
var data = bmp.LockBits(rect, ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
GL.TexImage2D(TextureTarget.Texture2D, mipmapReductionLevel, PixelInternalFormat.Rgba, data.Width, data.Height, 0,
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0);
bmp.UnlockBits(data);
}
(코드는 C#으로하지만, 1 매핑해야합니다 : C API를 사용하여 1) t를 그려 질 것으로 보인다
내가 다른 밉맵 감소 수준 glTexImage2D
여러 번 호출하면 내가 다음 밉 매핑 내 질감을 사용할 수있을 거라고 생각
min 필터를 "nearest"로 변경하면 모든 것이 예상대로 잘 렌더링되므로 밉 매핑에 문제가 발생합니다.
대신 밉맵을 생성하려면 glGenerateMipmap
을 사용하면 효과가 있습니다.
내 자신의 밉맵을 생성하려는 이유는 spritemap이기 때문이며 크기 조정 중에 스프라이트 가장자리의 일부가 함께 출혈하는 것처럼 보이므로 스프라이트 사이에 가장자리가 다른 별도의 이미지를 만들었습니다 . 나는 다른 밉맵 감소 수준 glTexImage2D 여러 번 호출하는 경우