Search Results

Search found 2 results on 1 pages for 'user697111'.

Page 1/1 | 1 

  • How to get pixel information inside a fragment shader?

    - by user697111
    In my fragment shader I can load a texture, then do this: uniform sampler2D tex; void main(void) { vec4 color = texture2D(tex, gl_TexCoord[0].st); gl_FragColor = color; } That sets the current pixel to color value of texture. I can modify these, etc and it works well. But a few questions. How do I tell "which" pixel I am? For example, say I want to set pixel 100,100 (x,y) to red. Everything else to black. How do I do a : "if currentSelf.Position() == (100,100); then color=red; else color=black?" ? I know how to set colors, but how do I get "my" location? Secondly, how do I get values from a neighbor pixel? I tried this: vec4 nextColor = texture2D(tex, gl_TexCoord[1].st); But not clear what it is returning? if I'm pixel 100,100; how do I get the values from 101,100 or 100,101?

    Read the article

  • SDL versus GLFW?

    - by user697111
    What are the pros and cons to each? It seems they serve the same purpose. I have a few demos with each and they seem about the same. Performance or cross platform wise, is one better than the other? The only thing I notice is that SDL seems to have more "helper" libraries (fonts, images, mixer, built in sound support, etc). On its site, GLFW claims to be more "OpenGL" focused, but still have to use a GLEW to get any newer OpenGL features (same with SDL). I guess I'm leaning towards using SDL now (more mature, more features, more community). Are there any reasons I've missed why GLFW stands out and I should use it instead of SDL?

    Read the article

1