Archived

This topic is now archived and is closed to further replies.

Nytegard

Question about D3D DrawPrimitive

Recommended Posts

Everything is initialized into hardware, although I am getting some dismal results compared to Open GL. I am storing textures in hardware, although for the current test, I''m not using textures at all. (This is easier for me to detect on my voodoo 2 card, but my tnt2 shows similar results when more stuff is on the screen) When I''m not rendering textures, I get an average of 60 FPS, which I expect since that is the refresh rate. However, when I initialize: D3DVERTEX BackgroundVertices[4]; D3DVECTOR p1(-1,-1, 0); D3DVECTOR p2(-1,1, 0); D3DVECTOR p3(1,-1, 0); D3DVECTOR p4(1,1, 0); D3DVECTOR vNormal(0,0,0); BackgroundVertices[0] = D3DVERTEX(p1,vNormal,0,0); BackgroundVertices[1] = D3DVERTEX(p2,vNormal,0,0); BackgroundVertices[2] = D3DVERTEX(p3,vNormal,0,0); BackgroundVertices[3] = D3DVERTEX(p4,vNormal,0,0); (I do the above only one), and run through a for loop 10x with the following: D3DDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP,D3DFVF_VERTEX, BackgroundVertices,4,NULL); (Draws a rectangle full screen 10x), the framerate gets cut down to about 20 fps. In Open GL, I still maintain the same frame rate as the refresh rate. I''m just wanted to test out how many full screen rectangles at once, and do not plan to just use simple squares as shapes, and am just wondering, how can I improve the frame rate while maintaining the same number of full screen figures, or is it normal to expect such dismal performance.

Share this post


Link to post
Share on other sites
Hi

can it be that you are using a Z-Buffer under OpenGL because an Overdraw of 10 is very Hard, in 1024x768 you would need 480 Million Pixels of Fillrate (i hope i calculated it right) to maintain 60 Frames (a G-Force would do that).
So try to enable the Z-Buffer, and draw from Front to Back. Then only the most front triangles will be drawn, because the others fail the Z-Test.

Lars

Share this post


Link to post
Share on other sites
Remember that the Z-test function for Direct3D defaults to D3DCMP_LESSEQUAL so if all your polygons have the same z-value the will all be rendered.

For OpenGL the default is GL_LESS, yielding only one rendering.

Share this post


Link to post
Share on other sites