Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: gl_PointCoord examples would be great

  1. #1
    Intern Contributor
    Join Date
    Dec 2016
    Location
    Ocean Shores, WA USA
    Posts
    72

    Question gl_PointCoord examples would be great

    Hey all,

    I'm trying to play around with large points (32 by 32), yes, these are GL_POINTS, drawn with point size 32. First I want to experiment with Algorithmically drawing on these points in the fragment shader, and second I want to map textures onto these points (using the built-in variable gl_PointCoord in the fragment shader).

    I'm not having any luck accessing the gl_PointCoord vector.

    I've included the gl_PointCoord.s and gl_PointCoord.t in my shader, as color values, but nothing is the result..... I also tried x and y.

    I've tried googling some examples of using this built-in variable, but no luck so far.

    Anybody have some examples that work, that I could see? Or anyone know of a bug/reason why these won't work?

    I'm trying to add to my videos on youtube that show how to program in OpenGL, here's the shameless link:

    https://www.youtube.com/channel/UCzx...ELz5h1dfCdkdfg

    Thanks guys, appreciate any help you can throw my way,

    Jeff Cummings

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,529
    Core profile or compatibility profile? In the compatibility profile, you'll need glEnable(GL_POINT_SPRITE).

  3. #3
    Intern Contributor
    Join Date
    Dec 2016
    Location
    Ocean Shores, WA USA
    Posts
    72
    That appears to be a deprecated and removed feature as of 3.2??

    https://www.opengl.org/discussion_bo...TE-gone-in-3-2

    Thanks, though,

    Jeff

  4. #4
    Intern Contributor
    Join Date
    Dec 2016
    Location
    Ocean Shores, WA USA
    Posts
    72
    Currently, my fragment shader is this:

    #version 450 core

    out vec4 fColor;

    void main()
    {
    fColor = vec4(gl_PointCoord, 1.0, 1.0);
    }

    And it just shows the points as blue 32x32 (since I've designated their size be 32).

    Jeff

  5. #5
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,529
    Quote Originally Posted by OceanJeff40 View Post
    That appears to be a deprecated and removed feature as of 3.2??
    Yes, which is why I asked
    Quote Originally Posted by GClements View Post
    Core profile or compatibility profile?
    In the compatibility profile, nothing has changed (that's why it's called the "compatibility" profile); you only get point sprites if you explicitly enable them.

    Note that it's the context profile which matters, not the profile specified in the shader. A shader using "450 core" will work in a compatibility profile (the reverse isn't true), but gl_PointCoord won't be set if point sprites aren't enabled (either explicitly or because the version and profile force it).

  6. #6
    Intern Contributor
    Join Date
    Dec 2016
    Location
    Ocean Shores, WA USA
    Posts
    72
    Not sure what you mean by all those profile options, or how to change those......

    But My points are displaying colors, what I'm looking for is to access the gl_PointCoord.s and gl_PointCoord.t, to apply to texture sampler, and turn the point color into a point sprite.

    Thanks,
    Jeff

  7. #7
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,529
    Quote Originally Posted by OceanJeff40 View Post
    Not sure what you mean by all those profile options, or how to change those......
    Which tends to suggest that you're using the compatibility profile; most toolkits will give you a compatibility-profile context unless you specifically request a core-profile context. And the compatibility profile doesn't enable point sprites by default, regardless of version (it wouldn't provide much compatibility if it did).

    Quote Originally Posted by OceanJeff40 View Post
    But My points are displaying colors, what I'm looking for is to access the gl_PointCoord.s and gl_PointCoord.t, to apply to texture sampler, and turn the point color into a point sprite.
    Have you tried glEnable(GL_POINT_SPRITE)?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •