| 28 | int julia(int x, int y, int width, int height); |
| 29 | |
| 30 | int main(void) |
| 31 | { |
| 32 | Bitmap bmp = createBitmap(DIMX, DIMY); |
| 33 | |
| 34 | /* |
| 35 | * First Forge call should be a window creation call |
| 36 | * so that necessary OpenGL context is created for any |
| 37 | * other forge::* object to be created successfully |
| 38 | */ |
| 39 | forge::Window wnd(DIMX, DIMY, "Fractal Demo"); |
| 40 | wnd.makeCurrent(); |
| 41 | |
| 42 | /* create an font object and load necessary font |
| 43 | * and later pass it on to window object so that |
| 44 | * it can be used for rendering text |
| 45 | * |
| 46 | * NOTE: THIS IS OPTIONAL STEP, BY DEFAULT WINDOW WILL |
| 47 | * HAVE FONT ALREADY SETUP*/ |
| 48 | forge::Font fnt; |
| 49 | #if defined(OS_WIN) |
| 50 | fnt.loadSystemFont("Calibri"); |
| 51 | #else |
| 52 | fnt.loadSystemFont("Vera"); |
| 53 | #endif |
| 54 | wnd.setFont(&fnt); |
| 55 | |
| 56 | /* Create an image object which creates the necessary |
| 57 | * textures and pixel buffer objects to hold the image |
| 58 | * */ |
| 59 | forge::Image img(DIMX, DIMY, FG_RGBA, forge::u8); |
| 60 | /* copy your data into the pixel buffer object exposed by |
| 61 | * forge::Image class and then proceed to rendering. |
| 62 | * To help the users with copying the data from compute |
| 63 | * memory to display memory, Forge provides copy headers |
| 64 | * along with the library to help with this task |
| 65 | */ |
| 66 | kernel(bmp); |
| 67 | |
| 68 | GfxHandle* handle = 0; |
| 69 | |
| 70 | // create GL-CPU interop buffer |
| 71 | createGLBuffer(&handle, img.pixels(), FORGE_IMAGE_BUFFER); |
| 72 | |
| 73 | // copy the data from compute buffer to graphics buffer |
| 74 | copyToGLBuffer(handle, (ComputeResourceHandle)bmp.ptr, img.size()); |
| 75 | |
| 76 | do { |
| 77 | wnd.draw(img); |
| 78 | } while(!wnd.close()); |
| 79 | |
| 80 | // destroy GL-CPU Interop buffer |
| 81 | releaseGLBuffer(handle); |
| 82 | destroyBitmap(bmp); |
| 83 | return 0; |
| 84 | } |
| 85 | |
| 86 | Bitmap createBitmap(unsigned w, unsigned h) |
| 87 | { |
nothing calls this directly
no test coverage detected