MCPcopy Create free account
hub / github.com/RetroAchievements/RALibretro / createProgram

Method createProgram

src/components/Video.cpp:803–828  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

801}
802
803GLuint Video::createProgram(GLint* pos, GLint* uv, GLint* tex)
804{
805 static const char* vertexShader =
806 "attribute vec2 a_pos;\n"
807 "attribute vec2 a_uv;\n"
808 "varying vec2 v_uv;\n"
809 "void main() {\n"
810 " v_uv = a_uv;\n"
811 " gl_Position = vec4(a_pos, 0.0, 1.0);\n"
812 "}";
813
814 static const char* fragmentShader =
815 "varying vec2 v_uv;\n"
816 "uniform sampler2D u_tex;\n"
817 "void main() {\n"
818 " gl_FragColor = texture2D(u_tex, v_uv);\n"
819 "}";
820
821 GLuint program = GlUtil::createProgram(vertexShader, fragmentShader);
822
823 *pos = Gl::getAttribLocation(program, "a_pos");
824 *uv = Gl::getAttribLocation(program, "a_uv");
825 *tex = Gl::getUniformLocation(program, "u_tex");
826
827 return program;
828}
829
830bool Video::ensureVertexArray(unsigned windowWidth, unsigned windowHeight, float texScaleX, float texScaleY, GLint pos, GLint uv)
831{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected