MCPcopy Create free account
hub / github.com/arrayfire/forge / screenQuadVAO

Function screenQuadVAO

src/backend/opengl/common.cpp:304–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304GLuint screenQuadVAO(const int pWindowId)
305{
306 static std::map<int, GLuint> svaoMap;
307
308 if (svaoMap.find(pWindowId)==svaoMap.end()) {
309 static const float texcords[8] = {0.0,1.0,1.0,1.0,1.0,0.0,0.0,0.0};
310 static const uint indices[6] = {0,1,2,0,2,3};
311
312 GLuint tbo = createBuffer(GL_ARRAY_BUFFER, 8, texcords, GL_STATIC_DRAW);
313 GLuint ibo = createBuffer(GL_ELEMENT_ARRAY_BUFFER, 6, indices, GL_STATIC_DRAW);
314
315 GLuint vao = 0;
316 glGenVertexArrays(1, &vao);
317 glBindVertexArray(vao);
318 // attach vbo
319 glEnableVertexAttribArray(0);
320 glBindBuffer(GL_ARRAY_BUFFER, screenQuadVBO(pWindowId));
321 glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, NULL);
322 // attach tbo
323 glEnableVertexAttribArray(1);
324 glBindBuffer(GL_ARRAY_BUFFER, tbo);
325 glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, NULL);
326 // attach ibo
327 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
328 glBindVertexArray(0);
329 /* store the vertex array object corresponding to
330 * the window instance in the map */
331 svaoMap[pWindowId] = vao;
332 }
333
334 return svaoMap[pWindowId];
335}
336
337std::ostream& operator<<(std::ostream& pOut, const glm::mat4& pMat)
338{

Callers 1

bindResourcesMethod · 0.85

Calls 2

createBufferFunction · 0.85
screenQuadVBOFunction · 0.85

Tested by

no test coverage detected