![]() |
|
VBO under DirectX |
Billybob
Member #3,136
January 2003
|
I can get a nice tutorial on VBOs for OpenGL (NeHe), but I have trouble finding something for DirectX. How do I go about doing the same thing (if it's under a different name) under Direct3D? And I don't code D3D, I just got to slap this into Irrlicht and be on my merry way. Thanks!
|
Thomas Harte
Member #33
April 2000
![]() |
VBO is... vertex buffer object? If so then this is an area where OpenGL has played catchup with DirectX. Check out MSDN for DirectX vertex buffer information. [My site] [Tetrominoes] |
Krzysztof Kluczek
Member #4,191
January 2004
![]() |
DirectX 9 SDK->DirectX Graphics->Tutorials and Samples->Tutorials->Direct3D Tutorials->Tutorial 2: Rendering Vertices This should get you started. Follow links in the tutorial to get descriptions what functions do, follow links in these functions' descriptions, etc. ________ |
Billybob
Member #3,136
January 2003
|
So, DirectX will automatically put the vertex buffer on the video card? So, let's see here. Will this work (the way I want):
Obviously "Render" will occur in a different function. So, If I understand this correctly "D3DUSAGE_WRITEONLY" should tell it that video memory is the best place for the buffer, right? Or something like that.
|
Bob
Free Market Evangelist
September 2000
![]() |
Quote: So, DirectX will automatically put the vertex buffer on the video card? Behold, the same code in OpenGL:
Edit: Fixed code. -- |
Krzysztof Kluczek
Member #4,191
January 2004
![]() |
Quote: GLvoid *ptr = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); Won't it crash when glMapBuffer returns NULL? Quote: glUnmapBuffer()
I guess it should be: Quote: glVertexAttribPointer(index, size, type, normalized, stride, GL_BUFFER_OFFSET(0)); Is it OpenGL 2.0? There is no such function in OpenGL 1.5, it's ARB_vertex_program and requires *ARB suffix as such (and probably won't work without vertex program set up). Also, doesn't it require EnableVertexAttribArrayARB? Anyway, if anybody wants easy to use OpenGL VBO wrapper class, just PM me. ________ |
Billybob
Member #3,136
January 2003
|
So is my code right?
|
Krzysztof Kluczek
Member #4,191
January 2004
![]() |
Quote: So is my code right?
Does it work? If it does, then it's probably right (at least looks like it should). ________ |
Bob
Free Market Evangelist
September 2000
![]() |
Quote: Won't it crash when glMapBuffer returns NULL? Sure. Quote: I guess it should be: Yup. Quote: Is it OpenGL 2.0? Yes. Alternatively, you can use any of the ARB or NV vertex program extensions for the similar functionality. Quote: Also, doesn't it require EnableVertexAttribArrayARB?
Sure, you may want to do that too -- |
|