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

What's the difference between world and view for purpose of camera?
Vertexbuffer Getdata VertexPositionNormalTexture
Converting from 3.1 to 4.0… gamestates
XNA large coordinates and float precision
Trying to make Gaussian Blur stronger/blurrier - XNA 4.0 HLSL
XNA, EmguCV and perfomance issue with webcam
Does XNA apps run on Windows RT?
How to pass a Texture2D object to Pixel Shader in XNA 4.0?
how to connect windows phone 7 application by using 2 different mobile device?
Adding a game service in XNA 4.0 through vb.net
Can the position of pixel be changed from Pixel Shader in XNA 4.0?
Adding GamerServicesComponent causes ridiculously long program start
Platformer tile engine--advice on what to do with long tiles
XNA Vector2 path contained inside rectangle
XNA changing 200 or so tiles pixels
Loading files during run time in XNA 4.0

Categories

HOME
ms-access
yii2
client
openstack
fluentd
office365api
bookshelf.js
dxl
opengl-es-2.0
fancybox
bs4
primary-key
google-translate
izpack
google-cloud-ml
flask-wtforms
iron-router
oracle-coherence
samoa
firefox-webextensions
zapier
scriptcs
tar
csrf-protection
wkwebview
greendao
typo3-6.2.x
atlassian-crucible
subdomains
objectanimator
flink-streaming
scorm2004
framemaker
lxd
repo
openoffice.org
form-data
mmenu
qwerty
ssjs
hue
grid.mvc
nomethoderror
spring-security-kerberos
netcdf4
angular2-meteor
google-datalayer
apache-fop
strptime
pubmed
logparser
directory-structure
webdriverjs
visual-c++-2008
url-masking
py2app
transmitfile
flash-cs5
associative-array
cyclomatic-complexity
createprocessasuser
fluid-dynamics
unity5.2.3
fscommand
offloading
c3
jscript.net
gulp-less
issuu
google-reader
htmlcleaner
intentservice
xsockets.net
sitemesh
android-hardware
wsdl-2.0
specification-pattern
itmstransporter
pvrtc
ocx
ticoredatasync
bubble-chart
enter
nsobject
genshi
hamachi
xfbml
firefox4
backcolor
zune
mdac
wsdl.exe

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App