PDA

View Full Version : what is the fastest means to update data in a dynamic VBO? -nt-



opengl_enquirer
10-02-2003, 03:24 PM
no text

Korval
10-02-2003, 03:47 PM
Implementation dependent.

Note: please don't post no-text posts anymore. They're really annoying. Any question worth answering requires at least a paragraph.

opengl_enquirer
10-02-2003, 05:14 PM
you want text, we got text...

Topic Topic Starter Replies Last Post
are gradients possible in the stencil buffer? ref/mask perhaps? opengl_enquirer 7 10-02-2003 07:11 PM
Ideal vertex buffer sizes for various vendors CatAtWork 0 10-02-2003 06:20 PM
what is the fastest means to update data in a dynamic VBO? -nt- opengl_enquirer 1 10-02-2003 05:47 PM
offscreen rendering under Windows projet_chu 1 10-02-2003 05:36 PM
List of cards with small GL_MAX_TEXTURE_SIZEs? Punchey 1 10-02-2003 05:33 PM
outputting mux to final combiner quynh-clone 5 10-02-2003 03:26 PM
Dynamic lightmapping demo gator 18 10-02-2003 01:45 PM
headach with GL_ARB_MULTISAMPLE V-man 2 10-02-2003 12:52 PM
how to describe logic sravan 0 10-02-2003 11:17 AM
Query Pixel data from texture rahul.bahl 4 10-02-2003 09:55 AM
Shadow volume problems Jens Scheddin 9 10-02-2003 09:48 AM
how to draw a 3D spring? jyoung77 5 10-02-2003 09:22 AM
rendering axially symmetric shadow volumes with double sided stencil: issues opengl_enquirer 3 10-02-2003 09:19 AM
what is opengl1.4??? why is it so damn difficult to find opengl libraries? opengl_enquirer 10 10-02-2003 09:09 AM
How to temporary disable stereo in stereo mode ? lekeno 4 10-02-2003 02:54 AM
blend 3 textures with 1 alpha map oconnellseanm 8 10-02-2003 02:43 AM
OT : Carmack reverse is patented! Gorg 78 10-02-2003 02:42 AM
hardware AA lines on NV28? Tzupy 2 10-02-2003 02:31 AM
weird bug with bitmap fonts (or maybe rasters) when running on dual monitor setup torisutan 0 10-01-2003 11:56 PM
glCallLists guaranteed to execute in order? CatAtWork 3 10-01-2003 08:20 PM
undefined reference to `glXBindChannelToWindowSGIX' jerryyyyy 1 10-01-2003 07:52 PM
running a 8X agp card on 4X port... how much improvement would an 8X port see? -nt- opengl_enquirer 10 10-01-2003 03:44 PM
Writing directly to the depth buffer..! Halloko 12 10-01-2003 02:58 PM
"frame rate" slowing down with time sek 12 10-01-2003 02:01 PM
No 16 Bit mode on Geforce 4 ? Jan2000 6 10-01-2003 01:39 PM
Which texture-formats are usually natively supported? Jan2000 8 10-01-2003 11:01 AM
clamp to border on ATI flamz 1 10-01-2003 09:36 AM
How are Ati gl drivers? JD 18 10-01-2003 09:21 AM
Local system rotation GPSnoopy 2 10-01-2003 02:08 AM
any way to render to a constant depth? shadow volume application opengl_enquirer 3 09-30-2003 09:10 PM
input / output in opengl application matrixh725 4 09-30-2003 08:19 PM
looking for: glActiveStencilFaceEXT( ) -- suggestions please -nt- opengl_enquirer 1 09-30-2003 05:17 PM
Font Problems xeropunk63 0 09-30-2003 12:42 PM
sudden ~5 fold slow down after reinstalling os and compiler | win2000 msvc opengl_enquirer 9 09-30-2003 11:31 AM
No future for Cg ? andreiga 2 09-30-2003 10:33 AM
gl_Arb_vertex_buffer_object NVidia performance Trey 6 09-30-2003 09:23 AM
texture disappearing on pickup? karancevic 3 09-30-2003 01:33 AM
Decode z-value in pixel-shader jeppa 3 09-29-2003 12:56 PM
YASMQ (Yet another Shadow Mapping Question) rgpc 18 09-29-2003 12:06 PM
Could some ATI user try this? Jan2000 41 09-29-2003 11:06 AM

Page: 1 2 3 4

opengl_enquirer
10-02-2003, 05:18 PM
anyone care to be helpful?

PS: in the case that such is actually terribly implimentation dependant, then i suppose the question is more valid than i had presumed...

in any case the implimentation i'm running is the most recent detonator drivers on an nvidia quadro fx chipset.

opengl_enquirer
10-02-2003, 06:10 PM
for a second this topic had dissapeared. i thought it had been removed but then it showed up again. i reopened it and tried to delete it. the deletion was not conclusive, but i hope it worked. in any case here is the bulk of the post that is still relevant.

anyhow i'm using something that looks like this:

if(mesh->vertex.buffer.ID)
{
glBindBufferARB(GL_ARRAY_BUFFER_ARB, mesh->vertex.buffer.ID);

void *buffer = glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);

memcpy(buffer,mesh->vertex.array,mesh->vertex.buffer.size); // Fill buffers

// Unmap buffers
glUnmapBufferARB(GL_ARRAY_BUFFER_ARB) }

but it looks a little funny to me.

also my texture coordinates are showing up black spots and dance around but the geometry looks correct and is updated apparently apropriately.

the vertices and normals are in one contiguous buffer, and the texture coordinates and indices each in two others.

so the only thing that is funny is the texture coordinates which i guess i will check over shortly. /*edit: actually its the normals that appear to be incorrect, though they are fine with the static geometry--there must be a reasonable explanation, please don't offer suggestions to this end*/ and the question of whether or not this is the best means to update dynamic VBOs.

best regards,

michael


[This message has been edited by opengl_enquirer (edited 10-02-2003).]

Korval
10-02-2003, 07:05 PM
glMapBufferARB is designed to be used to write directly to the VBO memory. If all you're going to do is memcpy, you'll get the same (though likely better) performance from using glBufferSubDataARB, and just passing the pointer to memory in.

If you're generating vertex data, or doing some form of pre-processing of that data, then you might want to try glMapBufferARB, but in a different way. Rather than generating that vertex data into a buffer that you then memcpy to the VBO, generate it directly into the buffer returned by glMapBufferARB.

However, the performance of this method over the glBufferSubData method is, well, implementation defined. The glMapBuffer method has the potential to be faster, but, as some older threads have shown, this may not be the case with current drivers. You should benchmark them to find out which is truly faster.

BTW, the above assumes that you're regularly sending vertex data to the VBO. If this is a static buffer, there isn't much point in using the MapBuffer call; just use glBufferSubData on it and be done.

As a complete question, and you get a complete answer http://www.opengl.org/discussion_boards/ubb/wink.gif

opengl_enquirer
10-02-2003, 07:33 PM
"glMapBufferARB is designed to be used to write directly to the VBO memory. If all you're going to do is memcpy, you'll get the same (though likely better) performance from using glBufferSubDataARB, and just passing the pointer to memory in."

that sounds more like the API i would expect. i hadn't yet looked into subdata as i had presumed it too advanced for someone yet to orchestrate a successful dynamic VBO. i had presumed it was used to selectively replace subbuffers as the name suggest, perhaps this is not the case. perhaps it is is short for "substitute data". whatever the case i will surely look into it after i'm finished here as it seems to be the interface i was expecting.

"If you're generating vertex data, or doing some form of pre-processing of that data, then you might want to try glMapBufferARB, but in a different way. Rather than generating that vertex data into a buffer that you then memcpy to the VBO, generate it directly into the buffer returned by glMapBufferARB."

actually i use the data extensively for simulation purposes rendering is more of a side effect in this case. it would be nice i think though if it was possible to upload full precision floating point values onto the hardware as half precision values. as accuracy is less necesarry for visualization purposes and this would cut down on video memory usage by half the way i see it.

"BTW, the above assumes that you're regularly sending vertex data to the VBO. If this is a static buffer, there isn't much point in using the MapBuffer call; just use glBufferSubData on it and be done."

what is the difference between STREAM and DYNAMIC... the specifications say that streaming buffers are for buffers that are rendered and updated infrequently. and DYNAMIC for buffers rendered and updated regularly. but offers no real examples. typically my dynamic geometry reaches equilibrium and is not updated for perhaps long spans of time and then suddenly may be knocked out of equilibrium and updated every subsequent frame until equilibrium is again reached. wheter they are rendered or not depends on if they are manually hidden or out of the view frustum. would this sort of geometry be classified as dynamic or streaming. would it be advantageous or is it possible to set the geometry to static while in equilibrium and to dynamic while out of equilibrium?

"As a complete question, and you get a complete answer"

personally i greatly prefer no text. if possible it is worth fitting a complete question into teh subject line. this saves contributors from having to investigate the thread and from reading redundant unecesarry information. i do this when a short answer will do. also it saves me from investing in a topic which might not garner any attention. i highly recommend it personally.

all that said. i'm experiencing difficulties with my dynamic VBOs. my static ones have worked lovely with no difficulties and a 63% performance increase. the dynamic ones are different in that they are dynamic and also have texture coordinates. both are rendered with a single triangle strip and vertex normals.

the geometry of the dynamic VBOs are essentially correct but fail at places on occasion, a fold in the mesh or something funny as such. the texture map appears corresct as well as i can tell. and the normals appear unormalized and likely incorrect.

i've looked over the code atleast 4 times over closely finding no errors.

i will look into the subdata functions and if i'm still having problems i may post the rendering and allocation code i'm using.

michael

opengl_enquirer
10-03-2003, 07:30 AM
i tracked down the source of the problem. it is not opengl api related though its difficult to believe it persisted this long without being noticed. i haven't really had time to investigate but i'm just deleting this post so not to confuse anyone.

i apreciate everything,

michael

[This message has been edited by opengl_enquirer (edited 10-03-2003).]