I have versions of SpriteBatch written in two different languages:
Java: http://pastebin.com/7gwHBTXi C#: http://pastebin.com/cTFn26H8
They have identical code and both make the following calls in a simple program:
Java:
GL11.glViewport(0, 0, game.getWidth(), game.getHeight());
GL11.glClearColor(0, 1, 0, 1);
GL11.glClearDepth(1.0);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
sb.Begin();
sb.Draw(tex, new Vector2(-0.5f, 0.5f), new Vector2(1, -1), Color.White, 0);
sb.End(SpriteSortMode.None);
sb.RenderBatch(new Matrix4(), new Matrix4(), BlendState.Opaque, SamplerState.PointWrap, DepthState.None, RasterizerState.CullNone);
C#:
GL.Viewport(0, 0, game.Width, game.Height);
GL.ClearColor(0, 1, 0, 1);
GL.ClearDepth(1.0);
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
sb.Begin();
sb.Draw(tex, new Vector2(-0.5f, 0.5f), new Vector2(1, -1), Color.White);
sb.End(SpriteSortMode.None);
sb.RenderBatch(Matrix4.Identity, Matrix4.Identity, BlendState.Opaque, SamplerState.PointWrap, DepthState.None, RasterizerState.CullNone);
The OpenGL context is the exact same for both of them (3.3).
However, the C# version does what it's supposed to do (draw a white rectangle), but the Java version does nothing (only the green background). Can anyone please tell me what is the difference? What is not working? Thank you. I have been stuck on this for three weeks.