Jump to content
  • Advertisement
Sign in to follow this  
ryt

Why are some lines missing on this picture?

This topic is 3670 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This picture is 10x10 vertices. When its rotated around some axis by some angle it looks ok and every line is drawn ok. But when its positiond in vertical form some lines dissapear. Well also when its rotaded also some lines dissaper but not that much. Whats wrong? Free Image Hosting at www.ImageShack.us<br /><br />QuickPost

Share this post


Link to post
Share on other sites
Advertisement
That is a bit strange given the line rasterization rules. You don't have any obscure performance vs quality settings applied through your GPU's control panel do you?

The only thing I can think of is that your backbuffer might not be exactly matching your windows client area (note: you should take into account the size of the borders and title bar) and thus it renders fine but on re-sampling it for the screen its dropping the pixels you're expecting to see.

Could be worth checking with the Reference Rasterizer as well as running through PIX and stepping through rendering to see what happens.

hth
Jack

Share this post


Link to post
Share on other sites
I have tryed software rendering but nothing. Than I changed to full screen and the lines are drawn ok. So it must be something abaut window mode.

Share this post


Link to post
Share on other sites
Are you by any chance rendering to an intermediary surface, then resizing that surface to match the size of the window? Or is there a possibility that your library might be doing it for you?

Share this post


Link to post
Share on other sites
Nope, Im not rendering to intermediary surface.

This is my WinMain() function. I think the problem is here but I dont know what.

//initialize win and directx
WNDCLASS wc;

wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hinstance;
wc.hIcon = LoadIcon(0, IDI_APPLICATION);
wc.hCursor = LoadCursor(0, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = 0;
wc.lpszClassName = (LPCWSTR)"Direct3D9App";

RegisterClass(&wc);

HWND hwnd = 0;
hwnd = ::CreateWindow((LPCWSTR)"Direct3D9App", (LPCWSTR)"Direct3D9App",
WS_EX_TOPMOST,
0, 0, width, height,
0 /*parent hwnd*/, 0 /* menu */, hinstance, 0 /*extra*/);

::ShowWindow(hwnd, SW_SHOW);
::UpdateWindow(hwnd);


HRESULT hr = 0;

IDirect3D9 *d3d9 = 0;
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);

D3DCAPS9 caps;
d3d9->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &caps);

int vp = 0;
vp = D3DCREATE_HARDWARE_VERTEXPROCESSING;

D3DPRESENT_PARAMETERS d3dpp;
d3dpp.BackBufferWidth = width;
d3dpp.BackBufferHeight = height;
d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
d3dpp.BackBufferCount = 1;
d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
d3dpp.MultiSampleQuality = 0;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.hDeviceWindow = hwnd;
d3dpp.Windowed = true;
d3dpp.EnableAutoDepthStencil = true;
d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8;
d3dpp.Flags = 0;
d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

hr = d3d9->CreateDevice(
D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
hwnd,
vp,
&d3dpp,
&pDevice);

d3d9->Release();

//setup()
Setup();

//start display loop
MSG msg;
::ZeroMemory(&msg, sizeof(MSG));

static float lastTime = (float)timeGetTime();

while(msg.message != WM_QUIT)
{
if(::PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
else
{
float currTime = (float)timeGetTime();
float timeDelta = (currTime - lastTime)*0.001f;

Display(timeDelta);

lastTime = currTime;
}
}

Cleanup();

pDevice->Release();

return 0;

Share this post


Link to post
Share on other sites
You're not using AdjustWindowRectEx, so your backbuffer is a different size from your window. CreateWindowEx takes a window size (Which includes title bar and borders), not a client area size. AdjustWindowRectEx will give you the window size to pass to CreateWindowEx, if you give it the client area size.

Because your backbuffer and client area are different sizes, D3D is shrinking the backbuffer to fit the client area, so you're losing pixels.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!