Sign in to follow this  
manshy51

Help with Directx9

Recommended Posts

manshy51    100
Hi I am new with directX and use it to make a demo but there is some obstacles in my way so i need someone to help me. I want to draw some object on the screen and i want them to be drawn at certain position on screen and never change despite of the position of the camera (like radar in most games and player inventories, etc....) . but the problem i have that, this objects are drawn but i can't see them because the camera was pointed to another position.so please help me if you can :) thanks in advance

Share this post


Link to post
Share on other sites
Aardvajk    13207
One option is to switch to a vertex format containing D3DFVF_XYZRHW for when you are drawing your HUD elements (assuming you are using the fixed-function pipeline). Your coordinates are then considered already transformed by the pipeline, so your X and Y values become screen coordinates.

Another, I guess, would be switching to an orthangonal projection, but I'll let someone who knows more about that than me explain [smile].

Share this post


Link to post
Share on other sites
phresnel    953
Quote:
Original post by manshy51
But still there is no answer for both posts :D


and x-posting will even decrease the probability with which people will help you, as it's penetrant and increases noise/signal-ratio , just as a future hint ;)

Share this post


Link to post
Share on other sites
manshy51    100
I can't make the Vertex Format contains D3DFVF_XYZRHW since i use the vertex to draw another objects that don't have constant position.
So i need another method i guess

Share this post


Link to post
Share on other sites
Evil Steve    2017
Quote:
Original post by manshy51
I can't make the Vertex Format contains D3DFVF_XYZRHW since i use the vertex to draw another objects that don't have constant position.
So i need another method i guess
What? Just have different vertices for different objects. You shouldn't use 6 vertices to make a quad (2 triangles) and then draw the same quad 10 times in different places, you should use 60 vertices and draw all 10 quads at once.

If you have objects that have a constant position, and ones that don't, then use two vertex formats.

Share this post


Link to post
Share on other sites
manshy51    100
Are there any other method; because setting vertex format to D3DFVF_XYZRHW doesn't allow me to use some DirectX Features like scaling and i want this object to be annimated

Share this post


Link to post
Share on other sites
Evil Steve    2017
Quote:
Original post by manshy51
Are there any other method; because setting vertex format to D3DFVF_XYZRHW doesn't allow me to use some DirectX Features like scaling and i want this object to be annimated
Yes, change your projection and view matrices before rendering the HUD, so that the HUD is always drawn in the same place relative to the screen. For instance, you can set an orthogonal projection matrix which will let you work in screen space but still use transformations for your vertices.

Share this post


Link to post
Share on other sites
manshy51    100
Quote:
Original post by Evil Steve
Quote:
Original post by manshy51
Are there any other method; because setting vertex format to D3DFVF_XYZRHW doesn't allow me to use some DirectX Features like scaling and i want this object to be annimated
Yes, change your projection and view matrices before rendering the HUD, so that the HUD is always drawn in the same place relative to the screen. For instance, you can set an orthogonal projection matrix which will let you work in screen space but still use transformations for your vertices.


Sorry but i didn't get, or i get it wrong .How does the HUD after i set an orthogonal projection matrix and i work in screen space will be in the same place? what if the camera is pointed to directly different location.

So can you explain it to me in simple way or if you have a tutorial or a little demo to help me i will be grateful .

Share this post


Link to post
Share on other sites

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