Jump to content
  • Advertisement

Archived

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

3DXD

Problem with Drawing Text and Multiple Viewports

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

Hello, I am having an issue where I have two viewports. One is 600 by 600 and the other is 200 by 600. My graphics render just fine. However the bottom part is where I want to display some text. However, I cannot for the life of me get the text to appear down there (properly). if I specify 10,10 when the top viewport is in affect I see the Text as 10,10 if I specify 10,10 with the second viewport in affect I see nothing. So i started to think, well maybe the D3DFont DrawText is moronic and just uses the backbuffer coordinates even though I don''t want it there and since I am only presenting the bottom 200x600 of the buffer(and already showed the top 600,600) that it was being drawn up there and never displayed. However I then figured... Ok I will draw at say x = 1 and Y = 601 or anything that would put the text in the bottom viewport. No matter what I try the best I really get is the text either at the top of the viewport but at the middle+ section of the x axis, or in the middle of the y axis and same spot for x. It''s just not logical. Again my graphics etc work fine. 1a. Get original viewport(this is only done once) 1b. Set original viewport to active(done in my render loop) 2. clear entire window 3. Set the info of the new viewport 4. set the active viewport 5. render top(600,600) (*note if I draw text here at this point it works np) 6. set new active viewport(200,600) 7. render bottom(200,600) 8. Try to draw some text 9. Present It''s not the clipping etc options as I have Noclip etc. It appears just that when using another viewport that the DrawText function isn''t smart enough to understand that (10,10,50,50) means put it on X of the current viewport and Y of the current viewport). What''s even stranger is that even if I choose numbers odd numbers like. I guess it''s my understanding of how the coordinates map to positions on the buffer maybe thats the problem. But right now I need to be able to write to the screen on The top if I want, but mainly on the secondary viewport. Right now thats not happening because my text seems to be "off" the screen of the main viewport Thanks for any help!

Share this post


Link to post
Share on other sites
Advertisement
Ahh I figured out my problem. I had to restore the original viewport so that it was the entire span of the back buffer, as the text is drawn based on what appears Transformed coordinates. After doing this I was able to draw my text into my menu np.

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!