Tag Info

New answers tagged

1

You have a very strange code here. Why do you have glDetachShader(program, vertex_shader); glDetachShader(program, fragment_shader); lines in your shader init code? They should be used when you destroy your shaders. Remove them completely or call them on quit. If it won't help, then I suspect that glDisableVertexAttribArray() resets vertex attribs' ...


0

There are a variety of formulae for converting colour to black and white. Furthermore, the programmer might mean something else when converting a vector into a scalar (length would be a common example). The shader compiler keeps things as simple as possible, just taking the first value in the vector, in your example. Experiment with different ways to get a ...


0

I have the same issue, windows 8.1x64 R9290. The shader cannot read the length of a buffer. I got round this by creating another SSBO with containing the lengths of the Light array. I don't need to do this on Nvidia or Intel chips. Another issue is that vec3 types didn't seem to work due to memory padding, so I manually pad all data as a vec4. This ...


2

In order to do a glow or bloom, you generally need to start with an image, threshold it and possibly colorize it, then blur it and add the blurred version to the original. I would do this by creating a few textures and FBOs for multiple passes. Something like this pseudocode: Create an FBO Attach a texture to it to draw into Draw a textured quad with your ...


2

It is actually a very interesting question. Initially I thought that a definitive answer does not even exist; after all, it is only certain that speed difference between these methods deviates based on hardware and driver version, just like it does for every other thing. But what exactly makes that speed deviation? Lets look at the difference between ...


0

Ok the problem turned out to be a typo in the way meshes were being loaded. It caused the Z terms of each vertex to be resolved to the X term... If anyone comes across this and wants to know here is my properly working mesh loader method. public static Mesh loadMesh(String fileName){ String[] splitArray = fileName.split("\\."); String extension = ...


0

Can't comment yet so I post it as an answer, but it appears that you should have a - at ry.m[2][0] and + at ry.m[0][2] when looking at the 3d rotation matrices. Does not make a difference though for an x-only rotation as both of these evaluate to 0.


0

Using the stencil buffer: When writing: dsDesc.StencilEnable = true; dsDesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK; dsDesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK; dsDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS; //Always Pass dsDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_INCR; //Increment dsDesc.FrontFace.StencilFailOp ...


0

It is an old question but recently I faced the same problem doing some real time hatching in the geometry shader. By the sound of your code seems there is nothing wrong in your GS, problem could possibly be in your algorithm to build an adjacency list. I found a good tutorial here, which provides an implementation for finding the adjacent triangles ...


1

It might be your display honestly. Some displays use less color depth than 32 bpp which can cause banding or flickering. You might consider dithering if you end up with no better option than addressing the banding.


0

Looking at the problem further, it just seems to be an issue in darker areas. Adding just a low level of ambient light, such as in the attached image, resolves the issue. Maybe someone else can elaborate on the cause of the problem? I consider the issue resolved for the moment, as I always have some level of ambient lighting present, but further explanation ...


-1

The standard answer to "which is faster" is "profile it and see". Because everything varies a lot by platform, coding pattern, &c. (Method 2, with blending mode, might have direct hardware support... but you never know. Modern cards, behind the scenes, might do exactly the same work as you'd do with your shader.) Method 1 might, overall, "block" for ...



Top 50 recent answers are included