Jump to content

  • Log In with Google      Sign In   
  • Create Account

I have a problem with the line display (LINELIST of directX-3D)


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
No replies to this topic

#1 lemon2012   Members   -  Reputation: 101

Like
0Likes
Like

Posted 17 October 2012 - 07:05 PM

Hey Guys,

I'm new in programming with Directx.
I have a comic problem to draw nice lines, with the function LINELIST and LINESTRIP.

The problem is a interpolation along the illustrated line. At beginning of the line, the pixels are nice, then comes an colorinterpolation?
The first screenshot is made with windows lens =)

Each answer will help me, excuse me for my bad english, I'm german...Posted Image

Oh, i use Visual Studio 2008 an program with C++ Windows Forms

[source lang="cpp"]m_pDirect3d = Direct3DCreate9( D3D_SDK_VERSION ); D3DDISPLAYMODE d3ddm; m_pDirect3d->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &d3ddm ); D3DPRESENT_PARAMETERS d3dpp; ZeroMemory( &d3dpp, sizeof(d3dpp) ); d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferFormat = d3ddm.Format; d3dpp.EnableAutoDepthStencil = TRUE; d3dpp.AutoDepthStencilFormat = D3DFMT_D16; d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; d3dpp.BackBufferWidth = this->panel1->Width; d3dpp.BackBufferHeight = this->panel1->Height; pin_ptr<LPDIRECT3DDEVICE9> pinnedDevice = &m_pd3dDevice; if( FAILED(m_pDirect3d->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, (HWND)this->panel1->Handle.ToInt32(), D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, pinnedDevice )))[/source]

My easy Render()

[source lang="cpp"] private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) { random_data[0].x=(float)(0); random_data[0].y=(float)(240); random_data[0].z=1.0f; random_data[0].rhw=1.0f; random_data[0].colour=D3DCOLOR_XRGB(0,0,0); random_data[1].x=(float)(640); random_data[1].y=(float)(0); random_data[1].z=1.0f; random_data[1].rhw=1.0f; random_data[1].colour=D3DCOLOR_XRGB(0,0,0); if( NULL != m_pd3dDevice ) { m_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(255,255,255), 1.0f, 0 ); m_pd3dDevice->BeginScene(); m_pd3dDevice->SetFVF(line_fvf); //line_fvf = D3DFVF_XYZRHW|D3DFVF_DIFFUSE; m_pd3dDevice->DrawPrimitiveUP(D3DPT_LINELIST, 1, random_data, sizeof(line_vertex)); m_pd3dDevice->EndScene(); m_pd3dDevice->Present( NULL, NULL, NULL, NULL ); } }[/source]

Yeah it isn't pretty, run with timer1 each 10ms

Attached Thumbnails

  • zoomed_window.jpg
  • main_window.jpg

Edited by lemon2012, 17 October 2012 - 07:07 PM.


Sponsor:



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