Lynx Lynx
Lynx Lynx

Reputation: 63

cuda and opengl - efficiency problem

I wonder why a way to initialize vbo make a big difference in fps when interacting with cuda. When I create vbo there are two possibilities:

1.~408 fps 2. ~75 fps

You can check this behaviour using a Simple OpenGL example from Nvidia GPU Computing SDK.

Upvotes: 1

Views: 331

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 473232

Because the first case doesn't have to upload data to the GPU. The second case does.

It's the difference between:

void *memory = malloc(size);

and

void *memory = malloc(size);
memcpy(memory, data, size);

The first is necessarily faster than the second.

Also, you may wish to use GL_STREAM_DRAW instead of GL_DYNAMIC_DRAW if you're frequently calling glBufferData on the same buffer object.

Upvotes: 1

Related Questions