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: Binding texture to one vertex

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2008
    Posts
    28

    Binding texture to one vertex

    As in topic - is there any possibility to do that? Maybe use GL_TEXTURE_1D ??

    And how to make texture to be seen front always (when we move).

    thx

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,052

    Re: Binding texture to one vertex

    You need to explain in more detail what you want to achieve. The question is very confusing.
    GLIM - Immediate Mode Emulation for GL3

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2008
    Posts
    28

    Re: Binding texture to one vertex

    I want to display texture, and stick it to only one vertex.

    e.g. i have texture of cloude, and i want to bind it to vertex (2.0f, 10.0f, 0.0f).


  4. #4
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    2,891

    Re: Binding texture to one vertex

    Quote Originally Posted by aistee
    I want to display texture, and stick it to only one vertex. ... e.g. i have texture of cloude, and i want to bind it to vertex (2.0f, 10.0f, 0.0f).
    Hmm. I think you might have a misconception of how you render a texture on the screen.

    I think you're envisioning taking a picture (a texture) with a predefined size and poking it onto a bulletin board (the screen) with a single point, whereas the normal GPU model is you send outline of the picture (a quad) to the bulletin board and tell the bulletin board to fill it with the picture. The nice thing about that is you can not only reposition the picture, but resize it as well when you render it.

    So for your cloud, let's say you wanted it 2 units X 2 units centered on (2.0f, 10.0f, 0.0f), you'd send down quad vertex positions of: (1,9),(1,11),(3,11),(3,9), texture coordinates (0,0),(1,0),(1,1),(1,0), and slap your cloud texture on it.
    This is the normal GL_QUADS route to rendering.

    Note that there are other ways to do this (point sprites, drawpixels, etc.) -- I'm just describing the most common way. This is the kind of thing discussed well in the OpenGL Red Book.

  5. #5
    Junior Member Newbie
    Join Date
    Sep 2008
    Posts
    28

    Re: Binding texture to one vertex

    @Dark Photon

    Thanks for your help I know opengl for sometime and I know how to texture - but I've heard that you can stick your texture to one vertex. Is it possible ?

  6. #6
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    2,891

    Re: Binding texture to one vertex

    Quote Originally Posted by aistee
    I know how to texture - but I've heard that you can stick your texture to one vertex. Is it possible ?
    Well, I'm not sure I understand you, but if you mean render a quad texture by sending only a single position down the pipe, check out ARB_point_sprite. Don't be surprised when your texture pops off when you move it half-way off screen though. It's a point.

    Another approach is glDrawPixels. Call glRasterPos to set the draw position.


  7. #7
    Junior Member Newbie
    Join Date
    Sep 2008
    Posts
    28

    Re: Binding texture to one vertex

    @Dark Photon

    You're my man I've used sprites and they are working just the way i wanted

    Topic is ready to be closed.

Posting Permissions

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