MCPcopy Create free account
hub / github.com/TankOs/SFGUI / SetupShader

Method SetupShader

src/SFGUI/Canvas.cpp:630–658  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

628}
629
630void Canvas::SetupShader() {
631 m_shader = CreateShader(
632 "#version 130\n"
633 "in vec2 vertex;\n"
634 "in vec2 texture_coordinate;\n"
635 "out vec2 vertex_texture_coordinate;\n"
636 "void main() {\n"
637 "\tgl_Position = vec4(vertex.xy, 1.f, 1.f);\n"
638 "\tvertex_texture_coordinate = texture_coordinate;\n"
639 "}\n",
640 "#version 130\n"
641 "uniform sampler2D texture0;\n"
642 "in vec2 vertex_texture_coordinate;\n"
643 "out vec4 fragment_color;\n"
644 "void main() {\n"
645 "\tfragment_color = texture(texture0, vertex_texture_coordinate);\n"
646 "}\n"
647 );
648
649 if( !m_shader ) {
650 non_legacy_supported = false;
651
652 return;
653 }
654
655 CheckGLError( m_texture_location = GLEXT_glGetUniformLocation( CastToGlHandle( m_shader ), "texture0" ) );
656 CheckGLError( m_vertex_location = GetAttributeLocation( m_shader, "vertex" ) );
657 CheckGLError( m_texture_coordinate_location = GetAttributeLocation( m_shader, "texture_coordinate" ) );
658}
659
660}

Callers

nothing calls this directly

Calls 2

CreateShaderFunction · 0.70
GetAttributeLocationFunction · 0.70

Tested by

no test coverage detected