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

Method render

src/backend/opengl/plot_impl.cpp:191–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189}
190
191void plot_impl::render(const int pWindowId,
192 const int pX, const int pY, const int pVPW, const int pVPH,
193 const glm::mat4& pView, const glm::mat4& pOrient)
194{
195 CheckGL("Begin plot_impl::render");
196 if (mIsPVAOn) {
197 glDepthMask(GL_FALSE);
198 glEnable(GL_BLEND);
199 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
200 }
201
202 glm::mat4 viewModelMatrix = this->computeTransformMat(pView, pOrient);
203
204 if (mPlotType == FG_PLOT_LINE) {
205 mPlotProgram.bind();
206
207 this->bindDimSpecificUniforms();
208 glUniformMatrix4fv(mPlotMatIndex, 1, GL_FALSE, glm::value_ptr(viewModelMatrix));
209 glUniform1i(mPlotPVCOnIndex, mIsPVCOn);
210 glUniform1i(mPlotPVAOnIndex, mIsPVAOn);
211
212 plot_impl::bindResources(pWindowId);
213 glDrawArrays(GL_LINE_STRIP, 0, mNumPoints);
214 plot_impl::unbindResources();
215
216 mPlotProgram.unbind();
217 }
218
219 if (mMarkerType != FG_MARKER_NONE) {
220 glEnable(GL_PROGRAM_POINT_SIZE);
221 mMarkerProgram.bind();
222
223 glUniformMatrix4fv(mMarkerMatIndex, 1, GL_FALSE, glm::value_ptr(viewModelMatrix));
224 glUniform1i(mMarkerPVCOnIndex, mIsPVCOn);
225 glUniform1i(mMarkerPVAOnIndex, mIsPVAOn);
226 glUniform1i(mMarkerPVROnIndex, mIsPVROn);
227 glUniform1i(mMarkerTypeIndex, mMarkerType);
228 glUniform4fv(mMarkerColIndex, 1, mColor);
229 glUniform1f(mMarkerPSizeIndex, mMarkerSize);
230
231 plot_impl::bindResources(pWindowId);
232 glDrawArrays(GL_POINTS, 0, mNumPoints);
233 plot_impl::unbindResources();
234
235 mMarkerProgram.unbind();
236 glDisable(GL_PROGRAM_POINT_SIZE);
237 }
238
239 if (mIsPVAOn) {
240 glDisable(GL_BLEND);
241 glDepthMask(GL_TRUE);
242 }
243 CheckGL("End plot_impl::render");
244}
245
246glm::mat4 plot2d_impl::computeTransformMat(const glm::mat4 pView, const glm::mat4 pOrient)
247{

Callers

nothing calls this directly

Calls 4

computeTransformMatMethod · 0.95
bindMethod · 0.80
unbindMethod · 0.80

Tested by

no test coverage detected