Tag Info

New answers tagged

0

Write your own botnet. I faced the same problem of not being able to test if shaders even compiled and linked on GLSL implementations and it drove me to a crude solution. I made small tools that ran in the background on a machine, waiting for JSON bundles with shaders sources to compile and link together using a windowless OpenGL context, returning the ...


4

Khronos provides a reference GLSL compiler. It is capable of validating GLSL up to version 3.50 (full support) and up to 4.50 (partial support). It also handles ESSL (OpenGL ES's GLSL). The tool verifies that the shader conforms to the GLSL specification. This does not necessarily guarantee that it works with all drivers but it does guarantee that the ...


1

You are using GL_DEPTH_COMPONENT24 which is a fixed-point format clamped to the range [0, 1] inclusively. The floating point formats are GL_DEPTH_COMPONENT32F and DEPTH32F_STENCIL8. glTexImage2D GL_TEXTURE_2D 0 GL_DEPTH_COMPONENT32F shadowMapResolution shadowMapResolution 0 ...


1

Check if you have mipmaps enabled on the texture samplers ( GL_LINEAR_MIPMAP_LINEAR, etc ). If the texture is incomplete (only 1 mipmap level is rendered to by the FBO at a time) and mipmaps are enabled on the sampler you'll get white textures. Switch to GL_LINEAR or GL_NEAREST set GL_TEXTURE_MAX_LEVEL​ to 0 so it only use the first mipmap (same as no ...


3

try using a multiplicative "bias" instead of additive: shadowCoordinate.z *= 0.98; If you're doing the sampling yourself rather than using the shadow comparator interpolating the shadow map helps reduce acne a lot. There shouldn't be any shadow visible behind the object as the light should not affect it with the light being completely occluded by the ...


0

Personally, I would pass the array of liquid, free flowing particles into an array of inter connected, rigidly attached particles. Basically, I am saying to take the hint of your physics code, that let's you know when a particle's rigid body went to sleep by having its velocity reach or approach 0 for enough time. Use this information to weld particles ...


1

The reason is due to a bug in the driver (or an overlooked gotcha in the GLSL language?). Your vertex shader uses some of the struct members, your fragment shader uses a different set of the struct members, and the drivers ends up creating 2 different types by independently eliminating the unused uniforms from the struct type in both shaders which cause them ...


4

It would be nice if I could retrieve the values from memory after the the shader has calculated them but it doesn't seem possible - or advisable But, it IS possible, and I would advise it: https://www.opengl.org/wiki/Transform_Feedback


1

The basic cause of the problem was that my value for screenY (2D location of mouseclick on Y-axis) was incorrect and so passing it to any valid picking ray function returned invalid results. My old working project got the mouse position values from the org.lwjgl.input.Mouse class whereas the new project is using java.awt.event.MouseListener. The lwjgl ...


0

You could use an user-defined conversion, something like this: struct GpuVec3 { public: GpuVec3() {} GpuVec3& GpuVec3::operator=(const vec3& other) { v.x = other.x; v.y = other.y; v.z = other.z; v.w = 1.0f; return *this; } operator glm::vec3() const { return v.xyz; } private: vec4 ...


1

I think you would do to keep your GPUVec3 and your vec3 as two separate classes, not one containing the other. Here's an example: struct vec3 { float x,y,z; }; struct GPUVec3 { float x,y,z, pad; GPUVec3() { } GPUVec3( float x, float y, float z ) { } GPUVec3( const vec3 & v ) { } operator vec3 const & () const { return ...


1

Tobias, If you declare your vec3 class in C++ as having 16 byte alignment, you will have the matching offset. struct vec3 { float x,y,z; } __attribute__ ((aligned(16))); However this will align it everywhere. You might want a GPUVec3 which is aligned, and has copy constructor from your general vec3 so you don't burn that extra float everywhere. I ...


-1

Sounds like an alignment or memory size issue. Perhaps with this one increased float your memory needs are being bumped up to some magic number that slows down the MAC (I don't use MACs myself) but most likely it is causing an alignment issue. Consider a C++ type structure in pseudo code: struct myStruct { char x; int y; } If this structure is ...


8

You already know what you have to do, I'll just summarize it. There are three ways to solve your problem: Go ahead and make a conditional like you're saying, either by sampling the texture or by creating a separate uniform for this purpose. As you probably know, adding branching on a shader is almost never a good idea, and much less so in the fragment ...



Top 50 recent answers are included