Skip to content
This repository has been archived by the owner on Aug 30, 2020. It is now read-only.

Commit

Permalink
Added line AA sample
Browse files Browse the repository at this point in the history
  • Loading branch information
Christophe Riccio committed Aug 29, 2012
1 parent 7a84864 commit e81846c
Show file tree
Hide file tree
Showing 6 changed files with 192 additions and 117 deletions.
2 changes: 1 addition & 1 deletion data/gl-420/primitive-line-aa.vert
Expand Up @@ -21,5 +21,5 @@ out gl_PerVertex

void main()
{
gl_Position = Transform.MVP * vec4(Position, 0.0, 1.0);
gl_Position = Transform.MVP * vec4(Position.x - 1.0 + gl_InstanceID, Position.y, 0.0, 1.0);
}
13 changes: 13 additions & 0 deletions data/gl-420/primitive-line-splash.frag
@@ -0,0 +1,13 @@
#version 420 core

#define FRAG_COLOR 0

layout(binding = 0) uniform sampler2D Diffuse;

in vec4 gl_FragCoord;
layout(location = FRAG_COLOR, index = 0) out vec4 Color;

void main()
{
Color = texelFetch(Diffuse, ivec2(gl_FragCoord.xy * 0.125), 0);
}
11 changes: 11 additions & 0 deletions data/gl-420/primitive-line-splash.vert
@@ -0,0 +1,11 @@
#version 420 core

out gl_PerVertex
{
vec4 gl_Position;
};

void main()
{
gl_Position = vec4(mix(vec2(-1.0), vec2(3.0), bvec2(gl_VertexID == 1, gl_VertexID == 2)), 0.0, 1.0);
}
2 changes: 1 addition & 1 deletion samples/CMakeLists.txt
Expand Up @@ -242,7 +242,7 @@ set(GL_SHADER_GTC memory-barrier-update.vert memory-barrier-update.frag memory-b
glCreateSampleGTC(memory-barrier)
set(GL_SHADER_GTC picking.vert picking.frag picking.geom)
glCreateSampleGTC(picking)
set(GL_SHADER_GTC primitive-line-aa.vert primitive-line-aa.frag)
set(GL_SHADER_GTC primitive-line-aa.vert primitive-line-aa.frag primitive-line-splash.vert primitive-line-splash.frag)
glCreateSampleGTC(primitive-line-aa)
set(GL_SHADER_GTC texture-2d.vert texture-2d.frag)
glCreateSampleGTC(primitive-bindless-nv)
Expand Down
4 changes: 2 additions & 2 deletions samples/gl-330-fbo-multisample.cpp
Expand Up @@ -159,7 +159,7 @@ bool initFramebuffer()
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, MultisampleTextureName);

// The second parameter is the number of samples.
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 8, GL_RGBA, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y, GL_TRUE);
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 8, GL_RGBA8, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y, GL_TRUE);

glGenFramebuffers(1, &FramebufferRenderName);
glBindFramebuffer(GL_FRAMEBUFFER, FramebufferRenderName);
Expand Down Expand Up @@ -310,7 +310,7 @@ void display()
glBlitFramebuffer(
0, 0, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y,
0, 0, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y,
GL_COLOR_BUFFER_BIT, GL_NEAREST);
GL_COLOR_BUFFER_BIT, GL_LINEAR);
glBindFramebuffer(GL_FRAMEBUFFER, 0);

// Pass 2
Expand Down

0 comments on commit e81846c

Please sign in to comment.