Position/Origin of a texture

Started by
4 comments, last by JohnBolton 18 years, 6 months ago
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.
Advertisement
This question is not clear, what do you mean 'position of the texture being created'? Position on what? What coords?
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?
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!!!!
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.
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.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!

This topic is closed to new replies.

Advertisement