Problems with VBOs again ...

Hello,

i’ve trouble with VBOs again, and hope someone of u could help before i get nuts …

In my application i try to realize billboarding based on VBOs. Every billboard is defined by 4 vector objects which are constructed with an zero value. On each frame i calculate the allignment an set the new coords in this objects.

All works fine in imidiate mode based on normal vertex arrays. When i try to use VBOs it only works, when i create every Frame new VBO-Buffer Datas, but the Frame-Rate is the same like in imidiate mode (

When i use glGetBufferData or glMapBuffer, then i can manipulate the coords and set them on the pointers, but i can see nothing during rendering …

Here is my testcode fragment:

// Get the buffer size
int vboSize=0;
glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &vboSize);

// Init data Pointer
CVector* vboGPUData = (CVector*)malloc(vboSize);

//Get Vectors
glGetBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, vboSize, vboGPUData);

// Calculate alligment and set them on Data
Object->calculateBillboardAlligment();
vboGPUData = billboard->getVertices();

glVertexPointer( 3, GL_FLOAT, 0, (char *) NULL );

glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, *billboard->getTextureIDReference());

glBindBufferARB( GL_ARRAY_BUFFER_ARB, *billboard->getVBOTextureNameID());
glTexCoordPointer( 2, GL_FLOAT, 0, (char *) NULL );

// reder
glDrawArrays( GL_QUADS, 0,billboard->getVertexCount());

It is possible, that the problems are triggered by texturebinding?

Thanks 4 any help in advance,
Christian

Your code is confusing. This may not be related to VBOs at all, but rather to your programming.

CVector* vboGPUData = (CVector*)malloc(vboSize):
vboGPUData = billboard->getVertices();

This is a memory leak. You allocate memory, then you throw away the pointer. The second line does not copy the data, it merely overwrites the pointer variable. The previous contents of the array are lost in the process (the old pointer is the only way to access them and you threw it away).

glBindBufferARB( GL_ARRAY_BUFFER_ARB, *billboard->getVBOTextureNameID());

What’s this supposed to do?
You get a pointer from some (badly misnamed) function, dereference it, and use the result as a VBO name. Was that what you wanted? Does the pointer returned by that function point to a valid VBO name, and was the corresponding VBO properly set up and filled with data?

I suspect the dereference yields zero, or just some random value. Zero would mean that you effectively disable VBOs at that point, and proceed to set an invalid texture coord pointer (NULL in system memory = bad idea). Some random number would get you a new but empty (and zero sized) VBO.

[QUOTE]Originally posted by zeckensack:
This is a memory leak. You allocate memory, then you throw away the pointer.

Ok, u’re right, it’s an failure but this is not the problem … i’ve throw it away! I’ve solved the problem… Think its time for an outtime ;o) Thx…