PDA

View Full Version : glMapBufferRange always returns 0



Fitz
03-29-2009, 12:41 AM
I'm using an Nvidia 260(vista 64 driver version 182.47) which is supposed to support this function(and it does find the extention & link correctly), but whenever I call it it returns null. glGetError returns 1281(invalid value?), I've tried pretty much every possible value in the bitfield, but it is always the same results...

Using GLee 5.4, which seems kinda buggy since it originally thought glMapBufferRange returned a void instead of a void*, I made the necessary changes so it should work..

I bind the buffer, check glGetError, it returns 0,call glMapBufferRange(returns 0),check glGetError, it returns 1281...

I dropped the MapBufferRange call into a location where a glMapBuffer call used to be, and it is functionally performing the exact same thing, so I know the surrounding code works.

Here is what I'm doing:

if(m_nMaxVerts < nVerts)
{

m_ChunkVerts.SetData(BufferMode::VERTICES, (nVerts*sizeof(march::ChunkVertex)),vertData,Buffe rUsage::DYNAMIC_DRAW);

m_nMaxVerts = nVerts;
}
else
{

//void* verts = m_ChunkVerts.MapDiscard( BufferMode::VERTICES,
// BufferAccess::WRITE,nVerts*sizeof(march::ChunkVert ex),BufferUsage::DYNAMIC_DRAW);

void* verts = m_ChunkVerts.MapRange(BufferMode::VERTICES,
0,nVerts*sizeof(march::ChunkVertex),GL_MAP_UNSYNCH RONIZED_BIT |GL_MAP_WRITE_BIT|GL_MAP_INVALIDATE_RANGE_BIT );


memcpy(verts,vertData,nVerts*sizeof(march::ChunkVe rtex));
m_ChunkVerts.UnMap(BufferMode::VERTICES);
}



Internally MapRange just does this:

glBindBuffer(mode,m_BufferID);
return glMapBufferRange(mode,OffsetInBytes,nBytes,access_ bitField);


Anyone have any ideas? Or is there something wrong with Nvidia's implementation on this driver?