Skip to main content
GameDev.net gamedev.net
🔒 Locked

Major class problems =/

Started by Mephs May 28, 2002 at 9:24 PM 3 replies 200+ views
Original Post
Mephs
Mephs
Hi, I''ve made a post on the directX forum as my problem is related to DX8, but upon further messing around with the code, I believe my problem is actually caused because of some fault in the structure of my classes (and nobody in the DirectX forum seemed able to help). My problem is this, I''m trying to import custom meshes into an ID3DXMesh object. I''ve sucessfully managed to do so, but when I get around to rendering, the program will successfully compile with 0 errors or warnings, yet when I run the program, as soon as it reaches the command Mesh->m_Mesh = Mesh3; it exits with no error or warning of any kind. I know it''s this line causing the fault because if I comment it out, the program runs fine. I believe the problem lies in the fact that I''m using an engine from a DirectX programming book, perhaps my structure somehow is not matching the structure I''m trying to copy it into or something. I believe the issue is memory related because a memcpy function was doing the exact same thing when I specified the wrong size to copy. The problem is I need to copy my Mesh object (Mesh3) into the m_Mesh object that is part of a separate class function (Mesh->m_Mesh) if I try to copy it into an object within the same class, it works fine, if I try to copy it into an object from another class... this weird program termination occurs. I don''t really understand the process of using the VC++ 6 debugger but when I do use it on this code, the system hangs, which means its no help anyway. Does anyone have the slightest clue why it doesn''t like me copying to an object within another class?? Thanks for any assistance anone can offer..... any further related code can be provided if needed. Steve AKA Mephs
DerekSaw
DerekSaw
Maybe somewhere inside your code an assert() is ''functioning''?

"after many years of singularity, i'm still searching n the event horizon" o
Carrot
Carrot
VC debugger shouldn''t hang the system unless you are in exclusive fullscreen mode. Have tou tryied windowed mode or changing the code for cooperative mode.

Are you sure Mesh is a valid object (allocated)?
Assigning to one of its members wouldn''t cause a crash unless there was a problem with the object itself or a problem with the assignment operator overload (looks like the variables aren''t pointers).
Mephs
Mephs
Well as an update, I have decided to do the unthinkable and start my own engine from scratch. I''ve gotten around to implementing the code I used before, which now works fine. I am however doing something screwy with the transformation matrix as I cannot see the shape I''m trying to render to screen. I managed to get it to render a couple of times, but changed something by accident that moved it off screen again. Problem was I was working on something else at the time and I thought it was drawing that, but I''d left it set to draw the old object and only realised later on!! So I moved on and now don''t know what I''d changed to make it work. But hey at least I know it''s working this time!! (and no screwy crashing!)

I think your ideas are probably correct, but I don''t think it was from lack of programming knowledge so much as a lack of understanding exactly how this engine I was using worked. Jim goes into a great length about how his classes in his engine function in his book, but there is almost zero info on how he went about building anything further than the class definitions in the header file and his engine code is quite different from his book samples because it has to allow for being part of a class function rather than standalone code. I think the problem was purely caused by not knowing the in''s and out''s of anothers code. Suffice it to say, my code works fine now in my own engine, well, once I sort out this transformation problem at least!!

Thanks for the suggestions though =)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.