internal TextureCube(GraphicsDevice graphicsDevice, int size, bool mipMap, SurfaceFormat format, bool renderTarget)
{
if (graphicsDevice == null)
{
throw new ArgumentNullException("graphicsDevice");
}
this.GraphicsDevice = graphicsDevice;
this.size = size;
this.format = format;
this.levelCount = mipMap ? Texture.CalculateMipLevels(size, 0, 0) : 1;
this.glTarget = TextureTarget.TextureCubeMap;
GL.GenTextures(1, out this.glTexture);
GL.BindTexture(TextureTarget.TextureCubeMap, this.glTexture);
GL.TexParameter(TextureTarget.TextureCubeMap, TextureParameterName.TextureMinFilter, mipMap ? 9987 : 9729);
GL.TexParameter(TextureTarget.TextureCubeMap, TextureParameterName.TextureMagFilter, 9729);
GL.TexParameter(TextureTarget.TextureCubeMap, TextureParameterName.TextureWrapS, 33071);
GL.TexParameter(TextureTarget.TextureCubeMap, TextureParameterName.TextureWrapT, 33071);
GraphicsExtensions.GetGLFormat(format, out this.glInternalFormat, out this.glFormat, out this.glType);
for (int index = 0; index < 6; ++index)
{
TextureTarget glCubeFace = this.GetGLCubeFace((CubeMapFace)index);
if (this.glFormat == (PixelFormat)34467)
{
throw new NotImplementedException();
}
GL.TexImage2D(glCubeFace, 0, this.glInternalFormat, size, size, 0, this.glFormat, this.glType, IntPtr.Zero);
}
if (!mipMap)
{
return;
}
GL.TexParameter(TextureTarget.TextureCubeMap, TextureParameterName.GenerateMipmap, 1);
}