I’m making a custom editor which generates a texture from a wave-file and then displays it. I’m pretty sure the texture itself is fine, but when drawn, it turns white - but only at a certain width. Oddly, I never had this issue while working in an empty project. It only happens after I import it into some other project. I made it a package that I then imported using the package manager.
I tried using the texture as the background of a GUILayout.Box element, which gave the same result. At the moment, I am drawing it using raw OpenGL calls:
GUI.BeginClip(rect);
GL.PushMatrix();
GL.Clear(false, false, Color.black);
GL.Begin(GL.QUADS);
// Waveform
waveformMaterial.mainTexture = track.waveformTexture;
waveformMaterial.SetPass(0);
DrawTexturedQuad(xoff, 9, width, WAVEFORM_TEX_HEIGHT);
GL.End();
GL.PopMatrix();
GUI.EndClip();
void DrawTexturedQuad(float x, float y, float w, float h) {
GL.Color(Color.white);
GL.TexCoord2(1, 1);
GL.Vertex3(x, y, 0);
GL.TexCoord2(0, 1);
GL.Vertex3(x + w, y, 0);
GL.TexCoord2(0, 0);
GL.Vertex3(x + w, y + h, 0);
GL.TexCoord2(1, 0);
GL.Vertex3(x, y + h, 0);
}
Here are the material settings:
Does anyone know what might cause this issue?