0

If I understand this correctly the vertex shader only runs as many times as there are vertex attributes. And then the fragment shader fills in the texture running once per fragment.

I.e. If I have four vertices to draw a texture image, the vertex shader will only run four times, or six to draw two triangle, it doesn't matter.

But before the fragment shader runs scan-conversion calculates how many fragments are needed. Let's just say the square covers a 100x100 image computes => 10,000 fragments.

Now I have a fragment shader that calculate a julia fractal based on the position of each fragment. I want to move that calculation to the vertex shader to take advantage of transform feedback. Is there a way to get the number of texels or frags from a program? Or maybe a double vertex shader setup?

Community
  • 1
  • 1
HPP
  • 1,074
  • 1
  • 13
  • 28
  • 1
    What you ask doesn't really make sense. The fragment shader doesn't run on texels, it runs fragments. You might of course use a pixel-exact mapping of the texture, so each fragment shader invocation samples from exactly one texel. But also, why do you want to move to the VS? YOu could of course just draw a point per pixel, but that would not really efficient. Transform feedback isn't going to get you much. You can as well render to a texture and use the pixel data outputted by the FS for further processing, just as you can use the VS output with transform feedback. – derhass Jul 26 '15 at 01:16
  • Yes I am rendering to a texture now, but now I have a device that supports transformfeedback, and I thought that would somehow magically fix my problems, but getting back into this shows you are correct I need to render to a texture and I am researching that now. – HPP Jul 26 '15 at 02:59

1 Answers1

0

I found an answer that explains the different type of reading out from gl methods pretty well.

Basically as derHass suggests rendering to a texture is the "Fragment Shader" way of doing transform feedback.

Community
  • 1
  • 1
HPP
  • 1,074
  • 1
  • 13
  • 28