Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 05 Nov 2005
Offline Last Active Jun 26 2014 11:02 AM

Topics I've Started

Extracting basis vectors from a quaternion

02 May 2014 - 10:43 AM

A 3x3 matrix describes orientation and/or rotation with three (basis) vectors placed in the matrix vectors (or columns). Such a matrix can be converted to a quaternion and vice-versa. I'm wondering how to extract the three basis vectors from the quaternio, without converting the quaternion to a matrix. Is that even possible?


05 April 2014 - 10:53 AM

Some time ago I worked on a (professional) project in which I was surprised to see quite a lot of globals. There were classes like CRender, CPhysics, CClient and so on, and there was file globals.h that tied together all these classes by declaring GRender, GPhysics, GClient. Now, the entire code relied upon these globals and often even a small change in gpu texture class header caused recompilation of a big part of the codebase (which was medium in size but the total recompilation time was around 1 min).


We've heard all these stories about globals being bad and personally I prefer to write code a different way but I must say that working with all these globals was very easy - where ever I was in the code I could always easily access the client's, render's and so on, properties.


So, what's your opinion?

Yet Another Programmer's Blog (Rendering Stuff Mostly)

21 February 2014 - 07:48 PM

Here's the link: http://maxestws.blogspot.com/

Hope you'll find something valuable in there :).

Crashes upon device creation

09 September 2013 - 07:04 AM

I have a problem with creating a D3D11 device. On one computer which has long been not formatted (probably a lot of libs and stuff like that installed) my app works fine. On another computer, which is a clean Win7 x64 installation, I compiled my app and it crashes upon device creation, that is, D3D11CreateDevice returns a null pointer to the device. I've already updated my Windows with various updates etc. but that has not helped. Any idea?


I remember I had the same problem on another computer when I tried to create the device with D3D11_CREATE_DEVICE_DEBUG flag. Without this flag it was all fine. But now it crashes no matter whether this flag is on or off.



I've just updated Windows 8 SDK and the device creation process goes fine. Now, when I try to run my app via F5 key (Debug mode) it crashes upon swap chain creation. But, when I run the build with DEBUG -> Graphics -> Start Diagnostics (Alt + F5) everything is fine. Any idea why "regular" F5 doesn't work?

[DX9/DX10] Profiling

13 December 2012 - 11:06 AM

I've added some profiling calls to my renderer. Basically, it looks like this:
void CRenderer::beginTimeQuery()
#ifdef RENDERER_D3D9
  while (eventQuery->GetData(NULL, 0, D3DGETDATA_FLUSH) == S_FALSE);
#elif RENDERER_D3D10

double CRenderer::endTimeQuery()
#ifdef RENDERER_D3D9
  while (eventQuery->GetData(NULL, 0, D3DGETDATA_FLUSH) == S_FALSE);
  return (double)(endTime.QuadPart - beginTime.QuadPart) / (double)timeFrequency.QuadPart;
#elif RENDERER_D3D10
  uint64 beginTime, endTime;
  while (beginTimestampQuery->GetData(&beginTime, sizeof(uint64), 0) != S_OK);
  while (endTimestampQuery->GetData(&endTime, sizeof(uint64), 0) != S_OK);
  while (timestampDisjointQuery->GetData(&disjoint, sizeof(D3D10_QUERY_DATA_TIMESTAMP_DISJOINT), 0) != S_OK);
  if (!disjoint.Disjoint)
   return (double)(endTime - beginTime) / (double)disjoint.Frequency;
   return -1.0;

Now, I render 2500 cubes, what gives me 230 FPS with both renderers. The problem is that the timings returned by endTimeQuery differ. For D3D9 it returns 0.003 and for D3D10 returns 0.0013. The rendering code does not do anything else and I wrapped the whole rendering loop inside the begin/end time block. So, where does this discrepancy could come from?