I am following the Microsoft example of applying textures to primitives: http://msdn.microsoft.com/en-us/library/windows/apps/jj552949.aspx
I am trying to turn it into oop code so I can adapt it to my 'game'. I am wondering how to take out the CreateDDSTextureFromFile() function and have it called first, to initialize the texture into memory.
I thought simply having a function which ONLY calls CreateDDSTextureFromFile(), to load up individual texture sheets before anything else, but when I do that in this example it just draws a black quad (I turned it from a cube into a 2d quad).
Where have I gone wrong in my thinking? EDIT - I am an idiot, was just using the wrong file path to load the texture. It works now. But part two of my question remains.
P.S Unrelated to this issue but roughly 50% of the time when I run this code the program will crash and point to
CBNeverChanges cbNeverChanges; -> cbNeverChanges.mView = XMMatrixTranspose(g_View); g_pImmediateContext->UpdateSubresource(g_pCBNeverChanges, 0, nullptr, &cbNeverChanges, 0, 0);
with an access violation reading location 0xFFFFFFFF.
But I can just re-run the build and it will again either crash or work fine. any insight onto what would cause temperamental crashes?
Edit, the original source file is from here: http://code.msdn.microsoft.com/windowsdesktop/Direct3D-Tutorial-Win32-829979ef and I am using example07
Edited by SteveHatcher, 23 February 2014 - 12:33 AM.