title: Why won't this simple OpenGL ES 2.0/SDL 2 program let me change my point sprite size?
body: <p>I was working on a simple OpenGL ES 2.0 program (along with SDL 2 to make things a bit easier) and decided to try out point sprites.  I was able to get them to draw successfully, but I wasn't able to change their size by outputting gl_PointSize from the vertex shader.  Theoretically, that should be all that I have to do.</p>
  
  <p>The following code snippet is a very stripped-down version of my barely-C++ code (no error-checking <em>at all</em>, but that is because nothing should go wrong with it) that demonstrates how I am trying to change the size of my point sprites.  It has been tested on two rather different computers with similar results (Linux, but 32-bit/software rendering vs 64-bit/discrete GPU), and may be compiled using g++ with <code>g++ main.cpp -lSDL2 -Wall -D_REENTRANT -lGLESv2</code>.</p>
  
  <pre><code>#include &lt;GLES2/gl2.h&gt;
  #include &lt;SDL2/SDL.h&gt;
  
  struct myData {
      SDL_Window *window;
      SDL_GLContext context;
  };
  
  const GLchar vertex[] =
      "#version 100\n"
      "precision mediump float;\n"
      "void main()\n"
      "{\n"
      "   gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n"
      "   gl_PointSize = 128.0;\n"
      "}\0";
  
  const GLchar fragment[] =
      "#version 100\n"
      "precision mediump float;\n"
      "void main()\n"
      "{\n"
      "   gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
      "}\0";
  
  GLuint loadShader(GLuint program, GLenum type, const GLchar *shaderSrc) {
      GLuint shader;
      shader = glCreateShader(type);
      glShaderSource(shader, 1, &amp;shaderSrc, NULL);
      glCompileShader(shader);
      glAttachShader(program, shader);
      return 0;
  }
  
  int sdlInit(myData *data) {
      SDL_Init(SDL_INIT_VIDEO);
      SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
      SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
  
      data-&gt;window = SDL_CreateWindow("Demo", 0, 0, 512, 512, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
      data-&gt;context = SDL_GL_CreateContext(data-&gt;window);
  
      return 0;
  }
  
  int glInit(myData *data) {
      GLuint programObject;
      programObject = glCreateProgram();
      loadShader(programObject, GL_VERTEX_SHADER, vertex);
      loadShader(programObject, GL_FRAGMENT_SHADER, fragment);
      glLinkProgram(programObject);
      glUseProgram(programObject);
  
      glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
      glViewport(0, 0, 512, 512);
  
      return 0;
  }
  
  int loopFunc(myData *data) {
      SDL_Event event;
      while (SDL_PollEvent(&amp;event)) {
          if (event.type == SDL_QUIT) {
              return 1;
          }
      }
  
      glClear(GL_COLOR_BUFFER_BIT);
      glDrawArrays(GL_POINTS, 0, 1);
      SDL_GL_SwapWindow(data-&gt;window);
  
      return 0;
  }
  
  void sdlQuit(myData *data) {
      SDL_GL_DeleteContext(data-&gt;context);
      SDL_DestroyWindow(data-&gt;window);
      SDL_Quit();
      return;
  }
  
  int main() {
      myData data;
  
      sdlInit(&amp;data);
  
      glInit(&amp;data);
  
      while (!loopFunc(&amp;data));
  
      sdlQuit(&amp;data);
  
      return 0;
  }
  </code></pre>
  
  <p>When ran, the program should produce a point sprite with a size of 128 pixels, per the value that I set in the vertex shader.  However, when actually executed, the size of the points sprite in the center of the window is exactly one pixel.  What am I doing wrong?</p>