PDA

View Full Version : Lack of understading on fragment shader??



SagoO
03-24-2011, 09:42 PM
I have a texture 2048x2048.
I want to process the texture line by line in parallel. But I dun know how to program my shader program.
Shader can be used to process each vertex in parallel. But I dun understand how it works? Can anyone explain further?

Alfonse Reinheart
03-24-2011, 11:36 PM
I want to process the texture line by line in parallel.

What is this obsession you have with things happening "in parallel?" Whether it's happening in parallel or serially is secondary to whether it's happening fast.

More to your question, what do you mean by "process"? If you're talking about the GPGPU stuff you were dealing with in your last thread (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Main=56619&Number=2936 13#Post293613), you have to do what I said there: make your "processing" look like rendering.

So your first step is to understand how rendering works. You shouldn't be thinking in terms of "processing" yet; you should be thinking in terms of drawing pictures. Once you have an understanding of how OpenGL works as a renderer, then you can start to figure out how to finesse it into computing whatever algorithm you need to do.

A terse description of the rendering pipeline is available here (http://www.opengl.org/wiki/Rendering_Pipeline_Overview).

SagoO
03-25-2011, 05:06 AM
How is the rasterization part convert both geometric and pixel data into fragment? I saw the pipelining. If i sent a texture data, the texture will be stored into the texture memory. The data i pass in should be in array form right? Then, it will pass to rasterization.

Fragments are a rectangular array containing color, depth, line width, point size and antialiasing calculations (GL_POINT_SMOOTH, GL_LINE_SMOOTH, GL_POLYGON_SMOOTH).

I really dun know how they convert the data into fragments that contain those arrays. Confusing....

SagoO
03-25-2011, 05:50 AM
Actually what is vertex? There are 2 kinds only: pixel data and vertex data. Is vertex means coordinate? What id the difference between vertices and vertex?

ZbuffeR
03-25-2011, 06:20 AM
Can't you just do OpenCL/CUDA whatever ?
You seem to be too ignorant of how rendering works to use OpenGL.

SagoO
03-25-2011, 06:31 AM
May be my lecturer think that it is lack of challenge to use CUDA/openCL since they are purposely designed for GPGPU. So, he picks openGL. There are some paper published about packet filtering using openGL. However, their concepts is too deep for me. I was trying to search an easier method to implement my project only.

Alfonse Reinheart
03-25-2011, 02:17 PM
Read what is linked in my signature. That should at least get you started.