Jump to content
  • Advertisement
Sign in to follow this  
DesignerX

2D with 3D

This topic is 4253 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

I have a problem I can't seem to solve : I got a background image sized 1024x768. Now I also render a 2d text with height = 30 pixels. I got a 3D round disc which I want to place besides the current selected text. I want the disc to be the size of the text (30 pixels) and I also want the screen boundery for the disc to be 1024x768 (i.e. when I place the disc in 100,100 it will be placed at 100,100 without the 3d calculations) I intentionly use 3D since I want to rotate the disc as well. You can understand that when modeling the disc its size is always relative to the other objects so fixing it to be always 30 is something I don't know how to do . Any suggestions ? thx alot.

Share this post


Link to post
Share on other sites
Advertisement
My suggestion (though I'm not 100% sure on this) is to check out different projections; namely, orthogonal projection should (I think?) keep your pixels in the way you want. Otherwise, you could skip transformation entirely on the disc and use 2D, but you wouldn't be able to rotate it I believe... I'm not entirely sure as I've got enough problems with projections myself at the moment ;-) But maybe worth a look!

Share this post


Link to post
Share on other sites
Render the disc to a texture (say a 128x128 texture) with all the required transforms. Then use that texture as your source for your sprite scaling it appropiately.

Luck!
Guimo

Share this post


Link to post
Share on other sites
Guimo, setting render target required a surface and sprite rendering requires textures. So how can I combine between the two ?

thx.

Share this post


Link to post
Share on other sites
I would look at rhw vertex buffers (if I understand you correctly.) you can place the vertex in screen space rather than 3d space..

pd3dDevice->SetFVF( D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1);

the RHW value just needs to be set to one.
I bet a quick search will turn up a more in depth answer.

Share this post


Link to post
Share on other sites
Quote:
Original post by DesignerX
Guimo, setting render target required a surface and sprite rendering requires textures. So how can I combine between the two ?

Isn't a texture just a collection of surfaces? I think you just want to render to surfaceLevel(0) of a texture, which you then use to render a sprite/textured quad. Most textures just have one surface, so the terms are sometimes used interchangeably...

Share this post


Link to post
Share on other sites
I tought a texture inherits from a surface. When I saw it didn't , I "paniked" and posted here.

MasterWorks, you are right, thx alot.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!