| 58 | } |
| 59 | |
| 60 | void surface_impl::bindResources(const int pWindowId) |
| 61 | { |
| 62 | if (mVAOMap.find(pWindowId) == mVAOMap.end()) { |
| 63 | GLuint vao = 0; |
| 64 | /* create a vertex array object |
| 65 | * with appropriate bindings */ |
| 66 | glGenVertexArrays(1, &vao); |
| 67 | glBindVertexArray(vao); |
| 68 | // attach plot vertices |
| 69 | glEnableVertexAttribArray(mSurfPointIndex); |
| 70 | glBindBuffer(GL_ARRAY_BUFFER, mVBO); |
| 71 | glVertexAttribPointer(mSurfPointIndex, 3, mDataType, GL_FALSE, 0, 0); |
| 72 | glEnableVertexAttribArray(mSurfColorIndex); |
| 73 | glBindBuffer(GL_ARRAY_BUFFER, mCBO); |
| 74 | glVertexAttribPointer(mSurfColorIndex, 3, GL_FLOAT, GL_FALSE, 0, 0); |
| 75 | glEnableVertexAttribArray(mSurfAlphaIndex); |
| 76 | glBindBuffer(GL_ARRAY_BUFFER, mABO); |
| 77 | glVertexAttribPointer(mSurfAlphaIndex, 1, GL_FLOAT, GL_FALSE, 0, 0); |
| 78 | //attach indices |
| 79 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIBO); |
| 80 | glBindVertexArray(0); |
| 81 | /* store the vertex array object corresponding to |
| 82 | * the window instance in the map */ |
| 83 | mVAOMap[pWindowId] = vao; |
| 84 | } |
| 85 | |
| 86 | glBindVertexArray(mVAOMap[pWindowId]); |
| 87 | } |
| 88 | |
| 89 | void surface_impl::unbindResources() const |
| 90 | { |
nothing calls this directly
no outgoing calls
no test coverage detected