title: Libgdx - Basic shader not working
body: <p>I'm new to Shaders, and to OpenGL in general. After reading some tutorials, I decided to create my first shader (using LibGDX).</p>
  
  <p>The problem is that the screen is entirely black ...</p>
  
  <p><strong>My Java code :</strong></p>
  
  <pre><code>public class Application extends
                          ApplicationAdapter {
  
      private ShaderProgram   mShaderProgram;
      private Mesh            mMesh;
  
      @Override
      public void create() {
          this.createMesh();
  
          if (Gdx.graphics.isGL20Available()) {
              this.createShaderProgram();
          }
  
          this.log("" + this.mShaderProgram.isCompiled()); // outputs "true"
      }
  
      private void createMesh() {
          this.mMesh = new Mesh(true, 3, 4, VertexAttribute.Position());
  
          this.mMesh.setIndices(new short[] { 0, 1, 2 });
          this.mMesh.setVertices(new float[] {
                  -0.5f, -0.5f, 0,
                  0f, 0.5f, 0,
                  0.5f, -0.5f, 0
          });
      }
  
      private void createShaderProgram() {
          final FileHandle fragmentShader = Gdx.files.internal("fragment.txt");
          final FileHandle vertexShader = Gdx.files.internal("vertex.txt");
  
          this.mShaderProgram = new ShaderProgram(vertexShader, fragmentShader);
      }
  
      @Override
      public void dispose() {
          this.mMesh.dispose();
          if (this.mShaderProgram != null) {
              this.mShaderProgram.dispose();
          }
      }
  
      private void log(final String message) {
          Gdx.app.log("", message);
      }
  
      @Override
      public void render() {
          Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
  
          if (Gdx.graphics.isGL20Available()) {
              this.mShaderProgram.begin();
              this.mMesh.render(this.mShaderProgram, GL10.GL_TRIANGLES);
              this.mShaderProgram.end();
          }
          else {
              this.mMesh.render(GL10.GL_TRIANGLES);
          }
      }
  }
  </code></pre>
  
  <p><strong>My fragment shader :</strong></p>
  
  <pre><code>void main() {
      gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
  }
  </code></pre>
  
  <p><strong>My vertex shader :</strong></p>
  
  <pre><code>void main() {
      gl_Position = ftransform();
  }
  </code></pre>
  
  <p>Using <code>gl_Vertex</code> instead of <code>ftransform()</code> didn't change anything.</p>