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

Method bindResources

src/backend/opengl/histogram_impl.cpp:30–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28{
29
30void histogram_impl::bindResources(const int pWindowId)
31{
32 if (mVAOMap.find(pWindowId) == mVAOMap.end()) {
33 CheckGL("Begin histogram_impl::bindResources");
34 GLuint vao = 0;
35 /* create a vertex array object
36 * with appropriate bindings */
37 glGenVertexArrays(1, &vao);
38 glBindVertexArray(vao);
39 // attach histogram bar vertices
40 glEnableVertexAttribArray(mPointIndex);
41 glBindBuffer(GL_ARRAY_BUFFER, screenQuadVBO(pWindowId));
42 glVertexAttribPointer(mPointIndex, 2, GL_FLOAT, GL_FALSE, 0, 0);
43 // attach histogram frequencies
44 glEnableVertexAttribArray(mFreqIndex);
45 glBindBuffer(GL_ARRAY_BUFFER, mVBO);
46 glVertexAttribPointer(mFreqIndex, 1, mGLType, GL_FALSE, 0, 0);
47 glVertexAttribDivisor(mFreqIndex, 1);
48 // attach histogram bar colors
49 glEnableVertexAttribArray(mColorIndex);
50 glBindBuffer(GL_ARRAY_BUFFER, mCBO);
51 glVertexAttribPointer(mColorIndex, 3, GL_FLOAT, GL_FALSE, 0, 0);
52 glVertexAttribDivisor(mColorIndex, 1);
53 // attach histogram bar alphas
54 glEnableVertexAttribArray(mAlphaIndex);
55 glBindBuffer(GL_ARRAY_BUFFER, mABO);
56 glVertexAttribPointer(mAlphaIndex, 1, GL_FLOAT, GL_FALSE, 0, 0);
57 glVertexAttribDivisor(mAlphaIndex, 1);
58 glBindVertexArray(0);
59 /* store the vertex array object corresponding to
60 * the window instance in the map */
61 mVAOMap[pWindowId] = vao;
62 CheckGL("End histogram_impl::bindResources");
63 }
64
65 glBindVertexArray(mVAOMap[pWindowId]);
66}
67
68void histogram_impl::unbindResources() const
69{

Callers

nothing calls this directly

Calls 1

screenQuadVBOFunction · 0.85

Tested by

no test coverage detected