PDA

View Full Version : Draw simple quads with least data



myk45
06-07-2013, 06:42 AM
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!

Alfonse Reinheart
06-07-2013, 07:25 AM
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.

myk45
06-07-2013, 10:02 AM
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.