atomes 1.1.16
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
ogl_shaders.c File Reference

OpenGL shaders for the atomes program. More...

#include "global.h"
+ Include dependency graph for ogl_shaders.c:

Go to the source code of this file.

Macros

#define GLSL(src)   "#version 150\n" #src
 

Variables

const GLchar * point_vertex
 
const GLchar * point_color
 
const GLchar * line_vertex
 
const GLchar * axis_line_vertex
 
const GLchar * line_color
 
const GLchar * line_stipple
 
const GLchar * angle_vertex
 
const GLchar * angle_stipple
 
const GLchar * line_stipple_color
 
const GLchar * angle_color
 
const GLchar * full_vertex
 
const GLchar * full_color
 
const GLchar * sphere_vertex
 
const GLchar * axis_sphere_vertex
 
const GLchar * gs_cylinder_vertex
 
const GLchar * cylinder_vertex
 
const GLchar * cone_vertex
 
const GLchar * cap_vertex
 
const GLchar * gs_cylinder_geom
 
const GLchar * axis_cylinder_geom
 
const GLchar * polyedron_vertex
 
const GLchar * polyedron_geom
 
const GLchar * polyedron_color
 
const GLchar * pick_color
 
const GLchar * string_vertex
 
const GLchar * angstrom_vertex
 
const GLchar * degree_vertex
 
const GLchar * string_color
 
const GLchar * string_color_2d
 

Detailed Description

OpenGL shaders for the atomes program.

Author
Sébastien Le Roux sebas.nosp@m.tien.nosp@m..lero.nosp@m.ux@i.nosp@m.pcms..nosp@m.unis.nosp@m.tra.f.nosp@m.r

Definition in file ogl_shaders.c.

Macro Definition Documentation

◆ GLSL

#define GLSL ( src)    "#version 150\n" #src

Definition at line 41 of file ogl_shaders.c.

Variable Documentation

◆ angle_color

const GLchar* angle_color
Initial value:
= GLSL(
uniform int factor;
uniform uint pattern;
in float line_pos;
in vec4 v_color;
out vec4 fragment_color;
void main()
{
fragment_color = v_color;
if (line_pos == -1.0) discard;
}
)
int main(int argc, char *argv[])
initialization of the atomes program
Definition main.c:642
#define GLSL(src)
Definition ogl_shaders.c:41

Definition at line 343 of file ogl_shaders.c.

◆ angle_stipple

const GLchar* angle_stipple

Definition at line 154 of file ogl_shaders.c.

◆ angle_vertex

const GLchar* angle_vertex
Initial value:
= GLSL(
uniform mat4 mvp;
in vec3 vert;
in vec4 vertColor;
out vec4 vert_color;
void main()
{
vert_color = vertColor;
gl_Position = vec4(vert, 1.0);
}
)

Definition at line 141 of file ogl_shaders.c.

◆ angstrom_vertex

const GLchar* angstrom_vertex

Definition at line 1426 of file ogl_shaders.c.

◆ axis_cylinder_geom

const GLchar * axis_cylinder_geom

Definition at line 939 of file ogl_shaders.c.

◆ axis_line_vertex

const GLchar* axis_line_vertex
Initial value:
= GLSL(
uniform mat4 mvp;
uniform vec4 vertColor;
in vec3 vert;
out vec4 vert_color;
void main()
{
vert_color = vertColor;
gl_Position = mvp * vec4(vert, 1.0);
}
)

Definition at line 93 of file ogl_shaders.c.

◆ axis_sphere_vertex

const GLchar* axis_sphere_vertex
Initial value:
= GLSL(
uniform mat4 mvp;
uniform mat4 m_view;
uniform vec4 vertColor;
in vec3 vert;
in vec3 vertNormal;
out vec4 surfaceColor;
out vec3 surfacePosition;
out vec3 surfaceNormal;
out vec3 surfaceToCamera;
void main ()
{
surfaceColor = vertColor;
vec4 pos = vec4(vert, 1.0);
surfacePosition = vec3(m_view * pos);
surfaceNormal = mat3(m_view) * vertNormal;
surfaceToCamera = normalize (- surfacePosition);
gl_PointSize = 1.0;
gl_Position = mvp * pos;
}
)

Definition at line 711 of file ogl_shaders.c.

◆ cap_vertex

const GLchar* cap_vertex

Definition at line 830 of file ogl_shaders.c.

◆ cone_vertex

const GLchar* cone_vertex

Definition at line 788 of file ogl_shaders.c.

◆ cylinder_vertex

const GLchar* cylinder_vertex

Definition at line 748 of file ogl_shaders.c.

◆ degree_vertex

const GLchar* degree_vertex

Definition at line 1549 of file ogl_shaders.c.

◆ full_color

const GLchar* full_color

Definition at line 381 of file ogl_shaders.c.

◆ full_vertex

const GLchar* full_vertex
Initial value:
= GLSL(
uniform mat4 mvp;
uniform mat4 m_view;
in vec3 vert;
in vec3 vertNormal;
in vec4 vertColor;
out vec4 surfaceColor;
out vec3 surfacePosition;
out vec3 surfaceNormal;
out vec3 surfaceToCamera;
void main ()
{
surfaceColor = vertColor;
surfacePosition = vec3(m_view * vec4(vert, 1.0f));
surfaceNormal = mat3(m_view) * vertNormal;
surfaceToCamera = normalize (- surfacePosition);
gl_Position = mvp * vec4(vert, 1.0f);
}
)

Definition at line 359 of file ogl_shaders.c.

◆ gs_cylinder_geom

const GLchar* gs_cylinder_geom

Definition at line 869 of file ogl_shaders.c.

◆ gs_cylinder_vertex

const GLchar* gs_cylinder_vertex
Initial value:
= GLSL(
in vec3 vert;
in vec4 vertColor;
out vec4 vertCol;
void main ()
{
vertCol = vertColor;
gl_Position = vec4(vert, 1.0);
}
)

Definition at line 737 of file ogl_shaders.c.

◆ line_color

const GLchar* line_color
Initial value:
= GLSL(
in vec4 vert_color;
out vec4 fragment_color;
void main()
{
fragment_color = vert_color;
}
)

Definition at line 106 of file ogl_shaders.c.

◆ line_stipple

const GLchar* line_stipple
Initial value:
= GLSL(
layout(lines) in;
layout(line_strip, max_vertices=2) out;
in vec4 vert_color[];
uniform float depth;
out float line_pos;
out vec4 v_color;
void main()
{
vec2 win_pos_0 = gl_in[0].gl_Position.xy;
vec2 win_pos_1 = gl_in[1].gl_Position.xy;
gl_Position = gl_in[0].gl_Position;
line_pos = 0.0;
v_color = vert_color[0];
EmitVertex();
gl_Position = gl_in[1].gl_Position;
float psize = 3.0;
line_pos = psize * length(win_pos_1 - win_pos_0);
line_pos *= depth;
v_color = vert_color[1];
EmitVertex();
EndPrimitive();
}
)
PangoLayout * layout
Definition curve.c:79

Definition at line 115 of file ogl_shaders.c.

◆ line_stipple_color

const GLchar* line_stipple_color
Initial value:
= GLSL(
uniform int factor;
uniform uint pattern;
in float line_pos;
in vec4 v_color;
out vec4 fragment_color;
void main()
{
fragment_color = v_color;
if (line_pos == -1.0) discard;
uint bit = uint(round(line_pos/factor)) % 16U;
if ((pattern & (1U<<bit)) == 0U) discard;
}
)

Definition at line 327 of file ogl_shaders.c.

◆ line_vertex

const GLchar* line_vertex
Initial value:
= GLSL(
uniform mat4 mvp;
in vec3 vert;
in vec4 vertColor;
out vec4 vert_color;
void main()
{
vert_color = vertColor;
gl_Position = mvp * vec4(vert, 1.0);
}
)

Definition at line 80 of file ogl_shaders.c.

◆ pick_color

const GLchar* pick_color
Initial value:
= GLSL(
in vec4 vert_color;
out uvec4 fragment_color;
void main()
{
fragment_color = uvec4(vert_color);
}
)

Definition at line 1365 of file ogl_shaders.c.

◆ point_color

const GLchar* point_color
Initial value:
= GLSL(
in vec4 vert_color;
out vec4 fragment_color;
void main()
{
fragment_color = vert_color;
}
)

Definition at line 59 of file ogl_shaders.c.

◆ point_vertex

const GLchar* point_vertex
Initial value:
= GLSL(
uniform mat4 mvp;
in vec3 vert;
in vec3 offset;
in float size;
in vec4 vertColor;
out vec4 vert_color;
void main()
{
vert_color = vertColor;
gl_PointSize = size;
gl_Position = mvp * vec4(vert + offset, 1.0);
}
)

Definition at line 43 of file ogl_shaders.c.

◆ polyedron_color

const GLchar* polyedron_color

Definition at line 1060 of file ogl_shaders.c.

◆ polyedron_geom

const GLchar* polyedron_geom

Definition at line 1017 of file ogl_shaders.c.

◆ polyedron_vertex

const GLchar* polyedron_vertex
Initial value:
= GLSL(
in vec4 vert;
in vec4 vertColor;
out vec4 surfaceColor;
void main ()
{
surfaceColor = vertColor;
gl_Position = vert;
}
)

Definition at line 1005 of file ogl_shaders.c.

◆ sphere_vertex

const GLchar* sphere_vertex
Initial value:
= GLSL(
uniform mat4 mvp;
uniform mat4 m_view;
in vec3 vert;
in vec3 offset;
in vec4 vertColor;
in float radius;
out vec4 surfaceColor;
out vec3 surfacePosition;
out vec3 surfaceNormal;
out vec3 surfaceToCamera;
void main ()
{
surfaceColor = vertColor;
vec4 pos = vec4 (radius*vert + offset, 1.0);
surfacePosition = vec3(m_view * pos);
surfaceNormal = mat3(m_view) * vert;
surfaceToCamera = normalize (- surfacePosition);
gl_PointSize = 1.0;
gl_Position = mvp * pos;
}
)

Definition at line 686 of file ogl_shaders.c.

◆ string_color

const GLchar* string_color
Initial value:
= GLSL(
uniform sampler2DRect tex;
uniform vec4 vert_color;
uniform vec4 viewp;
uniform int tilted;
in vec2 text_coords;
out vec4 fragment_color;
void main()
{
vec2 coords = text_coords;
fragment_color = vert_color * vec4(1.0, 1.0, 1.0, texture (tex, text_coords).r);
}
)

Definition at line 1715 of file ogl_shaders.c.

◆ string_color_2d

const GLchar* string_color_2d
Initial value:
= GLSL(
uniform sampler2DRect tex;
uniform vec4 vert_color;
in vec2 text_coords;
out vec4 fragment_color;
void main()
{
vec4 sampled = vec4(1.0, 1.0, 1.0, texture (tex, text_coords).r);
fragment_color = vert_color * sampled;
}
)

Definition at line 1730 of file ogl_shaders.c.

◆ string_vertex

const GLchar* string_vertex

Definition at line 1374 of file ogl_shaders.c.