MCPcopy Create free account
hub / github.com/android/ndk-samples / setupGraphics

Function setupGraphics

hello-gl2/app/src/main/cpp/gl_code.cpp:121–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119GLuint gvPositionHandle;
120
121bool setupGraphics(int w, int h) {
122 printGLString("Version", GL_VERSION);
123 printGLString("Vendor", GL_VENDOR);
124 printGLString("Renderer", GL_RENDERER);
125 printGLString("Extensions", GL_EXTENSIONS);
126
127 LOGI("setupGraphics(%d, %d)", w, h);
128 gProgram = createProgram(gVertexShader, gFragmentShader);
129 if (!gProgram) {
130 LOGE("Could not create program.");
131 return false;
132 }
133 gvPositionHandle = glGetAttribLocation(gProgram, "vPosition");
134 checkGlError("glGetAttribLocation");
135 LOGI("glGetAttribLocation(\"vPosition\") = %d\n", gvPositionHandle);
136
137 glViewport(0, 0, w, h);
138 checkGlError("glViewport");
139 return true;
140}
141
142const GLfloat gTriangleVertices[] = {0.0f, 0.5f, -0.5f, -0.5f, 0.5f, -0.5f};
143

Callers 1

InitFunction · 0.85

Calls 3

printGLStringFunction · 0.85
createProgramFunction · 0.70
checkGlErrorFunction · 0.70

Tested by

no test coverage detected