That’s true in a core profile GL context, or in ES2, ES3, or WebGL.
But it’s not true in a compatibility profile GL context, or in ES1.
So, what context profile are you using? And do your included headers match your context profile?
It took me three minutes to write and test a complete, minimal, working example using gl_PointCoord:
//
// gl_PointCoord
//
// cc sprite.c -framework OpenGL -framework GLUT -Wno-deprecated-declarations -o sprite && ./sprite
//
#include <GLUT/glut.h>
#include <stdlib.h>
GLint prog;
void reshape(int w, int h)
{
glViewport(0, 0, w, h);
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POINTS);
glVertex2f(0, 0);
glEnd();
glutSwapBuffers();
glutPostRedisplay();
}
void init(void)
{
glPointSize(32);
glEnable(GL_POINT_SPRITE);
const GLchar *src =
"#version 120
"
"void main() {
"
" gl_FragColor = vec4(gl_PointCoord, 0.0, 1.0);
"
"}";
prog = glCreateProgram();
GLuint fs = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fs, 1, &src, NULL);
glCompileShader(fs);
glAttachShader(prog, fs);
glLinkProgram(prog);
glDeleteShader(fs);
glUseProgram(prog);
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayString("double rgba");
glutInitWindowSize(480, 320);
glutCreateWindow("Sprite");
glutDisplayFunc(display);
glutReshapeFunc(reshape);
init();
glutMainLoop();
return 0;
}
This uses GLUT and a compatibility profile context. On OSX (GL2.1, Nvidia, Intel, and Software renderers), it produces a black window with one 32x32 sprite in the center. The sprite shows gl_PointCoord as a black->red gradient from left->right, and black->green gradient from top->bottom.
The only interesting part of that code is glEnable(GL_POINT_SPRITE). Commenting that line out results in “undefined” behavior; the sprite changes to all-black on Nvidia and software renderers, and is unchanged on Intel.