Cant use CreateTextureFromFile() function
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
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()
You're copying from VB, not the v[] array, and you only copy 1 vertex, not the entire array.
Change to:
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement