# Draw Primitive Issue

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

## Recommended Posts

Hey guys!
Shouldn't I be able to see a triangle on the screen?

This piece of code is a test project, so I have no framework.
(classes/ custom library )

It compiles fine, but I don't see a triangle on the screen.

##### Share on other sites
Getting the first triangle on the screen is often the hardest part :P

It could be back face culling... although i don't see where you set up your projection matrix?

What i would seriously recomend is grabbing some code such as the code at this place:

http://www.drunkenhyena.com/cgi-bin/dx9.pl

that has a working example of rendering a tutorial to the screen in directx, then i would start working from there.

Seriously getting the first triangle on screen can really be a pain :P

##### Share on other sites
maybe it could be your present parameters (the values you assigned), it is often source of black screen.

##### Share on other sites
Another likely culprit is that you haven't disabled lighting:
Device->SetRenderState(D3DRS_LIGHTING,false);

By default lighting is on so without a light source defined, everything appears black.

##### Share on other sites
Hey everyone! Thank you very much for the replies.
Curiously, all of you were right! lol
It was the backface culling, the lightning and the projection matrix
Also, I made a very stupid mistake, that was really compromising the whole exercise.
I was calling EndScene(); AFTER Present( NULL, NULL, NULL, NULL);
I suddenly noticed that the DX was not clearing the screen (tried changing the color) and I was really confused, as I thought it was something with the init stuff.
Now I see the triangle!
Thank you all again!!!

1. 1
2. 2
3. 3
Rutin
22
4. 4
JoeJ
16
5. 5

• 14
• 29
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631775
• Total Posts
3002284
×