-
gl_PointCoord and OpenGL 3.1 / GLSL 1.4
Hi all,
I want to render points using a specific size with OpenGL 3.1 / GLSL 1.4. If I enable GL_POINT_SPRITE and using backward compatibility, gl_PointCoord gives me valid values. But, as enabling point sprites is deprecated, how do I get valid values in gl_PointCoord? Is there a bug in the driver (latest NVIDIA): The spec says "Point rasterization is always performed as though POINT_SPRITE were enabled.". But it doesn't seem so ...
Any help?
Regards Norbert
-
Junior Member
Regular Contributor
Re: gl_PointCoord and OpenGL 3.1 / GLSL 1.4
Try enabling GL_VERTEX_PROGRAM_POINT_SIZE, set gl_PointSize in your vertex shader, then specify your points normally. Works just dandy for me (Vista32/G80-190.38).
-
Re: gl_PointCoord and OpenGL 3.1 / GLSL 1.4
Thanks for your help.
I already enabled GL_VERTEX_PROGRAM_POINT_SIZE and this is not the problem. The points do have the wanted size. The problem is, that gl_PointCoord is not correctly set, which I need e.g. for texture mapping.
Any more help or any solutions?
-
Advanced Member
Frequent Contributor
Re: gl_PointCoord and OpenGL 3.1 / GLSL 1.4
Did you specify
#version 140
in your fragment shader?
-
Re: gl_PointCoord and OpenGL 3.1 / GLSL 1.4
-
Junior Member
Regular Contributor
Re: gl_PointCoord and OpenGL 3.1 / GLSL 1.4
I can't seem to reproduce the problem you are having. You do realize that gl_PointCoord in strictly a FS input? I'm sure you do but it wasn't entirely clear from your first post.
Just so we're on the same page, you enable both GL_POINT_SPRITE (for texture coordinate generation) and GL_VERTEX_PROGRAM_POINT_SIZE (so that gl_PointSize is respected). Otherwise I'm at something of a loss for recommendations. Could there be trouble with your textures?
Incidentally, you can verify that your texture coordinates are being generated correctly by setting your output FragColor to vec4(gl_PointCoord.st, 0, 1); This should produce black in the top left corner and yellow in the bottom right (unless POINT_SPRITE_COORD_ORIGIN is set to LOWER_LEFT).
-
Re: gl_PointCoord and OpenGL 3.1 / GLSL 1.4
Well, everything is working fine (if I enable GL_POINT_SPRITE) with a backward(!) compatible context. Then gl_PointCoord delivers me correct values. But if I do have a forward(!) compatible context, then glEnable(GL_POINT_SPRITE) is deprecated:
"Non-sprite points - Enable/Disable targets POINT SMOOTH
and POINT SPRITE, and all associated state. Point rasterization is always
performed as though POINT SPRITE were enabled."
So in this case, I can not enable point sprites and I expect, that they are already enabled, right?
Right now, I am pretty sure this is a bug in the driver.
-
Junior Member
Regular Contributor
Re: gl_PointCoord and OpenGL 3.1 / GLSL 1.4
That could very well be. I haven't done any testing with forward compatible contexts. Are you getting any errors?
-
Re: gl_PointCoord and OpenGL 3.1 / GLSL 1.4
Well, if I try to enable point sprites in the forward context, it does report an invalid enum (which is ok). I guess, what is missing, that when creating the forward compatible context, the point sprites are not "enabled" by default. I have posted this issue also on the NVIDIA developer site. Let's see what they respond ...
-
Junior Member
Regular Contributor
Re: gl_PointCoord and OpenGL 3.1 / GLSL 1.4
For what it's worth I can confirm what you're seeing in forward-compatible mode. (On a hunch that it's texture related I discovered that TexParameterf with TEXTURE_LOD_BIAS is generating an INVALID_ENUM, unrelated though that may be).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules