CUDA and OpenGL

Hi

I’m trying to enhance the “volumeRender” code included in CUDA’s samples set, so it would support multiple (sub)windows.
I coupled all required resources such as the pbo and the output memory for each window.

At the beginning I got an “unspecified driver error” on calling the cudaGLRegisterBufferObject function for the new pbo.
This problem has been solved by adding glGenBuffersARB for a dummy pbo, just to keep it busy, since the pbo’s are allocated again for each context (saw that tip somewhere on the net).

But, now I encounter different problem: No matter what kind or size of window I try to open and even I render the same volume to the additional window, I get a very partial picture on the added window (to be more accurate: I get the top-right quarter of the window and it contains the bottom-left oc the expected picture).

Does anybody have any idea about a possible reason for such a phenomenon?

Thanks in advance.

I believe you need to reset the modelview projection matrix for each context. No sure though, I usually use a single context.

N.

I hope I understand what you mean by resetting the modelview.

I coupled the display function containing all GL rotation function for each of the required windows and each of these functions is called separately, so I assume it should be OK.

The main original window keeps showing the expected view, but the other window is as I have already described.

As you can see in the attached picture, the human model is viewed just fine in the main view, but when I try to render it also in a sub-window on the left-top corner of the main window, it tooks just the left-bottom part of the model and views it on the right-top corner of the sub-window.

I really have no idea what should be the reason.

I can attach some code if you think it would be helpful.

Never used subwindows myself, so I’m nut sure what the problem can be.
Did you also set the correct glViewport calls?
I can have a look at it if you’ve got a small piece of compilable code that exhibits the problem.

N.