Jump to content
  • Advertisement
Sign in to follow this  
DesignerX

DirectX8 Questions

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

1. If besides the main applcation window I open another small child window in which I want to render an image. How can I use Direct3D8 to also draw in that window ? 2. How can I access a loaded directx8 textures RGB values ? For example How can I extract the RGB values for the pixel at location 100, 100 of the texture ?

Share this post


Link to post
Share on other sites
Advertisement
1) You would create a second D3D8 device for that window. Keep in mind you could just render to a smaller viewport of the larger window and use only one device.

2) Lock the texture with READ flags, it will give you access to the texture data in whatever format it was internally stored in. If you're trying to do something real time with this, I would recommend keeping you're own copy of the texture data in system memory for your program, because usually locking with a READ requires the driver to allocate space, copy the texture from video to system memory, let you play with it, copy it back, and then release the memory -- not very efficient.

edit: i know someboday will say something about this -- the texture is sometimes directly read from video memory, however this is still slow on most systems.

Share this post


Link to post
Share on other sites
Quote:
Original post by Rocket05
1) You would create a second D3D8 device for that window. Keep in mind you could just render to a smaller viewport of the larger window and use only one device.

In general creating a second device is a bad idea. The Present call takes a window override which allows it to draw to any window you own. Depending on what you're doing you may want to create an additional swap chain specifically for that window.

Quote:

2) Lock the texture with READ flags, it will give you access to the texture data in whatever format it was internally stored in. If you're trying to do something real time with this, I would recommend keeping you're own copy of the texture data in system memory for your program

If you create the texture as managed then when you lock the texture it will lock the System Memory version for you. Writing works similarly but if you're doing a lot of that you'll want to create it with the DYNAMIC flag (assuming the hardware supports it). Note: DYNAMIC and MANAGED are mutually exclusive.

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!