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

Method bindResources

src/backend/opengl/plot_impl.cpp:28–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26{
27
28void plot_impl::bindResources(const int pWindowId)
29{
30 if (mVAOMap.find(pWindowId) == mVAOMap.end()) {
31 GLuint vao = 0;
32 /* create a vertex array object
33 * with appropriate bindings */
34 glGenVertexArrays(1, &vao);
35 glBindVertexArray(vao);
36 // attach vertices
37 glEnableVertexAttribArray(mPlotPointIndex);
38 glBindBuffer(GL_ARRAY_BUFFER, mVBO);
39 glVertexAttribPointer(mPlotPointIndex, mDimension, mGLType, GL_FALSE, 0, 0);
40 // attach colors
41 glEnableVertexAttribArray(mPlotColorIndex);
42 glBindBuffer(GL_ARRAY_BUFFER, mCBO);
43 glVertexAttribPointer(mPlotColorIndex, 3, GL_FLOAT, GL_FALSE, 0, 0);
44 // attach alphas
45 glEnableVertexAttribArray(mPlotAlphaIndex);
46 glBindBuffer(GL_ARRAY_BUFFER, mABO);
47 glVertexAttribPointer(mPlotAlphaIndex, 1, GL_FLOAT, GL_FALSE, 0, 0);
48 // attach radii
49 glEnableVertexAttribArray(mMarkerRadiiIndex);
50 glBindBuffer(GL_ARRAY_BUFFER, mRBO);
51 glVertexAttribPointer(mMarkerRadiiIndex, 1, GL_FLOAT, GL_FALSE, 0, 0);
52 glBindVertexArray(0);
53 /* store the vertex array object corresponding to
54 * the window instance in the map */
55 mVAOMap[pWindowId] = vao;
56 }
57
58 glBindVertexArray(mVAOMap[pWindowId]);
59}
60
61void plot_impl::unbindResources() const
62{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected