Tag Info

New answers tagged

2

Try running the java VM with the option -Xss8M to set it to 8 Megabytes. You only have 9 Threads so you should be fine with 9x 8M stacks. Then reduce the amount until it crashes again, bring it back up a bit, then document in your FAQ that this option is needed for some video drivers. java -Xss8M -jar myjarfile.jar The crash logs points to the Intel ...


2

Yes, your Z value, distToCamera, will be correct at each triangle's vertices, but won't be anywhere else (except between vertices of matching Z-value), because of linear interpolation. Edit: In current GLSL, the default interpolation is "in perspective", where gl_Position/gl_FragCoord is taken into account for interpolating. This can be overridden (you ...


1

What makes you think this is the shader code that is slow ? In most machines nowadays, and especially mobile devices, the bottlenecks are not these purely calculation-fed (ALU loaded) shaders, but memory bandwidth. Memory bandwidth is used by framebuffers being fed to shaders as textures, or by the ROPs writing to the render target. Especially bad when ...


0

After a full day of testing and google searching I finally came upon the fix so I'm sharing it here : uniform vec2 Resolution;//This is the render target size, i.e. what you feed into glViewport vec2 screen; screen.x = ( gl_FragCoord.x - Resolution.x / 2.0 ) / ( Resolution.x / 2.0 ); screen.y = ( (Resolution.y - gl_FragCoord.y) - ...


1

I think it's the line right above it: vec3 shadowAmount = 1; change it to: vec3 shadowAmount = vec3(1.0); Looks like your line numbering is off by one. Otherwise try explicitly casting to int in case the compiler has a different bug. int shadowMap = (int)(lightToShadowMapMapping[i]);


1

If you're worried about optimization then use vectors more, the optimizer may or may not do that for you. Avoid conditionals, all branches of them will be executed. But the major bottleneck on modern GPUs is from samplers, pow and log are pretty negligible. If possible then just use sRGB internalformat in your framebuffer, most gpus will do the conversion ...


0

Disable blending when rendering your depth texture. Or use an actual depth texture as depth buffer in a frame buffer object then use that depth texture in later passes with a sampler.


0

You could very well have two separate shaders. A nice way to do this would be to create a Material object that would contain pointers to some shader and maybe a texture (resources should be stored inside a ResourceManager or something similar). But if that's too much work you could always use a special texture that always exists for objects with missing ...


1

I'm not sure what you mean by un-normalized texture coordinates. All texture lookups are going to be in the range of 0-1. You can have them be anywhere in that range however. If you're having precision problems in the range of 0-1 I suspect something else going on. A couple of hints to help fix this: For example, make sure you don't have GL_LINEAR set ...


1

To fix these kinds of issues create a test cubemap clearly marking each face directions and +/- XYZ you can then figure out which one(s) is(are) pointing the wrong way.


9

I tried to implement what teodron suggested: void main() { vec2 uv = gl_FragCoord.xy / resolution.xy; float sepoffset = 0.005*cos(iGlobalTime*3.0); if (uv.y > 0.3 + sepoffset)// is air - no reflection or effect { gl_FragColor = texture2D(texture, vec2(uv.x, -uv.y)); } else { // Compute the mirror effect. ...



Top 50 recent answers are included