Cant use CreateTextureFromFile() function

Started by
11 comments, last by tariq9112003 13 years, 9 months ago
Hey I did what you said...it throws a message saying Texture loaded succesfully ...i dont get it...why wont the image show up...it shows no error on the intellisense and even after compilation
Advertisement
One thing at a time.

Okay, the texture's loaded.

First: move the D3DXCreateTextureFromFile call and the SamplerState calls to init3d(), following the CreateDevice call, either before or after init_graphics(). Make sure you delete the call from the render_frame function. You only want to create the texture once, and the sampler state only needs to be set once.

Then, I noticed you have to fix the vertex buffer in init_graphics()
memcpy(pVoid, VB, sizeof(CUSTOMVERTEX));

You're copying from VB, not the v[] array, and you only copy 1 vertex, not the entire array.

Change to:
memcpy(pVoid, v, 6*sizeof(CUSTOMVERTEX));


See if that helps.

EDIT: If you still have problems, it would probably be a good idea to repost your code after you've made the changes.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Yes it works!!!!!!!!!!!!!!!!!!!!This is the change i made

memcpy(pVoid, v, sizeof(v));

Thanks a lot guys(esp.BuckEye)...I love this site :)...

This topic is closed to new replies.

Advertisement