0
votes
1answer
75 views

How to change pixel color of Texture with Fragment Shader

I want to change the pixel color of a texture. I don't know where to start and what to add. Really need help, I only find useless snippets in the internet. My current Code: public void ...
6
votes
1answer
224 views

OpenGL 2.0 - Texture animation with 'pixelated' effect

I'm looking for a way to reproduce the effect I've tried to sketch in the image below with OpenGL ES 2.0. The idea is to let a drop of color fall over a cube which get filled with a kind of ...
2
votes
1answer
355 views

How to outline a 3D object with a cartoon style stroke? [duplicate]

How could I draw (stroke) the outline of a 3D object in a cartoon style with GLKit? I'm referring to something like this: However we can start with a simple line around the object and then try to ...
7
votes
1answer
1k views

Optimizing performance of a heavy fragment shader

I need help optimizing the following set of shaders: Vertex: precision mediump float; uniform vec2 rubyTextureSize; attribute vec4 vPosition; attribute vec2 a_TexCoordinate; varying vec2 tc; ...
2
votes
0answers
79 views

OpenGL ES Single Bitplane Texture (or something close)

I'm looking to use a texture to store single bits (or a low number of bits, two or three). This in of itself isn't hard if you're using nearest neighbor sampling with some bit plane unpacking. The ...
2
votes
0answers
202 views

iPhone GLSL shader dynamic branching issue

I am trying to pass an array of vec3 as uniform and then iterate through them on each pixel. The size of array varies on situations so I can't make the loop with constant number of iterations. ...
4
votes
3answers
548 views

OpenGL ES 2.0 - How to batch draw particles that have unique translations, rotations, scales, and alphas?

I've combined all of my vertex data for many particles into a single array. How would I batch draw all of those particles in a manner that preserves their unique translations? Any code examples ...
1
vote
1answer
390 views

Apply portion of texture atlas

I'm trying to write a shader that only maps a portion of a large texture to my sprite and I'm getting a strange behaviour with my current code. This is what I have right now: Texture atlas ...
1
vote
1answer
160 views

Artifacts when draw particles with some alpha

I want to draw in my game some particles. But when I draw one particle above another particle, alpha channel from this above "clear" previous drawed particle. I set in OpenGL blend in this way: ...
12
votes
1answer
2k views

Should I distribute shaders in a compiled form or in plain text?

Having an application that uses shaders that have been wrote in GLSL, what is the best strategy for the distribution in the real world and for the desktop and mobile? I'm aiming to distribute this in ...
1
vote
1answer
1k views

Shader authoring/editing tools for GLSL ES

Since Render Monkey has been discontinued (perhaps due to the complexity of today's shading languages), there are few successors that can match its functionality. Is there any useful tool for material ...
5
votes
1answer
281 views

Where to store shaders

I have an OpenGL renderer which has a Scene member variable. The Scene object can contain N SceneObjects. I use these SceneObjects for storing the vertex position and any transforms. My question is, ...
2
votes
1answer
2k views

How to get the texture coordinate of a neighbouring pixel for a blur shader?

I'm still having some trouble to get my head around fragment shaders and doing some image processing on textures. The context is a 2D sprite: a simple texture painted on a quad. All done with OpenGL ...
7
votes
1answer
6k views

What do the components of gl_TexCoord[0] mean?

What are the differences between gl_TexCoord[0].s, gl_TexCoord[0].t gl_TexCoord[0].p and gl_TexCoord[0].x, gl_TexCoord[0].y gl_TexCoord[0].z ? I understand that gl_TexCoord[0].x, gl_TexCoord[0].y ...
4
votes
2answers
2k views

Changing the color of some fragment of a texture using shaders

Declarative programming language QML allows to connect the elements, their properties with universal variables in shader programs description. For these purposes there is such elements as ...
4
votes
1answer
479 views

Phone complains that identical GLSL struct definition differs in vert/frag programs

When I provide the following struct definition in linked frag and vert shaders, my phone (Samsung Vibrant / Android 2.2) complains that the definition differs. struct Light { mediump vec3 ...
2
votes
1answer
2k views

OpenGLES 2.0: Rendering Multiple Sprites - Texel Corruption

I'm having a tremendous time getting the second (or additional) sprites in my game engine to render properly. The first one always works great: it is positioned and sized properly in screen coords, ...
0
votes
2answers
2k views

OpenGL ES 2.0: Calculated Cube Vertex Normals Verification

Could I kindly ask to confirm, that the calculated normals are correct, please? I have calculated them on my own, but my testcube is still strangely lighted within OpenGLES 2.0. The vertices were ...
11
votes
6answers
11k views

OpenGL ES 2.0: Repository of Quality Shaders

Could I kindly ask, to suggest me a repository of high quality OpenGL (OpenGL ES 2.0) vertex and fragment shaders, please? I am looking for pixel based ligting shaders (such as phong) and simmilar. ...
6
votes
1answer
970 views

Adding a simple mix() destroys the framerate

I have a very simple shader and added linear fog via mix like this: finalColor = mix(finalColor, vec3(0.5, 0.8, 0.95), vUVoutAndViewZ.z); Note that the view Z distance is in the variable that also ...
0
votes
1answer
881 views

OpenGL - resize texture when using cubemap

I want to resize my texture. I am using cubemap to compute reflection. I want to use this cubemap to draw skybox. Skybox is drawn but I want to resize texture down, because it is dilated. As I wrote ...
4
votes
2answers
750 views

Optimising the modelview transformation in GLSL for 2D

So, the standard way to transform vertices and then pass to the fragment shader in GLSL is something like this: uniform mat4 u_modelview; attribute vec4 a_position; void main() { gl_Position = ...
2
votes
2answers
3k views

How do I create a sky box with OpenGL ES 2.0?

Can you give me hint to any good sky box example in OpenGL ES 2.0? I have found only OpenGL and does not work for me. I am doing it this way: Initialization: glUseProgram(m_programSkyBox.Program); ...
1
vote
1answer
1k views

OpenGL ES Shader help (Blending)

Earlier I required assistance getting to grips with how to retain the alpha channel of a transparent texture in my colourised texture shader program. Whilst playing with that first version of my ...
13
votes
2answers
15k views

OpenGL ES 2.0: Setting up 2D Projection

This article describes in general, how to draw sharp OpenGL 2D graphics, using fixed function pipeline. http://basic4gl.wikispaces.com/2D+Drawing+in+OpenGL Because OpenGL ES 2.0 has some ES 1.x ...