| 154 | } |
| 155 | |
| 156 | int main(void) |
| 157 | { |
| 158 | try { |
| 159 | /* |
| 160 | * First Forge call should be a window creation call |
| 161 | * so that necessary OpenGL context is created for any |
| 162 | * other forge::* object to be created successfully |
| 163 | */ |
| 164 | forge::Window wnd(DIMX, DIMY, "Bubble chart with Transparency Demo"); |
| 165 | wnd.makeCurrent(); |
| 166 | |
| 167 | forge::Chart chart(FG_CHART_2D); |
| 168 | chart.setAxesLimits(FRANGE_START, FRANGE_END, -1.0f, 1.0f); |
| 169 | |
| 170 | /* Create several plot objects which creates the necessary |
| 171 | * vertex buffer objects to hold the different plot types |
| 172 | */ |
| 173 | forge::Plot plt1 = chart.plot(DATA_SIZE, forge::f32, FG_PLOT_LINE, FG_MARKER_TRIANGLE); |
| 174 | forge::Plot plt2 = chart.plot(DATA_SIZE, forge::f32, FG_PLOT_LINE, FG_MARKER_CIRCLE); |
| 175 | |
| 176 | /* Set plot colors */ |
| 177 | plt1.setColor(FG_RED); |
| 178 | plt2.setColor(FG_GREEN); //use a forge predefined color |
| 179 | /* Set plot legends */ |
| 180 | plt1.setLegend("Cosine"); |
| 181 | plt2.setLegend("Tangent"); |
| 182 | /* set plot global marker size */ |
| 183 | plt1.setMarkerSize(20); |
| 184 | |
| 185 | /* |
| 186 | * Helper function to create a CLGL interop context. |
| 187 | * This function checks for if the extension is available |
| 188 | * and creates the context on the appropriate device. |
| 189 | * Note: context and queue are defined in cl_helpers.h |
| 190 | */ |
| 191 | context = createCLGLContext(wnd); |
| 192 | Device device = context.getInfo<CL_CONTEXT_DEVICES>()[0]; |
| 193 | queue = CommandQueue(context, device); |
| 194 | |
| 195 | GfxHandle* handles[5]; |
| 196 | |
| 197 | // create GL-OpenCL interop buffers |
| 198 | createGLBuffer(&handles[0], plt1.vertices(), FORGE_VERTEX_BUFFER); |
| 199 | createGLBuffer(&handles[1], plt2.vertices(), FORGE_VERTEX_BUFFER); |
| 200 | createGLBuffer(&handles[2], plt2.colors(), FORGE_VERTEX_BUFFER); |
| 201 | createGLBuffer(&handles[3], plt2.alphas(), FORGE_VERTEX_BUFFER); |
| 202 | createGLBuffer(&handles[4], plt2.radii(), FORGE_VERTEX_BUFFER); |
| 203 | |
| 204 | cl::Buffer cosOut(context, CL_MEM_READ_WRITE, sizeof(float) * DATA_SIZE * 2); |
| 205 | cl::Buffer tanOut(context, CL_MEM_READ_WRITE, sizeof(float) * DATA_SIZE * 2); |
| 206 | cl::Buffer colorsOut(context, CL_MEM_READ_WRITE, sizeof(float) * DATA_SIZE * 3); |
| 207 | cl::Buffer alphasOut(context, CL_MEM_READ_WRITE, sizeof(float) * DATA_SIZE); |
| 208 | cl::Buffer radiiOut(context, CL_MEM_READ_WRITE, sizeof(float) * DATA_SIZE); |
| 209 | cl::Buffer dummy; |
| 210 | |
| 211 | kernel(cosOut, 0, 0, dummy, dummy, dummy, queue, device); |
| 212 | kernel(tanOut, 1, 0x00000007, colorsOut, alphasOut, radiiOut, queue, device); |
| 213 |
nothing calls this directly
no test coverage detected