//For use with solid colors public cTexture(cTextureInfo ptextureinfo) { _transparent = false; _usemipmap = true; uint bytesperpixel = 4; _pixeldataformat = 4; int imagecx = _cx = ptextureinfo._width; int imagecy = _cy = ptextureinfo._height; _imageaspect = ( double )_cx / ( double )_cy; /* By default we set the aspect to match the aspect * of the image we loaded, before doing the makePowersOfTwo call. Even though we are going * to clamp the texture to powers of two, if we apply it to a rectangle with proportions * matching _imageaspect, the image will appear unstretched; the two stretches cancel out. */ makePowersOfTwo(ref _cx, ref _cy); if (_cx != imagecx || _cy != imagecy) //Need to rescale { uint arraysize = bytesperpixel * ( uint )_cx * ( uint )_cy; byte [] pdatascaled = new byte[arraysize]; GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1); GL.PixelStore(PixelStoreParameter.PackAlignment, 1); Glu.ScaleImage( (_pixeldataformat == 3) ? PixelFormat.Rgb : PixelFormat.Rgba, imagecx, imagecy, PixelType.UnsignedByte, ptextureinfo.Data, _cx, _cy, PixelType.UnsignedByte, pdatascaled); string errorstring = Glu.ErrorString(GL.GetError()); ptextureinfo.resetData(_cx, _cy, pdatascaled); } _maketexture(ptextureinfo.Data); }