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

Method init

gles3jni/app/src/main/cpp/RendererES2.cpp:84–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82 mOffsetUniform(-1) {}
83
84bool RendererES2::init() {
85 mProgram = createProgram(VERTEX_SHADER, FRAGMENT_SHADER);
86 if (!mProgram) return false;
87 mPosAttrib = glGetAttribLocation(mProgram, "pos");
88 mColorAttrib = glGetAttribLocation(mProgram, "color");
89 mScaleRotUniform = glGetUniformLocation(mProgram, "scaleRot");
90 mOffsetUniform = glGetUniformLocation(mProgram, "offset");
91
92 glGenBuffers(1, &mVB);
93 glBindBuffer(GL_ARRAY_BUFFER, mVB);
94 glBufferData(GL_ARRAY_BUFFER, sizeof(QUAD), &QUAD[0], GL_STATIC_DRAW);
95
96 ALOGV("Using OpenGL ES 2.0 renderer");
97 return true;
98}
99
100RendererES2::~RendererES2() {
101 /* The destructor may be called after the context has already been

Callers 1

createES2RendererFunction · 0.45

Calls 1

createProgramFunction · 0.70

Tested by

no test coverage detected