Archived

This topic is now archived and is closed to further replies.

JackRabbit

Problem with mutiple buffers (streams)DX9/C#

Recommended Posts

JackRabbit    122
Hi there, I've been learning DX9 with C# for a few weeks now, and i have run into a problem with vertex buffers. In my little app, i have a class called Mesh, which stores one vertexbuffer for vertices, and another for the texture coords, and finally an index buffer. I know, this might not be the optimal way of doing things, but that is not important for me at this time. Anywho, i load a "level" file from disk, which contains 3 cubes. Each cube gets loaded into a Mesh object. Now, the problem is that when i render these cubes, the texture coordinates are messed up, only one side of each cube look normal. Ok, now the "level" file has been generated by a script i wrote for the 3d modelling program called Blender, which i have intended to me my primary tool for level design. Ok, now i should make it clear that im not really sure where my problem lies, it could be Blender that gives me bad data, or my script that doesnt export it right, or it could be that im not filling my vertex buffers correctly. To be honest, any of the above could be true, but im pretty sure my script in blender is ok, as i have gone through it many times, and im, well, as sure as i could be that it works. I could ofcourse, be wrong about that. But, im now starting to think that, since i use a separate vertex buffer to store the texture coords. Why you ask ? Well, i could have used a buffer that stores the UV for each vertex, but i want each face to have its own sets of UV coords. So, i found this tutorial on how to setup multiple buffers at www.ultimategameprogramming.com However, i think that my buffers are out of sync somehow, and, im not really sure how to do it right, so i was hoping that someone here has been dealing with the same thing, and might know where the problem is. I realize that this isnt an easy question to answer, nor is it an easy question to ask, but just let me know if im unclear about something. I have posted the compleate source code, with executable on my site here The interesting stuff is in the Mesh.cs file. You will notice in the method OnCreateTexcoordBuffer() that i have commented out a portion of code. This is where i think the problem lies. At first, i thought that i needed use the indices of each face, to index into the vertexbuffer that holds the texture coords, to put the right UV coords in the right place. However, this didnt work to good, so, as you will see below that code, i use another approach where i have a variable called Index, which increment. The latter seemed to work better, but it was still flawed, and the textures appeard strange on the surfaces of the cubes. Ok, im gona stop talking know, and hope that someone actually has a clue about what the heck im rambling about. And, if you are still reading this, i thank you for your time and patience Thanks !! PS: If anyone would be interested in using Blender as a leveldesign tool like this, i would be happy send you the script im using, and answer any questions about it. (It was'nt easy getting that to work) [edited by - JackRabbit on September 2, 2003 4:03:14 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
You had it right when you said:

> And, if you are still reading this, i thank you for your time
and patience

I got bored and stopped reading long before this. You''ll have more luck if you can boil it all down to a simpler, more concise question.

Share this post


Link to post
Share on other sites
JackRabbit    122
I understand your point, but i just wanted to provide
as much info as possible, since its not an easy question.

But, basically, my question would be if im handling my
buffers right ?

Since, im using multiple buffers, im not sure if im setting
the right values in the right place. Out of sync so to speak.



[edited by - JackRabbit on September 1, 2003 3:41:23 PM]

Share this post


Link to post
Share on other sites