Drawing a Point....on top

Started by
3 comments, last by XSlinger 16 years, 5 months ago
Hello, I'm using c++ DirectX 9.0c I am creating a function for graphics device that draws a dot on the screen. I am using the function: DrawPrimitiveUP. This works for drawing points onto the screen, but when I draw textures they draw right over the dots, even when I have the draw dot code after the draw image code. I would like the dots to be drawn to the back buffer in the order that I draw it, not always on the bottom. I would appreciate any advice on how to do this. Here is my snippet: int GraphicsDevice::DrawPoint( CFLOAT x, CFLOAT y) { PointInfo p; p.x = x; p.y = y; p.z = 1.0f; p.color = D3DCOLOR_XRGB(rand()%255,rand()%255,rand()%255);; d3dDevice->DrawPrimitiveUP( D3DPT_POINTLIST, 1, &p, sizeof(p)); return 1; } Thanks, Derek
Advertisement
Are you using z-buffering? Make sure its disabled with IDirect3DDevice9.SetRenderState(D3DRS_ZENABLE, FALSE).

[Edited by - MJP on November 3, 2007 4:44:52 PM]
Hi, same thing happens. I don't have a z buffer.
Quote:Original post by XSlinger
Hi, same thing happens. I don't have a z buffer.


Well you must have a z-buffer, since D3D doesn't allow you to draw anything without a z-buffer set. You're probably just using the one created for you when you create your device. I'm not sure what your problem is though, if z-buffering is disabled.

Yep, sorry. What I meant was that I used the default z buffer when I create the device. But, when I disable it, it still draws the point underneath a texture which (using a sprite) I call to draw before the point.

My code is like this:

ClearBuffer()
BeginScene()

DrawImage()
DrawPoints()

EndScene()

The points can be seen until the image is over top of it, so for some reason the points are always drawing first which doesn't make sense.

Is there another way I can draw points besides using DrawPrimitiveUP ?

Thanks,
Derek

This topic is closed to new replies.

Advertisement