Jump to content

  • Log In with Google      Sign In   
  • Create Account


Problem in Render Lines


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 VitaliBR   Members   -  Reputation: 147

Like
0Likes
Like

Posted 02 August 2012 - 07:01 PM

Hi!

I've got a strange problem in render


on my work computer (dell with intel graphics 3000) lines (D3DPT_LINESTRIP for example) are usually rendered:
Posted Image

But on my home computer (macbook pro with bootcamp windows 7 geforce 320m) it renders the line strangely (with cuts):

Posted Image

my code:
	_d3d = Direct3DCreate9(D3D_SDK_VERSION);
bool p_bMultiSample = true;
bool p_bSuperSample = true;
bool bHW = true;
D3DDEVTYPE eType = bHW ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF;
// get the current display mode
D3DDISPLAYMODE sMode;
_d3d->GetAdapterDisplayMode(0,&sMode);
	D3DPRESENT_PARAMETERS d3dpp;
	ZeroMemory(&d3dpp, sizeof(d3dpp));
	d3dpp.Windowed = !fullscreen;
	d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
	d3dpp.hDeviceWindow = hwnd;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
	d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
	d3dpp.BackBufferWidth = screenWidth;
	d3dpp.BackBufferHeight = screenHeight;
d3dpp.EnableAutoDepthStencil = TRUE;	// automatically run the z-buffer for us
	//d3dpp.AutoDepthStencilFormat = D3DFMT_D16;  // 16-bit pixel format for the z-buffer
d3dpp.BackBufferCount = 1;
// check whether we can use a D32 depth buffer format
if ( SUCCEEDED ( _d3d->CheckDepthStencilMatch(0,eType,
  D3DFMT_X8R8G8B8,D3DFMT_X8R8G8B8,D3DFMT_D32)))
{
  d3dpp.AutoDepthStencilFormat = D3DFMT_D32;
}
else
{
  d3dpp.AutoDepthStencilFormat = D3DFMT_D24X8;
}
// find the highest multisample type available on this device
D3DMULTISAMPLE_TYPE sMS = D3DMULTISAMPLE_2_SAMPLES;
D3DMULTISAMPLE_TYPE sMSOut = D3DMULTISAMPLE_NONE;
DWORD dwQuality = 0;
if (p_bMultiSample)
{
  while ((D3DMULTISAMPLE_TYPE)(D3DMULTISAMPLE_16_SAMPLES + 1)  !=
   (sMS = (D3DMULTISAMPLE_TYPE)(sMS + 1)))
  {
   if(SUCCEEDED( _d3d->CheckDeviceMultiSampleType(0,eType,
	sMode.Format,TRUE,sMS,&dwQuality)))
   {
	sMSOut = sMS;
   }
  }
  if (0 != dwQuality)dwQuality -= 1;

  d3dpp.MultiSampleQuality = dwQuality;
  d3dpp.MultiSampleType = sMSOut;
}
// preget the device capabilities. If the hardware vertex shader is too old, we prefer software vertex processing
D3DCAPS9 g_sCaps;
_d3d->GetDeviceCaps( 0, D3DDEVTYPE_HAL, &g_sCaps);
DWORD creationFlags = D3DCREATE_MULTITHREADED;
if( g_sCaps.VertexShaderVersion >= D3DVS_VERSION( 2, 0))
  creationFlags |= D3DCREATE_HARDWARE_VERTEXPROCESSING;
else
  creationFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
////////////////////////////////////////////////////////////////////////////////////
	// create a device class using this information and the info from the d3dpp stuct
////////////////////////////////////////////////////////////////////////////////
	_d3d->CreateDevice(D3DADAPTER_DEFAULT,
					  eType,
					  hwnd,
					  creationFlags,
					  &d3dpp,
					  &_d3ddev);

Edited by VitaliBR, 02 August 2012 - 07:02 PM.


Sponsor:

#2 greenvertex   Members   -  Reputation: 510

Like
1Likes
Like

Posted 02 August 2012 - 09:28 PM

Have you gotten the same effect without multi-sampling on your Mac?

#3 VitaliBR   Members   -  Reputation: 147

Like
0Likes
Like

Posted 03 August 2012 - 05:12 AM

Have you gotten the same effect without multi-sampling on your Mac?


Yes :(

I tested with the variables true and false, and the same error occurred

This failure seems to occur on the line where the line is "broken" by aliasing

bool p_bMultiSample = true;
bool p_bSuperSample = true;
bool bHW = true;


#4 Nik02   Crossbones+   -  Reputation: 2630

Like
1Likes
Like

Posted 03 August 2012 - 11:44 AM

Are the backbuffer width and height set to the window dimensions, or window client area dimensions?

Edited by Nik02, 03 August 2012 - 11:45 AM.

Niko Suni


#5 VitaliBR   Members   -  Reputation: 147

Like
0Likes
Like

Posted 03 August 2012 - 12:17 PM

Are the backbuffer width and height set to the window dimensions, or window client area dimensions?


are the same of CreateWindowEx

#6 Nik02   Crossbones+   -  Reputation: 2630

Like
2Likes
Like

Posted 03 August 2012 - 12:25 PM

CreateWindowEx takes, as parameters, the window's bounding box dimensions. With a menu and a frame, the client area of the window (in which you commonly draw with D3D device) is significantly smaller.

You can use GetClientRect to determine the client area dimensions given a created window, or you can use AdjustWindowRect to find a suitable window size given a desired client size and window style.

Niko Suni


#7 VitaliBR   Members   -  Reputation: 147

Like
1Likes
Like

Posted 04 August 2012 - 08:51 AM

CreateWindowEx takes, as parameters, the window's bounding box dimensions. With a menu and a frame, the client area of the window (in which you commonly draw with D3D device) is significantly smaller.

You can use GetClientRect to determine the client area dimensions given a created window, or you can use AdjustWindowRect to find a suitable window size given a desired client size and window style.


Very thanks guy :)

it worked!!

RECT rect;
GetClientRect( hwnd , &rect );
    ZeroMemory(&d3dpp, sizeof(d3dpp));
    d3dpp.Windowed = !fullscreen;
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    d3dpp.hDeviceWindow = hwnd;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
    d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
    d3dpp.BackBufferWidth = rect.right - rect.left; //screenWidth;
    d3dpp.BackBufferHeight = rect.bottom - rect.top; //screenHeight;

:D




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS