[mono-android] Compressed texture - OES Palette8 RBGBA - white screen

conio konrad at konsoft.eu
Tue Feb 28 20:52:11 UTC 2012


Hey, I am trying to display rectangle and put texture on it. The problem I
get is white screen, even if OpenGL ES error is all the time 0 (so no
error).
Here is my code:

public class Mesh
{
	float[] _Vertices;
	short[] _Indices;
	byte[]	_Colors;
	float _xTrans;
	int[]	Textures = new int[1];
	DDSFile TextureFile;
	bool 	ShouldMakeTexture = true;
	float[]	_TextureCoordinates;
	int TextureID = 0;
		
	public float[] TextureCoordinates
	{
		get { return _TextureCoordinates; }
		set { _TextureCoordinates = value; }
	}
	
	public float[] Vertices
	{
		get { return _Vertices; }
		set { _Vertices = value; }
	}
	
	public Mesh (float[] vertices, byte[] colors, float xTranslation, short[]
indices,
                         DDSFile textureFile)
	{
		_Vertices = vertices;
		_Colors = colors;
		_xTrans = xTranslation;
		_Indices = indices;
		TextureFile = textureFile;
		
	}
		
	public void Render()
	{
			
		GL.FrontFace(All.Ccw);
		GL.Enable(All.CullFace);
		GL.CullFace(All.Back);
		GL.EnableClientState(All.VertexArray);
		GL.VertexPointer(3, All.Float, 0, _Vertices);
			
		if (ShouldMakeTexture)
			MakeTexture();
		int Error = (int)GL.GetError();
		
		GL.Enable(All.Texture2D);
		GL.EnableClientState(All.TextureCoordArray);
		GL.TexCoordPointer(2, All.Float, 0, TextureCoordinates);
		GL.BindTexture(All.Texture2D, Textures[0]);
		
		GL.DrawElements(All.Triangles, _Indices.Length, All.UnsignedShort,
_Indices);
		GL.DisableClientState(All.VertexArray);
		GL.DisableClientState(All.TextureCoordArray);
		GL.Disable(All.CullFace);			
	}
		
	private void MakeTexture()
	{
	
		GL.GenTextures(1, Textures);
		GL.BindTexture(All.Texture2D, TextureID);
		GL.TexParameter(All.Texture2D, All.TextureMinFilter, (int)All.Linear);
		GL.TexParameter(All.Texture2D,All.TextureMagFilter, (int)All.Linear);
		int[] parameters = new int[50];
		GL.GetInteger(All.CompressedTextureFormats, parameters);
		int Error = (int)GL.GetError();
		GL.CompressedTexImage2D(All.Texture2D, 0, All.Palette8Rgba8Oes,
TextureFile.Header.Width, TextureFile.Header.Height, 0,
TextureFile.Data.Length, TextureFile.Data);
		Error = (int)GL.GetError();
		this.ShouldMakeTexture = false;
	}
}

So, in my GLView I create a mesh, supply indices, vertices and texture
coordinates. In OnRenderFrame I just call mesh.Render() -> it should create
texture. Code of MakeTexture executes fine, no error reported but I get
white screen. So, is my code wrong, or is it my .dds file which is bad? Do
you know any good tools for making compression for OpenGL ES? I used
photoshop with Palette8 ARGB.
Thanks for help, 
Konrad

--
View this message in context: http://mono-for-android.1047100.n5.nabble.com/Compressed-texture-OES-Palette8-RBGBA-white-screen-tp5523218p5523218.html
Sent from the Mono for Android mailing list archive at Nabble.com.


More information about the Monodroid mailing list