Hi
I am doing a scientific simulation progam, and I need to switch openGL on and off when the program is running.
For example, in the beginning of the running I will switch openGL off, and let the simulation run (so it is faster). And later, I would like to switch openGL on and visualize the system, so I can check out if everything is ok. After that I will switch openGL off again.
But as far as I know, I need to initialize openGL when I switch it on, and the initialization work will kill all the data on GPU. Therefore, I have to copy all the arrays on GPU to CPU one by one, initialize openGL and then re-malloc memory for the array and copy them back to GPU again, which is a lot work to do. It is not that complicated, but I would like to know a better solution of this problem, or a cuda function that does that automatically.
So now what I am doing when I switch on the openGL is as follow:
step 1. copy all arrays from GPU to CPU
step 2. initialize openGL
step 3. malloc memory for the array on GPU
step 4. copy the arrays back to GPU
And what I would like to have is:
step 1. initialize openGL and cuda do the memory stuff for me
or another way:
step 1. initialize openGL without kill the data
Anyone can give me a hint on this?