| 40 | } |
| 41 | |
| 42 | int 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 | } |
nothing calls this directly
no test coverage detected