title: glDrawArrays Draws Nothing
body: <p>I am trying to learn OpenGL. Fist I completed some WebGL tutorials, to understand how shaders work and how to use them with OpenGL code. </p>
  
  <p>I just wanted to take a step forward and implement some graphics with LWJGL. </p>
  
  <p>In code, i call glDrawArrays function as I did in webgl but that draws nothing.</p>
  
  <p>Here is my vertex shader:</p>
  
  <pre><code>void main(){
     gl_Position = vec4(0.0, 0.0, 1.0, 0.0);
     gl_PointSize = 50.0;
  }
  </code></pre>
  
  <p>And fragment shader:</p>
  
  <pre><code>void main(){
      gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
  }
  </code></pre>
  
  <p>And here is the java code that I use to render a point:</p>
  
  <pre><code>package com.harvester.game;
  
  import java.io.IOException;
  import java.nio.IntBuffer;
  import com.harvester.game.loaders.ShaderLoader;
  import static org.lwjgl.glfw.GLFW.glfwMakeContextCurrent;
  import static org.lwjgl.opengl.GL.*;
  import static org.lwjgl.opengl.GL20.*;
  import static org.lwjgl.opengl.GL11.*;
  import static org.lwjgl.system.MemoryStack.*;
  
  public class GamePlayState implements GameState {
      private StateManager stateManager;
      long window;
      int program;
  
      public GamePlayState(StateManager stateManager, long window) {
          this.stateManager = stateManager;
          this.window = window;
      }
  
      @Override
      public void init() {
          // Make the OpenGL context current
          glfwMakeContextCurrent(window);
          createCapabilities();
          initShaders();
  
          System.out.println("OpenGL version " + glGetString(GL_VERSION));
      }
  
      @Override
      public void load() {
          // TODO Auto-generated method stub
          System.out.println("load");
          glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
      }
  
      @Override
      public void update() {
          // TODO Auto-generated method stub
          // System.out.println("update");
      }
  
      @Override
      public void render(float delta) {
          // glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
          // System.out.println(60/(delta/1000));
  
          glDrawArrays(GL_POINTS, 0, 2);
          // System.out.println(glGetError());
  
          // glfwSwapBuffers(window); // swap the color buffers
      }
  
      @Override
      public void destroy() {
          // TODO Auto-generated method stub
  
      }
  
      private void initShaders() {
          // TODO Auto-generated method stub
          // System.out.println("init");
          String fragmentShaderCode = "";
          String vertexShaderCode = "";
          try {
              fragmentShaderCode = ShaderLoader.LoadFragmentShaderSource();
              vertexShaderCode = ShaderLoader.LoadVertexShaderSource();
          } catch (IOException e) {
              e.printStackTrace();
              System.exit(-1);
          }
  
          int program = glCreateProgram();
          int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
          int vertextShader = glCreateShader(GL_VERTEX_SHADER);
  
          glShaderSource(vertextShader, vertexShaderCode);
          glCompileShader(vertextShader);
  
          IntBuffer statsB = stackPush().mallocInt(1);
          glGetShaderiv(vertextShader, GL_COMPILE_STATUS, statsB);
  
          if (statsB.get(0) == GL_FALSE) {
              System.err.println("Failed to compile vertex shader");
              System.exit(-2);
          }
  
          glShaderSource(fragmentShader, fragmentShaderCode);
          glCompileShader(fragmentShader);
  
          glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, statsB);
  
          if (statsB.get(0) == GL_FALSE) {
              System.err.println("Failed to compile fragment shader");
              System.exit(-3);
          }
  
          glAttachShader(program, vertextShader);
          glAttachShader(program, fragmentShader);
  
          glLinkProgram(program);
  
          glGetProgramiv(program, GL_LINK_STATUS, statsB);
  
          if (statsB.get(0) == GL_FALSE) {
              System.err.println("Failed to link Program");
              System.exit(-4);
          }
  
  
          glValidateProgram(program);
          glGetProgramiv(program, GL_VALIDATE_STATUS, statsB);
  
          System.out.println(glGetProgramInfoLog(program));
  
          glUseProgram(program);
  
          if (statsB.get(0) == GL_FALSE) {
              System.err.println("Failed to validate program");
              System.exit(-3);
          }
  
          this.program = program;
      }
  }
  </code></pre>
  
  <p>What am I doing wrong? I just want to draw a small smiling point to my screen. </p>
  
  <p>(Debug option set to true but logs shows nothing wrong.)</p>