Exemple #1
0
        private void _createSurfaceList()
        {
            this._surfaceList.Clear();

            // For all faces and mipmaps, store surfaces as HardwarePixelBufferSharedPtr
            bool wantGeneratedMips = (Usage & TextureUsage.AutoMipMap) != 0;

            // Do mipmapping in software? (uses GLU) For some cards, this is still needed. Of course,
            // only when mipmap generation is desired.
            bool doSoftware = wantGeneratedMips && !MipmapsHardwareGenerated && MipmapCount != 0;

            for (int face = 0; face < FaceCount; face++)
            {
                for (int mip = 0; mip <= MipmapCount; mip++)
                {
                    GLHardwarePixelBuffer buf = new GLTextureBuffer(Name, GLTextureType, this._glTextureID, face, mip,
                                                                    (BufferUsage)Usage,
                                                                    doSoftware && mip == 0, this._glSupport, HardwareGammaEnabled,
                                                                    FSAA);
                    this._surfaceList.Add(buf);

                    /// Check for error
                    if (buf.Width == 0 || buf.Height == 0 || buf.Depth == 0)
                    {
                        throw new Exception(
                                  String.Format(
                                      "Zero sized texture surface on texture {0} face {1} mipmap {2}. Probably, the GL driver refused to create the texture.",
                                      Name, face, mip));
                    }
                }
            }
        }
Exemple #2
0
		private void _createSurfaceList()
		{
			_surfaceList.Clear();

			// For all faces and mipmaps, store surfaces as HardwarePixelBufferSharedPtr
			bool wantGeneratedMips = ( Usage & TextureUsage.AutoMipMap ) != 0;

			// Do mipmapping in software? (uses GLU) For some cards, this is still needed. Of course,
			// only when mipmap generation is desired.
			bool doSoftware = wantGeneratedMips && !MipmapsHardwareGenerated && MipmapCount != 0;

			for ( int face = 0; face < this.faceCount; face++ )
			{
				for ( int mip = 0; mip <= MipmapCount; mip++ )
				{
					GLHardwarePixelBuffer buf = new GLTextureBuffer( Name, GLTextureType, _glTextureID, face, mip, (BufferUsage)Usage, doSoftware && mip == 0, _glSupport, HardwareGammaEnabled, FSAA );
					_surfaceList.Add( buf );

					/// Check for error
					if ( buf.Width == 0 || buf.Height == 0 || buf.Depth == 0 )
					{
						throw new Exception( String.Format( "Zero sized texture surface on texture {0} face {1} mipmap {2}. Probably, the GL driver refused to create the texture.", Name, face, mip ) );
					}
				}
			}
		}