Confusing Documentation
-
Directly copy and pasted from the documentation for Direct X....
public class Vertices : Form { // Global variables for this project Device device = null; // Rendering device VertexBuffer vb = null; . . . public void OnCreateDevice(object sender, EventArgs e) { Device dev = (Device)sender; // Now create the vertex buffer vertexBuffer = new VertexBuffer( typeof(CustomVertex.TransformedColored), 3, dev, 0, CustomVertex.TransformedColored.Format, Pool.Default); vertexBuffer.Created += new System.EventHandler(this.OnCreateVertexBuffer); this.OnCreateVertexBuffer(vb, null); } public void OnCreateVertexBuffer(object sender, EventArgs e) { VertexBuffer vb = (VertexBuffer)sender; GraphicsStream stm = vb.Lock(0, 0, 0); CustomVertex.TransformedColored[] verts = new CustomVertex.TransformedColored[3]; . . . vb.Unlock(); } }
-
Directly copy and pasted from the documentation for Direct X....
public class Vertices : Form { // Global variables for this project Device device = null; // Rendering device VertexBuffer vb = null; . . . public void OnCreateDevice(object sender, EventArgs e) { Device dev = (Device)sender; // Now create the vertex buffer vertexBuffer = new VertexBuffer( typeof(CustomVertex.TransformedColored), 3, dev, 0, CustomVertex.TransformedColored.Format, Pool.Default); vertexBuffer.Created += new System.EventHandler(this.OnCreateVertexBuffer); this.OnCreateVertexBuffer(vb, null); } public void OnCreateVertexBuffer(object sender, EventArgs e) { VertexBuffer vb = (VertexBuffer)sender; GraphicsStream stm = vb.Lock(0, 0, 0); CustomVertex.TransformedColored[] verts = new CustomVertex.TransformedColored[3]; . . . vb.Unlock(); } }
Nope, dont see it. Whats the bug?
**
xacc.ide-0.2.0.77 - now with C# 3.5 support and Navigation Bar!^
New xacc.ide release RSS feed^**
-
Directly copy and pasted from the documentation for Direct X....
public class Vertices : Form { // Global variables for this project Device device = null; // Rendering device VertexBuffer vb = null; . . . public void OnCreateDevice(object sender, EventArgs e) { Device dev = (Device)sender; // Now create the vertex buffer vertexBuffer = new VertexBuffer( typeof(CustomVertex.TransformedColored), 3, dev, 0, CustomVertex.TransformedColored.Format, Pool.Default); vertexBuffer.Created += new System.EventHandler(this.OnCreateVertexBuffer); this.OnCreateVertexBuffer(vb, null); } public void OnCreateVertexBuffer(object sender, EventArgs e) { VertexBuffer vb = (VertexBuffer)sender; GraphicsStream stm = vb.Lock(0, 0, 0); CustomVertex.TransformedColored[] verts = new CustomVertex.TransformedColored[3]; . . . vb.Unlock(); } }
it gets even worse in VB.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
Directly copy and pasted from the documentation for Direct X....
public class Vertices : Form { // Global variables for this project Device device = null; // Rendering device VertexBuffer vb = null; . . . public void OnCreateDevice(object sender, EventArgs e) { Device dev = (Device)sender; // Now create the vertex buffer vertexBuffer = new VertexBuffer( typeof(CustomVertex.TransformedColored), 3, dev, 0, CustomVertex.TransformedColored.Format, Pool.Default); vertexBuffer.Created += new System.EventHandler(this.OnCreateVertexBuffer); this.OnCreateVertexBuffer(vb, null); } public void OnCreateVertexBuffer(object sender, EventArgs e) { VertexBuffer vb = (VertexBuffer)sender; GraphicsStream stm = vb.Lock(0, 0, 0); CustomVertex.TransformedColored[] verts = new CustomVertex.TransformedColored[3]; . . . vb.Unlock(); } }
The "global variables" are regular member variables? (CLR doesn't support global variables anyway) I'm guessing
vertexBuffer
andvb
are supposed to be the same member (copy/paste bug)?vertexBuffer.Created
is assigned to after theVertexBuffer
is created?OnCreateVertexBuffer()
is called explicitly?--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ I work for Keyser Söze
-
Nope, dont see it. Whats the bug?
**
xacc.ide-0.2.0.77 - now with C# 3.5 support and Navigation Bar!^
New xacc.ide release RSS feed^**
I guess it's calling
OnCreateVertexBuffer()
explicitely after wiring up the event. Depending on whenCreateVertexBuffer
gets fired I'd assumeOnCreateVertexBuffer()
gets called more than once.Regards, mav -- Black holes are the places where God divided by 0...
-
The "global variables" are regular member variables? (CLR doesn't support global variables anyway) I'm guessing
vertexBuffer
andvb
are supposed to be the same member (copy/paste bug)?vertexBuffer.Created
is assigned to after theVertexBuffer
is created?OnCreateVertexBuffer()
is called explicitly?--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ I work for Keyser Söze
Michael Dunn wrote:
I'm guessing vertexBuffer and vb are supposed to be the same member (copy/paste bug)?
Small bug... but when you're reading a tutorial that kind of matters :)
-
The "global variables" are regular member variables? (CLR doesn't support global variables anyway) I'm guessing
vertexBuffer
andvb
are supposed to be the same member (copy/paste bug)?vertexBuffer.Created
is assigned to after theVertexBuffer
is created?OnCreateVertexBuffer()
is called explicitly?--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ I work for Keyser Söze
Michael Dunn wrote:
CLR doesn't support global variables anyway
Are you sure? I read somewhere that the CLR has nothing against global variables, just that languages like C# don't support them. :~
Cheers, विक्रम
Be yourself, no matter what they say. - Sting, Englishman in New York.
-
Michael Dunn wrote:
CLR doesn't support global variables anyway
Are you sure? I read somewhere that the CLR has nothing against global variables, just that languages like C# don't support them. :~
Cheers, विक्रम
Be yourself, no matter what they say. - Sting, Englishman in New York.
No, I'm not sure. :)
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ "That's what's great about doing user interface work. No matter what you do, people will say that what you did was idiotic." -- Raymond Chen