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

Function main

examples/cpu/surface.cpp:42–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42int main(void)
43{
44 /*
45 * First Forge call should be a window creation call
46 * so that necessary OpenGL context is created for any
47 * other forge::* object to be created successfully
48 */
49 forge::Window wnd(1024, 768, "3d Surface Demo");
50 wnd.makeCurrent();
51
52 forge::Chart chart(FG_CHART_3D);
53 chart.setAxesLimits(XMIN-2.0f, XMAX+2.0f, YMIN-2.0f, YMAX+2.0f, -0.5f, 1.f);
54 chart.setAxesTitles("x-axis", "y-axis", "z-axis");
55
56 forge::Surface surf = chart.surface(XSIZE, YSIZE, forge::f32);
57 surf.setColor(FG_YELLOW);
58
59 //generate a surface
60 std::vector<float> function;
61
62 genSurface(DX, function);
63
64 GfxHandle* handle;
65 createGLBuffer(&handle, surf.vertices(), FORGE_VERTEX_BUFFER);
66
67 /* copy your data into the pixel buffer object exposed by
68 * forge::Plot class and then proceed to rendering.
69 * To help the users with copying the data from compute
70 * memory to display memory, Forge provides copy headers
71 * along with the library to help with this task
72 */
73 copyToGLBuffer(handle, (ComputeResourceHandle)function.data(), surf.verticesSize());
74
75 do {
76 wnd.draw(chart);
77 } while(!wnd.close());
78
79 releaseGLBuffer(handle);
80
81 return 0;
82}

Callers

nothing calls this directly

Calls 13

genSurfaceFunction · 0.85
createGLBufferFunction · 0.85
copyToGLBufferFunction · 0.85
releaseGLBufferFunction · 0.85
surfaceMethod · 0.80
makeCurrentMethod · 0.45
setAxesLimitsMethod · 0.45
setAxesTitlesMethod · 0.45
setColorMethod · 0.45
verticesMethod · 0.45
verticesSizeMethod · 0.45
drawMethod · 0.45

Tested by

no test coverage detected