47238

Modifying only a specific element type of VBO buffer data?

I have my VBO using single buffer at the moment, it has vertex, texcoord and color elements.

Now, is it possible to update efficiently only the texcoords without updating the vertex/color as well? It should be the same efficiency as having separate buffers updated.

Answer1:

You can map a specific range of your VBO into user memory using glMapBufferRange. Of course, if your vertex, color and texcoord data are interleaved, it will be equivalent to a glMapBuffer.

EDIT:

If your VBO is:

[XYZ XYZ XYZ XYZ RGBA RGBA RGBA RGBA TxTy TxTy TxTy TxTy]

You can upload only the texture coordinates by mapping the last part of the buffer ([TxTy TxTy TxTy TxTy]) and update it. You can also use glBufferSubData to do that. It would be faster to update that buffer than the full one.

But if you use interleaved data:

[XYZ RGBA TxTy XYZ RGBA TxTy XYZ RGBA TxTy XYZ RGBA TxTy]

Then you cannot update part of the buffer.

Answer2:

You can map a VBO into memory space and then update the texcoords by striding across the data and modifying it.

One downside is that the entire VBO, once modified, will need to be resent to the video memory for rendering; if you are modifying this often, bus bandwidth can become an issue.

If you are trying to do some kind of algorithmic modification to your texcoords you could probably do this calculation in a shader. Another option would be to compose an array of the new values on the CPU side and send these values to the shader and do the replacment at render time; with this option though, you might as well just exclude the texcoords from the original VBO in the first place.

Recommend

  • Eigen library with C++11 multithreading
  • Thread priority (how to get fixed order)
  • Will all phones support YUV 420 (Semi) Planar color format in h.264 encoder?
  • Collect and run all junit tests in parallel with each test class in its own JVM (parallelization by
  • Converter from SAT to 3-SAT
  • Excel VBA How to populate a multi-dimensional (3d) array with values from multiple excel ranges?
  • Where these are stored?
  • Spark job failing in YARN mode
  • Excel's Macro-Recorder usage
  • MonoTouch: How to download pdf incrementally as indicated in the Apple slides “Building Newsstand Ap
  • MailKit: The IMAP server replied to the 'EXAMINE' command with a 'BAD' response
  • Dialing with Intent.ACTION_CALL stopps at # in phone number
  • Highlight one bar in a series in highcharts?
  • Lost migrations and Azure database is now out of sync
  • Is there any way to access browser form field suggestions from JavaScript?
  • Android screen density dpi vs ppi
  • Dynamically accessing properties of knockoutjs observable array
  • DotNetZip - Calculate final zip size before calling Save(stream)
  • script to move all files from one location to another location
  • WinForms: two way TextBox problem
  • How to handle AllServersUnavailable Exception
  • Can I make an Android app that runs a web view in Chrome 39?
  • VBA Convert delimiter text file to Excel
  • Matrix multiplication with MKL
  • trying to dynamically update Highchart column chart but series undefined
  • Benchmarking RAM performance - UWP and C#
  • CSS Applying specific rule for a specific monitor resolution with only CSS is posible?
  • What are the advantages and disadvantages of reading an entire file into a single String as opposed
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • embed rChart in Markdown
  • Turn off referential integrity in Derby? is it possible?
  • Authorize attributes not working in MVC 4
  • Busy indicator not showing up in wpf window [duplicate]
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • Reading document lines to the user (python)
  • How can I use `wmic` in a Windows PE script?
  • Unable to use reactive element in my shiny app
  • Converting MP3 duration time
  • Python/Django TangoWithDjango Models and Databases
  • Net Present Value in Excel for Grouped Recurring CF