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

Function main

examples/cpu/plot3.cpp:40–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40int main(void)
41{
42 /*
43 * First Forge call should be a window creation call
44 * so that necessary OpenGL context is created for any
45 * other forge::* object to be created successfully
46 */
47 forge::Window wnd(DIMX, DIMY, "Three dimensional line plot demo");
48 wnd.makeCurrent();
49
50 forge::Chart chart(FG_CHART_3D);
51
52 chart.setAxesLabelFormat("%3.1f", "%3.1f", "%.2e");
53
54 chart.setAxesLimits(-1.1f, 1.1f, -1.1f, 1.1f, 0.f, 10.f);
55
56 chart.setAxesTitles("x-axis", "y-axis", "z-axis");
57
58 forge::Plot plot3 = chart.plot(ZSIZE, forge::f32);
59
60 //generate a surface
61 std::vector<float> function;
62 static float t=0;
63 generateCurve(t, DX, function);
64
65 GfxHandle* handle;
66 createGLBuffer(&handle, plot3.vertices(), FORGE_VERTEX_BUFFER);
67
68 /* copy your data into the pixel buffer object exposed by
69 * forge::Plot class and then proceed to rendering.
70 * To help the users with copying the data from compute
71 * memory to display memory, Forge provides copy headers
72 * along with the library to help with this task
73 */
74 copyToGLBuffer(handle, (ComputeResourceHandle)function.data(), plot3.verticesSize());
75
76 do {
77 t+=0.01f;
78 generateCurve(t, DX, function);
79 copyToGLBuffer(handle, (ComputeResourceHandle)function.data(), plot3.verticesSize());
80 wnd.draw(chart);
81 } while(!wnd.close());
82
83 releaseGLBuffer(handle);
84
85 return 0;
86}

Callers

nothing calls this directly

Calls 13

generateCurveFunction · 0.85
createGLBufferFunction · 0.85
copyToGLBufferFunction · 0.85
releaseGLBufferFunction · 0.85
plotMethod · 0.80
makeCurrentMethod · 0.45
setAxesLabelFormatMethod · 0.45
setAxesLimitsMethod · 0.45
setAxesTitlesMethod · 0.45
verticesMethod · 0.45
verticesSizeMethod · 0.45
drawMethod · 0.45

Tested by

no test coverage detected