I want to apply my OpenGL ES shaders to my entire GLFW screen. I have a few textures on the window and I made a black&white filter using a fragment shader and I want that filter to cover the entire window, including the textures on the screen.
How can I achieve this? Is it possible? Are there any work-arounds?
Related
Basically what I want to achieve is a sprite highlight animation effect as displayed below.
The idea is that the white-translucent gradient sprite moves on top of the other sprite (left-to-right), using a blend mode like Overlay (Photoshop). The difficult part is that the top gradient sprite should only be drawn on the visible pixels of the sprite underneath. The other part of the gradient overlay should be discarded to not affect the background or other sprites underneath (like on the image to the far right).
Is it possible to achieve that effect with a clever combination of OpenGL blend modes and how, or would I have to create a custom shader to combine these sprites?
Background: I'm using libgdx with OpenGL ES 2.0 and the app runs on Desktop, Android and iOS.
There arę many ways to do it. The simplest one:
You should render button and hilight in a single pass. In fragment shader, after sampling button texture and hilight texture calc the output color as for blending (could be mix(c1,c2,c2.a)) and alpha as button texture alpha only. Of course enable blending in usual way: (srcalpha,1-srcalpha)
I want to create some textured rectangles (I guess the jargon for this is 'quads" :D) with OpenGL ES 2.0 and move them on screen following mouse pointer.
But now comes the "advanced" part: I want that all these rectangles to have a border around them; I could do this by simply overpainting the texture images in software to draw the borders on top of them and after that pass the modified (sw "bordered") texture data to the shaders; But I want to do this in hardware, in the shaders (either vertex or fragment shader or both).
Is this possible? If yes can someone post the GLSL shaders code for this?
One idea would be to test if either coordinate of the UV is less than 0.1 or greater than 0.9, and then replace the texture texel with a border color if the test is true.
Is it possible to get any values out of a OpenGL ES 2.0 shader? I'd like to use the gpu to do some processing (not 3D). The only thing I could think of is to render to the canvas and then to use readPixels to get the colors (preferably in a large 2d array).
Yes, that's called GPGPU. The only way is to draw to a framebuffer or a texture, here is a tutorial that explains it, just stick to the GLSL version.
just had a simple question about opengl es that I couldn't find the answer to. So I am trying to display simple meshes made in blender using oolong3D's blenderparse example, but when I import the textures from blender they always stay the same size. What I mean is that in blender I can resize the texture to fit the mesh, but when I import them in opengl the size stays the same and they don't fit the whole mesh. Here is a link to some pics and some code used to apply the textures: http://img17.imageshack.us/g/blenderview.png/. Is there some missing code that I need to accomplish this?
Edit the mesh in edit mode (to go to edit mode, select the mesh and press tab).
I know it's possible to repeat an entire texture by setting the wrap mode to GL_REPEAT, but is it somehow possible to repeat only a subregion of the texture? For example, when the texture is part of an atlas.
I'm targetting OpenGL ES 1.x, so shaders are out.
Unfortunatelly, it is not possible. The only thing you can do it to repeat side pixels (if the image is at the edge of a texture altals).
If you need tiling – probably the only solution here is generate is with geometry. Otherwise, just go with a separate texture.