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 3 of 3

Thread: Draw simple quads with least data

  1. #1
    Intern Contributor
    Join Date
    Jan 2012
    Posts
    81

    Draw simple quads with least data

    Hello All,

    I plan to draw simple quads and i was searching ways to generate vertices in the vertex shader.
    I saw the use of gl_VertexID . But i cannot use this since i need to support OpenGL ES 2.0 as well, so i can't use gl_VertexID
    Is there some other way to do this? i.e procedurally generate a simple quad in the shader?

    I did it in the fragment shader. But i need texturing as well. So, i actually need vertices and texture coords generated in a simple way.
    Please let me know if there are some ways this can be done.

    Thanks!

  2. #2
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    Is there some reason you can't just do what everyone else does and stick your vertices in a buffer object?

    I did it in the fragment shader.
    How?

    But i need texturing as well.
    That doesn't need a vertex shader. If you were somehow able to create a "quad" in the fragment shader, then you must have had some way of generating positions for that quad to be rendered. So you must know what's inside of the quad. Which means you have all you need to create texture coordinates.

  3. #3
    Intern Contributor
    Join Date
    Jan 2012
    Posts
    81
    Well i forgot to mention, for the quad with fragment shader, i use one full screen quad, and then generate multiple quads in the fragment shader. I'm sorry, my mistake.
    So, technically, it's not only via the fragment shader. So, my example is not valid.

    >> Is there some reason you can't just do what everyone else does and stick your vertices in a buffer object?

    I read this article on attribute-less rendering. So, i was trying it out.

Posting Permissions

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