| 302 | } |
| 303 | |
| 304 | GLuint 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 | |
| 337 | std::ostream& operator<<(std::ostream& pOut, const glm::mat4& pMat) |
| 338 | { |
no test coverage detected