Simple but weird triangle problem ...
I am learning Direct3D from the NeXe website. When I try to draw a square or triangle it appears, but it has many lines through it. I tried to do a screen capture, but the square doesn''t show up in the image generated. Anyhow, please tell me why I get a lot of lines through triangles, squares, and everything else.
Thanks,
Matt Utley
If thispost = 0 Then
GoBack()
Else
Read()
End If
hey!
try to download the tutorial then run it, if it still sucks, maybe your computer does too.
try to download the tutorial then run it, if it still sucks, maybe your computer does too.
LoL! I do kind of think my computer sucks. I just wanted a simple something I could program on. I didn''t really plan on using it for gaming. Our family computer ( I''m 15, BTW ) will probably run it fine. I will try it real quick. This computer that it doesn''t work right on is a PII 350MHz, ATI 3D Rage Pro 2X AGP 16MB, and 128MB RAM.
If thispost = 0 Then
GoBack()
Else
Read()
End If
If thispost = 0 Then
GoBack()
Else
Read()
End If
This is totally messed up. My other computer has 512MB RAM, AMD Athlon, GeForce 3 16MB. It gave me my error, "Failed to initialize Direct3D 8."
If thispost = 0 Then
GoBack()
Else
Read()
End If
If thispost = 0 Then
GoBack()
Else
Read()
End If
if you can''t post an image, could you post your draw routine? it''s hard to help debug someone''s code without said code.
-me
-me
quote:It gave me my error, "Failed to initialize Direct3D 8."
[\quote]
Try installing DirectX 8(.1).
Here''s the code I use to draw the scene:
The way I came up with d3d->g_pD3dDev is I made a D3D class, for initializing D3D. TFD3D* d3d = new TFD3D; Now, CVertex is the vertex class used on the NeXe website, and vtxQuad is: CVertex vtxQuad[4]. I hope you can help me with this code.
If thispost = 0 Then
GoBack()
Else
Read()
End If
void DrawScene () { /////////////////////////////////////////////// // Clear the scene to black /////////////////////////////////////////////// d3d->g_pD3dDev->Clear (0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB (0, 0, 0), 1.0f, 0); /////////////////////////////////////////////// // Begin the scene /////////////////////////////////////////////// d3d->g_pD3dDev->BeginScene (); /////////////////////////////////////////////// // Scene-Drawing functions go here /////////////////////////////////////////////// // Matrix code D3DXMATRIX mat; D3DXMatrixPerspectiveFovLH(&mat, D3DX_PI/6, 640/480, 1.0, 100.0); d3d->g_pD3dDev->SetTransform(D3DTS_PROJECTION, &(D3DMATRIX)mat); D3DXMatrixIdentity(&mat); d3d->g_pD3dDev->SetTransform(D3DTS_WORLD, &(D3DMATRIX)mat); D3DXMatrixTranslation(&mat, 0, 0, 10.0); d3d->g_pD3dDev->SetTransform(D3DTS_VIEW, &(D3DMATRIX)mat); /////////////////////////////////////////////// // The triangle coordinates /////////////////////////////////////////////// vtxQuad[0].Create (0, 0, 0, 0, 0, 0, 0, 0); vtxQuad[1].Create (x1, 0, 0, 0, 0, 0, 1, 0); vtxQuad[2].Create (0, 1, 0, 0, 0, 0, 1, 1); vtxQuad[3].Create (1, 1, 0, 0, 0, 0, 0, 1); /////////////////////////////////////////////// // Set the cullmode render state /////////////////////////////////////////////// d3d->g_pD3dDev->SetRenderState (D3DRS_CULLMODE, D3DCULL_NONE); /////////////////////////////////////////////// // Set the lighting to "off" /////////////////////////////////////////////// d3d->g_pD3dDev->SetRenderState (D3DRS_LIGHTING, light); /////////////////////////////////////////////// // Set the vertex shader /////////////////////////////////////////////// d3d->g_pD3dDev->SetVertexShader (D3DFVF_CVertex); /////////////////////////////////////////////// // Draw the quad /////////////////////////////////////////////// d3d->g_pD3dDev->DrawPrimitiveUP (D3DPT_TRIANGLESTRIP, 2, vtxQuad, sizeof (CVertex) ); /////////////////////////////////////////////// // End the scene /////////////////////////////////////////////// d3d->g_pD3dDev->EndScene (); d3d->g_pD3dDev->Present (NULL, NULL, NULL, NULL);}
The way I came up with d3d->g_pD3dDev is I made a D3D class, for initializing D3D. TFD3D* d3d = new TFD3D; Now, CVertex is the vertex class used on the NeXe website, and vtxQuad is: CVertex vtxQuad[4]. I hope you can help me with this code.
If thispost = 0 Then
GoBack()
Else
Read()
End If
aj!
that init stuff must go into somewhere else.
DrawScene must only contain:
Clear()
Begin()
SetVertexShader()
DrawPrimitve()
End()
Present()
I think!
you should make another functin that Inits, and then load it one time before you render. And that light stuff, i dont know if you added a light thing in it, but just that code isnt enough.
Just download the source from Nexe and run it.
[edited by - pipo declown on July 25, 2002 4:31:55 PM]
that init stuff must go into somewhere else.
DrawScene must only contain:
Clear()
Begin()
SetVertexShader()
DrawPrimitve()
End()
Present()
I think!
you should make another functin that Inits, and then load it one time before you render. And that light stuff, i dont know if you added a light thing in it, but just that code isnt enough.
Just download the source from Nexe and run it.
[edited by - pipo declown on July 25, 2002 4:31:55 PM]
I''ve seen funny lines etc before and it has been when the z-buffer hasn''t been created on the CreateDevice. Alternatively if you have and older card, it might not be able to handle a 32-bit z-buffer so maybe reduce this to 16.
Rory.
Rory.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement