Sign in to follow this  

placing objects in DirectX

This topic is 3484 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok i am learning direct3D and i was wondering how you place objects in 3D space since its position in 3D space is defined by cordinates, it will be hard to tell exactly where to put them! i thaught about making a dummy item you could control with the arrow keys, and some text displaying your dummy items cuurent position in cordinates, so you could read it of and go back to your code, and set these cordinates for the model you want to be there. the problem is just this would take a long time to do, if you are doing big projects! are there any easier way to do this? not because i need it. i am not completely finnished with the tutorial yet, but i will soon, and then it will be nice to know it :) Thanks in advance sorry for my bad english btw. :/

Share this post


Link to post
Share on other sites
Visual editors are the common way to do this for large applications. Run a search for 'level editor' or 'world editor' in terms of your favourite computer game and you'll find plenty of examples.

The exact numerical coordinates for a vertex tend to be defined in model space and it is the simple translation components of a matrix that will actually place them in the world. Exactly where they're placed entirely depends on the context of your application - if your objects are 1x1x1 then placing them 2 units apart makes sense, but if they're 1000x1000x1000 in size then you'll obviously want them more than 2 units apar [smile]

hth
Jack

Share this post


Link to post
Share on other sites
thanks xD

now i got another question! its a little of topic, but i dont want to create a new thread for every noob question i have:

i copy and pasted some code from a tutorial.
the code does nothing else than displaying a box, with some lights on it, and then exits, if ESC key is pressed.
its woking fine, but when i try to close it down by pressing the esc key, my computer freezes and i have to ctrl+alt+del to close the visual studio!

i got the martch 08 release of DX9, and i am using vc++ 08 EE.

i am using windows vista (poor me :'( ) if that can have anything to do with it!

hope you can help me!

Share this post


Link to post
Share on other sites
i am fullscreen... and i cant see if it gets any output because my computer freezes.
also if i run the .exe from the projects folder it bugs. i am able to close it but it says "bla bla bla.exe stopped working. trying to find a sulution"

but ill try to debug windowed and see if that helps

Share this post


Link to post
Share on other sites
Quote:
Original post by craksy
i am fullscreen... and i cant see if it gets any output because my computer freezes.
also if i run the .exe from the projects folder it bugs. i am able to close it but it says "bla bla bla.exe stopped working. trying to find a sulution"

but ill try to debug windowed and see if that helps
The computer doesn't freeze - the application is crashing, and it's breaking to the debugger to tell you the error. Except because it's fullscreen, you can't see the debugger. That's why windowed mode is mucch better for debugging, unless you have multiple monitors or are doing remote debugging.

Share this post


Link to post
Share on other sites
yea!
it actually helped, though when i close the program using the esc key, it closes the application, but doesn't stop debugging so i have to do that my self, but atleast its better than before xD
thanks a lot!

ill use this thread if i have other problems, like i said before, so i dont fill up the forum with stupid newb questions.

i know its off topic, and its against the rules, but i guess its better than stuffing the forum with all my questions?

and again: Thanks :D

EDIT:
and about the debug output btw:

<code>
First-chance exception at 0x00e51f1f in DirectX2.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x00e51f1f in DirectX2.exe: 0xC0000005: Access violation reading location 0x00000000.
First-chance exception at 0x00e51f1f in DirectX2.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x00e51f1f in DirectX2.exe: 0xC0000005: Access violation reading location 0x00000000.
First-chance exception at 0x00e51f1f in DirectX2.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x00e51f1f in DirectX2.exe: 0xC0000005: Access violation reading location 0x00000000.
First-chance exception at 0x00e51f1f in DirectX2.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x00e51f1f in DirectX2.exe: 0xC0000005: Access violation reading location 0x00000000.
The program '[5880] DirectX2.exe: Native' has exited with code -1073741819 (0xc0000005).
</code>

i think its from my texture (i dont really know what the addresses is... i kinda rushed the texture part of the tutorial)
do you see the problem (if it can even be told from the debug report :/ )

Share this post


Link to post
Share on other sites
Quote:
Original post by craksy
yea!
it actually helped, though when i close the program using the esc key, it closes the application, but doesn't stop debugging so i have to do that my self, but atleast its better than before xD
thanks a lot!

ill use this thread if i have other problems, like i said before, so i dont fill up the forum with stupid newb questions.

i know its off topic, and its against the rules, but i guess its better than stuffing the forum with all my questions?
You're probably best creating a seperate thread, unless the new problem is related to the original one. Might as well leave this question in this thread though.

Quote:
Original post by craksy
and about the debug output btw:

<code>
First-chance exception at 0x00e51f1f in DirectX2.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x00e51f1f in DirectX2.exe: 0xC0000005: Access violation reading location 0x00000000.
First-chance exception at 0x00e51f1f in DirectX2.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x00e51f1f in DirectX2.exe: 0xC0000005: Access violation reading location 0x00000000.
First-chance exception at 0x00e51f1f in DirectX2.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x00e51f1f in DirectX2.exe: 0xC0000005: Access violation reading location 0x00000000.
First-chance exception at 0x00e51f1f in DirectX2.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x00e51f1f in DirectX2.exe: 0xC0000005: Access violation reading location 0x00000000.
The program '[5880] DirectX2.exe: Native' has exited with code -1073741819 (0xc0000005).
</code>

i think its from my texture (i dont really know what the addresses is... i kinda rushed the texture part of the tutorial)
do you see the problem (if it can even be told from the debug report :/ )
"Access violation reading location 0x00000000" means you have a NULL pointer that you just tried to use. Superpig wrote an Excellent article on debugging, which is definitely worth reading. Once you know how to use your debugger, you'll be able to see exactly what is null, why it's null and what's going on with you using it.
My guess is:
1. You're just calling Release() without checking if your pointer is null, or
2. You're running your render loop after you've cleaned up your D3D pointers.

As an aside, the bbcode tags on this forum use [square brackets], and there's [ source ] for longer chunks of code (That syntax highlights it, and puts it in an inline frame), or [ code ] for shorter chunks (Which just does monospace text).

Share this post


Link to post
Share on other sites

This topic is 3484 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this