
April 25th, 2007, 09:35 AM
|
|
Contributing User
|
|
Join Date: Feb 2006
Posts: 31
Time spent in forums: 10 h 36 m 43 sec
Reputation Power: 0
|
|
|
Passing IDirect3DTexture9* to a function
Hi every body...
I've got a problem with references(type &var) and pointers(type *var).look at the following sample code :
/* (1) */
void CreateTexture1( IDirect3DTexture9* pTexture )
{
// some code that create texture from file
};
/* (2) */
void CreateTexture2( IDirect3DTexture9*& pTexture )
{
// some code that create texture from file
};
void mainFunction()
{
.
.
.
IDirect3DTexture9* pTexture = NULL ;
CreateTexture1( pTexture );
CreateTexture2( pTexture );
.
.
.
};
I'm going to use passed argument as an output.
Both CreateTexture1 & CreateTexture2 using exactly the same code , but different type of argument passings.
"CreateTexture1" can not alter pTexture but "CreateTexture2" can. why? I passed the argument with it's pointer so it must be changed? but it didn't on CreateTexture1! I don't have such a problem with types DWORD,UINT ,... but I have this with IDirect3DTexture9 .
Can you tell me why or redirect me to an article about it on the web?
Thank you.
|