Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

jollyjeffers

D3D9 & C++ : Render Targets / how to use them...

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

hi, I''ve knocked up what I thought was a good example of using render targets... all it does is render the scene to a texture, then render the texture to the screen (using a TL quad). However something isn''t working right - the sizing is a bit off and it wont allow anything other than a 1024x1024 texture to be used (1024x768 res) properly. can anyone point me towards a working example of SetRenderTarget( ) and so on in D3D9/C++. Google hasn''t been able to help me. Jack DirectX 4 VB: All you need for multimedia programming in Visual Basic Formula 1 Championship Manager, My Game Project.

Share this post


Link to post
Share on other sites
Advertisement
Why on Earth are you rendering to a texture and then rendering the texture to fit the entire screen? Setting the render target is used for special effects, like rendering something to a texture and then texture mapping something. You can also use it to change the window you are rendering to.

If you really insist on doing this, or maybe I just misinterpreted it, then here''s your problem: You need to either use pre-transformed vertices or an orthogonal projection to get a 1:1 mapping of world space to screen pixels. If you can''t make a texture larger than 1024x1024 then that''s probably as high as your video card supports.

Share this post


Link to post
Share on other sites
hehe, there is a perfectly logical reason for what I''m doing... if you alpha blend the final stage then you get free temporal anti aliasing (motion blur), which when done correctly looks extremely cool

I''m using a Radeon 9800 pro, which goes upto 2048x2048 targets, and anyway, its caps locked so the code wont allow itself to go any higher than the driver allows it..

any ideas anyone?!
Jack

DirectX 4 VB: All you need for multimedia programming in Visual Basic
Formula 1 Championship Manager, My Game Project.

Share this post


Link to post
Share on other sites
Your card likely can't support non-power-of-2 textures (hence the rounding up from 768 to the nearest power of 2 -- i.e. 1024)

I've had trouble using render targets in the past. When I tried to use them in my game, it rendered to the texture fine, then rendered on screen, but I could not create any new textures afterwards, and it crashed when I tried to go back to the menu. Weird.

So if anyone has some working code for rendering to a texture it could help me out too.

[edited by - glassJAw on August 17, 2003 1:57:25 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!