xna-4.0


Vertexbuffer Getdata VertexPositionNormalTexture


I have a Vertexbuffer with 648 VertexPositionNormalTexture elements. That is 27 cubes and each cube hold 24 vertices.
If I want to access the vertices for my first cube I can write:
int startIndex = 0;
VertexPositionNormalTexture[] vertices = new VertexPositionNormalTexture[24];
vertexBuffer.GetData<VertexPositionNormalTexture>(vertices, startIndex, 24);
The problem is if I want to access my 9th cube (24*9 = 216). I have to write:
int startIndex = 216;
VertexPositionNormalTexture[] vertices = new VertexPositionNormalTexture[startIndex + 24];
vertexBuffer.GetData<VertexPositionNormalTexture>(vertices, startIndex, 24);
I have to create 192 extra slots just to access my 24 elements. Because the vertex.GetData will copy to same index it get data from. How do I do so It write my 24 elements to a correct sized array?
All classes, structs and functions are from XNA Framework 4.0
Why you need to use GetData?
Save the reference to your array and work with the array... not with the vertexBuffer...

Related Links

xna 4 taking desktop screenshot
Can't reset my gametime to zero in XNA
Displaying seconds in XNA with Keypress?
XNA game how to make a snake tail
Creating an array of game objects
Lap timer in XNA 4.0?
XNA: Identifying identical sprites created with for loop
Increase Character Spacing in XNA
XNA choosing a subgroup of Game.Components
Loading Silverlight Texture2D from Resources
XNA Game - Open a Popup or a Custom Game Screen before launching a game
'Microsoft.Xna.Framework.Vector2' is a 'type' but is used like a variable?
Making a trading card game XNA
How do I fix 'No suitable method found to override' error on XNA 4.0?
When to use PresentationParameters.BackBufferWidth vs .Viewport.Width
What does the pixel shader function tex1D do with a Texture2d

Categories

HOME
xamarin
mockito
tizen
dictionary
sd-card
youtube-dl
binary-tree
webpack-2
google-project-tango
ebean
facebook-messenger-bot
iggrid
python-unittest
maude-system
volttron
wheelnav.js
zend-framework3
zebra-printers
decomposition
decimal
designer
caml
django-admin
text-rendering
jasonette
tokenize
sox
bootstrap-tour
crosstab
django-storage
brunch
tasklet
iframe-resizer
yadcf
pim
fusionpbx
streamsets
bootstrapper
azure-ml
email-templates
texmaker
vao
unixodbc
google-datalayer
strptime
pango
boost-multi-index
darcs
dtexec
python-cryptography
linode
objective-c-swift-bridge
cubes
time-and-attendance
file-writing
autorest
firebaseui
sdf
wapiti
cloudbees
maven-tomcat-plugin
lib.web.mvc
sdhc
intellij-14
content-length
rgeo
appfabric-cache
fluid-dynamics
generic-programming
angular-local-storage
c++03
nsmutabledictionary
facebook-graph-api-v2.4
typekit
codeigniter-url
websocket4net
has-many-through
htmlcleaner
xceed-datagrid
html5-notifications
floating-point-precision
c18
xsockets.net
ftps
pygit2
distutils
itmstransporter
mhtml
hamiltonian-cycle
path-separator
twrequest
windows-phone-7.1.1
postgresql-performance
netdna-api
whoosh
genshi
coercion
servicehost
remember-me
brewmp
mtj
virtual-functions
xetex
privilege
aquaticprime
caching-application-block

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App