Jump to content
  • Advertisement
Sign in to follow this  
XSlinger

Drawing a Point....on top

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!