Juan J. Sánchez
Sponsor
I heard Jason is so far back in the closet he reached Narnia.Jason":3no4l0uf said:I heard he wants to find all seven dragon balls and turn them into a string of anal beads
I heard Jason is so far back in the closet he reached Narnia.Jason":3no4l0uf said:I heard he wants to find all seven dragon balls and turn them into a string of anal beads
Spoo":k2xdff53 said:and The Crimson Crown is probably my favorite fantasy novel.
<div id="{CB}" style="font-family: monospace;"><ol>#version 330 core
// output
layout (location = 0) out vec4 color;
// receiving texture coordinate data from vertex shader
in DATA
{
vec2 tc;
} fs_in;
// texture object
uniform sampler2D tex;
void main()
{
color = texture(tex,fs_in.tc);
}
You need to enable blending with glEnable( GL_BLEND ); on the driver side (In your Java code).ZenVirZan":3fk3x331 said:I've learnt Java and I've been working on a game using LWJGL and I'm up to using shaders. I've been following a tutorial for the most part, especially for setting up the OpenGL workspace. One thing the tutorial does not cover is how to get alpha blending to work.
I have a fragment shader that receives a Texture object of an RGBA image. What do I do to get transparency working?
Code:<div id="{CB}" style="font-family: monospace;"><ol>#version 330 core // output layout (location = 0) out vec4 color; // receiving texture coordinate data from vertex shader in DATA { vec2 tc; } fs_in; // texture object uniform sampler2D tex; void main() { color = texture(tex,fs_in.tc); }
<div class="c" id="{CB}" style="font-family: monospace;"><ol>glDisable( GL_BLEND ); // Do not use blending
glEnable( GL_ALPHA_TEST ); // Enable alpha discard
glAlphaFunc( GL_GEQUAL, <span style="color: #cc66cc;">0.5f ); // Only draw fragments with an alpha greater than or equal to 0.5
Don't do this if you are using a depth buffer; modern GPUs will do the depth test first before running a fragment shader to avoid shading a fragment only to have it fail the depth test. The discard keyword disables this early Z optimisation.ZenVirZan":26ajwbvr said:I was discarding fragments within the fragment shader if they were transparent initially, but yeah, that's not what I was looking for.
That is because GL_FUNC_ADD is the default setting, it will already be set to that. You want to find this value though as explicitly setting as you need it is very important for state tracking; OpenGame.exe as an example pre-sets a number of states at initialisation so it's very difficult to track state changes as a result and makes adding new visual features more difficult.ZenVirZan":26ajwbvr said:I did what you said without the GL_FUNC_ADD as I can't find it for the life of me, and it seems to work fine. Thanks a bunch.
What CPU did you get?Spoo":84s7teiu said:My new motherboard and CPU should arrive tomorrow, and the SSD should come tomorrow or Tuesday. I've just got the two GTX 980ti cards to go and I'll have the essential parts of the new rig done. Still haven't decided on a CPU cooler or case yet.