Jump to content


quick question about texture pointers


2 replies to this topic

#1 starstutter

    Senior Member

  • Members
  • PipPipPipPip
  • 1039 posts

Posted 03 January 2009 - 07:04 AM

Lets say I have 2 textures declared:

LPDIRECT3DTEXTURE9 texObject;
LPDIRECT3DTEXTURE9 texPointer;

Now first off I realize both of these are pointers (despite the names given), but then I create a texture in one of them:

d3ddev->CreateTexture(texObject);

Now, I say:

texPointer = texObject;

I know that texPointer will not equal the actual texture itself (only the pointer to it) but here's my question:

do I now have to call the Release() function on texPointer to avoid a memory leak? Or is this taken care of when I later release texObject. They both point to the same place so I would think that releasing one would cover any memory problems, however I'm not sure and I want to be certain that making it texPointer equal to a LPDIRECT3DTEXTURE9 will not cause a memory leak if not released.
(\__/)
(='.'=)
This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.
bunny also wants to fight spam: Click Here Bots!

#2 Reedbeta

    DevMaster Staff

  • Administrators
  • 4968 posts
  • LocationBellevue, WA

Posted 03 January 2009 - 07:13 AM

No, you do not need to call Release(), because you have not called AddRef(). Direct3D can't know when you make a copy the pointer in your own application; LP... types are just plain old raw pointers, without any additional intelligence.
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 starstutter

    Senior Member

  • Members
  • PipPipPipPip
  • 1039 posts

Posted 03 January 2009 - 08:02 AM

that's what I figured, just making sure. :)
Thanks for the help.
(\__/)
(='.'=)
This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.
bunny also wants to fight spam: Click Here Bots!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users