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

Method render

src/backend/opengl/vector_field_impl.cpp:171–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171void vector_field_impl::render(const int pWindowId,
172 const int pX, const int pY, const int pVPW, const int pVPH,
173 const glm::mat4& pView, const glm::mat4& pOrient)
174{
175 static const glm::mat4 ArrowScaleMat = glm::scale(glm::mat4(1), glm::vec3(0.1,0.1,0.1));
176
177 CheckGL("Begin vector_field_impl::render");
178 if (mIsPVAOn) {
179 glDepthMask(GL_FALSE);
180 glEnable(GL_BLEND);
181 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
182 }
183
184 glm::mat4 model = this->computeModelMatrix(pOrient);
185
186 mFieldProgram.bind();
187
188 glUniformMatrix4fv(mFieldPVMatIndex, 1, GL_FALSE, glm::value_ptr(pView));
189 glUniformMatrix4fv(mFieldModelMatIndex, 1, GL_FALSE, glm::value_ptr(model));
190 glUniformMatrix4fv(mFieldAScaleMatIndex, 1, GL_FALSE, glm::value_ptr(ArrowScaleMat));
191 glUniform1i(mFieldPVCOnIndex, mIsPVCOn);
192 glUniform1i(mFieldPVAOnIndex, mIsPVAOn);
193 glUniform4fv(mFieldUColorIndex, 1, mColor);
194
195 if (mDimension==3)
196 glEnable(GL_CULL_FACE);
197 vector_field_impl::bindResources(pWindowId);
198 glDrawArrays(GL_POINTS, 0, mNumPoints);
199 vector_field_impl::unbindResources();
200 if (mDimension==3)
201 glDisable(GL_CULL_FACE);
202
203 mFieldProgram.unbind();
204
205 if (mIsPVAOn) {
206 glDisable(GL_BLEND);
207 glDepthMask(GL_TRUE);
208 }
209 CheckGL("End vector_field_impl::render");
210}
211
212glm::mat4 vector_field2d_impl::computeModelMatrix(const glm::mat4& pOrient)
213{

Callers

nothing calls this directly

Calls 3

computeModelMatrixMethod · 0.95
bindMethod · 0.80
unbindMethod · 0.80

Tested by

no test coverage detected