Path: chuka.playstation.co.uk!scea!peter_alau@playstation.sony.com From: Darco Newsgroups: scee.yaroze.programming.3d_graphics Subject: Dynamic TMD Prob Date: Tue, 06 Oct 1998 20:37:31 -0400 Organization: SCEA News Server Lines: 61 Message-ID: <361AB7CB.4141075E@datasys.net> Reply-To: darco@bigfoot.com NNTP-Posting-Host: 171.dialup.datasys.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.05 [en] (Win95; U) As you can probably tell from the subject line, I'm having a problem with my Dynamic TMD generation program that I'm writing. After hours of pondering and trying to come up with the most efficient method of Dynamically creating TMD data, I came to a conclusion. Because the creation process is dynamic, I will not know going into the process how many vertices, normals, and primitives I will need. Thus, I will need to dynamically re-allocate the vertex space, normal space, and primitive space as I add more vertices, normals, and primitives. The realloc() command (Green manual, page 212) seemed perfect for reallocating the memory blocks. But SOMEHOW... My data gets corrupted in memory. This is what the program should do: Create a flat shaded triangle primitive, and display it on the screen, and you should be able to move it around with the analog pad. I know my 3D object display routines work because I've tried them on traditional TMD data. Only once have i gotten anything to display - and that was a very tiny corrupted triangle - not even at the position that I set it at. I even tried writing my own version of realloc() called re_allocate(). It allocates the new memory, copies the data from the old block to the new block, then frees the old block, and returns the newly re-sized block. But that didn't seem to help. re_allocate() is still in the source code, but it's not used anymore. It's the first routine in tmd.c I've tried everything in my knowledge to get it to work, but no avail. I hate asking people to debug my code, but I don't know what else to do. I've re-commented the source, and you can find it here: http://www.datasys.net/users/stu/rquat/dyntmd.zip It's encrypted, the password is "butter". Without the quotation marks. (It's encrypted because it contains PSX binaries) It's programed in codewarrior, but I'm including the binaries so that GCC users can at least see what the program is doing. It dumps EVERYTHING that it does to the console to help aid debugging. I know how hard it can be reading through someone else's code, so I've tried VERY hard to make sure that it is legible and orderly. Tell me what you think about the code structure, even though it doesn't seem to want to work. :) There are allot of routines in this program that aren't used (like random.c). They are there because I put them in my custom stationary. Read through them if you want, you might find them useful. I've tried to denote everything that I didn't write with a comment, but I might not have gotten everything. Just know that %99.9 of everything is programed by me, and everything else I re-wrote. What I eventually hope to have is a game that dynamically creates it's playing environment. Randomly. So there is NO way to know how many vertices, normals, and primitives there will be going into the process. Anyway, help me. Am I going about this the right way? Thanks. 'Darco