Jump to content
  • Advertisement
Sign in to follow this  
valvet

Position/Origin of a texture

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

Hey.. I've been struggeling with this for days, I can't seem to find any information it. What I'm trying to do is get the position (x, y) of the texture being created so I can print something on it. HRESULT APIENTRY hkIDirect3DDevice9::CreateTexture(UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle) { HRESULT ret = m_pD3Ddev->CreateTexture(Width, Height, Levels, Usage, Format, Pool, ppTexture, pSharedHandle); if(ret == D3D_OK) { new hkIDirect3DTexture9(ppTexture, this, Width, Height, Format); } return ret; } I can get the Height/Width, but unable to locate where I get the coords.. thanks for the help.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
when you create a texture, its coords (and scale) is all relative to its self. its just created in memory so, the top left corner of your texture is 0,0

and the bottom right hand corner of the texture is width-1,height-1

simple enough?

Share this post


Link to post
Share on other sites
I dont really understand the question either, but there is one big mistake that you have made. The top left of a texture is 0,0 BUT the bottom right is 1,1!!!!

Share this post


Link to post
Share on other sites
Well.. you have different textures like so: (I suppose it's textures? meshes? :x)

Game window
__________________________
| |
| <some picture> |
| |
| <another picture> |
|__________________________|

<some picture>'s position on the screen so I can print text on <some picture>.

I have the pointer to the actual texture: IDirect3DTexture9** ppTexture, but I can't find anything information in the interface on it's "position". Not sure if I'm explaining it correctly.

Share this post


Link to post
Share on other sites
When you create a texture, it is created in memory. For the texture to appear on the screen you have to render (draw) it -- either by blitting (copying) it directly, or by applying it to a mesh and then rendering the mesh.

Here are three ways of "printing" on a texture:
  1. Draw the texture to the screen, then draw on top of it.
  2. Manipulate the texture's image data directly.
  3. "Render-to-texture" -- instead of drawing to the screen, you draw to the area of memory that contains the texture's image data.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!