Thanks, I gave up the texture values, cos I don't make one yet.
However, when I am doing this
return IN.shade * materialColor;
The rendered output is extremely jagged.
How can I improve that?
Update:
void Application::Update(float deltaTime)
{
try
{
//Check for lost device
HRESULT coop = g_pDevice->TestCooperativeLevel();
if(coop != D3D_OK)
{
if(coop == D3DERR_DEVICELOST)
{
if(m_deviceLost == false)
DeviceLost();
}
else if(coop == D3DERR_DEVICENOTRESET)
{
if(m_deviceLost == true)
DeviceGained();
}
Sleep(100);
return;
}
m_deltaTime = deltaTime * 0.4f;
//Keyboard input
if(KeyDown(VK_ESCAPE))
{
Quit();
}
if(KeyDown(VK_RETURN) && KeyDown(18)) //ALT + RETURN
{
//Switch between windowed mode and fullscreen mode
m_present.Windowed = !m_present.Windowed;
DeviceLost();
DeviceGained();
if(m_present.Windowed)
{
RECT rc = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, false);
SetWindowPos(m_mainWindow, HWND_NOTOPMOST, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_SHOWWINDOW);
UpdateWindow(m_mainWindow);
}
}
//Toggle Animation
if(KeyDown(VK_RETURN))
{
Sleep(300);
RandomizeAnimations();
}
}
catch(...)
{
g_debug << "Error in Application::Update() \n";
}
}
void Application::DeviceLost()
{
try
{
g_pFont->OnLostDevice();
g_pEffect->OnLostDevice();
m_deviceLost = true;
}
catch(...)
{
g_debug << "Error occured in Application::DeviceLost() \n";
}
}
void Application::DeviceGained()
{
try
{
g_pDevice->Reset(&m_present);
g_pFont->OnResetDevice();
g_pEffect->OnResetDevice();
m_deviceLost = false;
}
catch(...)
{
g_debug << "Error occured in Application::DeviceGained() \n";
}
}
I copied the code from a book. So this presentation parameters are the same when the device is regained.
void Application::DeviceGained()
{
try
{
g_pDevice->Reset(&m_present);
g_pFont->OnResetDevice();
g_pEffect->OnResetDevice();
m_deviceLost = false;
}
catch(...)
{
g_debug << "Error occured in Application::DeviceGained() \n";
}
}
Thanks
Jack