Ajout du support du multi-GPU pour Mandelbrot.
[GPU.git] / WCudaMSE / Student_Cuda_Image / src / cpp / core / mainGL.cpp
1 #include <iostream>
2 #include <stdlib.h>
3 #include <string.h>
4 using namespace std;
5
6 #include "GLUTImageViewers.h"
7
8 #include "Device.h"
9 #include "cudaTools.h"
10
11 #include "Rippling0Provider.h"
12 #include "RipplingProvider.h"
13 #include "FractalProvider.h"
14 #include "NewtonProvider.h"
15 #include "HeatTransfertProvider.h"
16 #include "RayTracingProvider.h"
17
18 template <class TOutput, class TProvider>
19 class Viewer
20 {
21 private:
22 TOutput* ptrOutput;
23 GLUTImageViewers viewer;
24
25 public:
26 Viewer(bool isAnimation, bool isSelection, int pxFrame, int pyFrame):
27 ptrOutput(TProvider::createGL()),
28 viewer(ptrOutput, isAnimation, isSelection, pxFrame, pyFrame)
29 {
30 }
31
32 Viewer(TOutput* output, bool isAnimation, bool isSelection, int pxFrame, int pyFrame):
33 ptrOutput(output),
34 viewer(ptrOutput, isAnimation, isSelection, pxFrame, pyFrame)
35 {
36 }
37
38 ~Viewer()
39 {
40 delete this->ptrOutput;
41 }
42 };
43
44 int mainGL(void)
45 {
46 // Viewer<Rippling0Image, Rippling0Provider> rippling0(true, true, 10, 10);
47 // Viewer<Image, RipplingProvider> rippling0(true, true, 10, 10);
48 Viewer<ImageFonctionel, MandelbrotProvider> fractalMandelbrot(MandelbrotProvider::createGL(true), true, true, 20, 20);
49 // Viewer<ImageFonctionel, JuliaProvider> fractalJulia(true, true, 30, 30);
50 // Viewer<ImageFonctionel, NewtonProvider> newtown(true, true, 20, 20);
51 // Viewer<Image, HeatTransfertProvider> heatTransfert(true, false, 20, 20);
52 // Viewer<ImageFonctionel, RayTracingProvider> rayTracing(true, true, 20, 20);
53
54 GLUTImageViewers::runALL(); // Bloquant, Tant qu'une fenetre est ouverte.
55
56 return EXIT_SUCCESS;
57 }