Jump to content
  • Advertisement
Sign in to follow this  

Problem: Pointsprites are just black [D3D9]

This topic is 3660 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

Hi, I have a small problem and now I'm just confused. As the topic already points out, I tried working with point sprites and my problem is that they appear as black quads which are not alpha blended on my 8800GT. Scaling however works. Here is the code that I use to do the rendering:
void PointSpriteCloud::render (unsigned howmuch)
	float pointsize = 1.0f;
	float parama = 1.0;
	float paramb = 1.5;
	float paramc = 0.0;

	m_device->SetRenderState (D3DRS_ZWRITEENABLE, FALSE);

	m_device->SetRenderState (D3DRS_ALPHABLENDENABLE, TRUE);
	m_device->SetRenderState (D3DRS_SRCBLEND, GL_ONE);
	m_device->SetRenderState (D3DRS_DESTBLEND, GL_ONE);

	HRESULT hr = m_device->SetRenderState (D3DRS_POINTSPRITEENABLE, TRUE);
	if (FAILED (hr)) {
		throw Exception ("D3DException", "PointSpriteCloud::render", "SetRenderState failed.\n");

	m_device->SetRenderState (D3DRS_POINTSCALEENABLE, TRUE);

	m_device->SetRenderState (D3DRS_POINTSIZE, *(DWORD*)&pointsize);
	m_device->SetRenderState (D3DRS_POINTSIZE_MIN, *(DWORD*)&pointsize);
	m_device->SetRenderState (D3DRS_POINTSCALE_A, *(DWORD*)¶ma);
	m_device->SetRenderState (D3DRS_POINTSCALE_B, *(DWORD*)¶mb);
	m_device->SetRenderState (D3DRS_POINTSCALE_C, *(DWORD*)¶mc);

	m_texture->bind ();

	m_device->SetStreamSource (0, m_buffer, 0, sizeof (XYZCOL));
	hr = m_device->DrawPrimitive (D3DPT_POINTLIST, 0, howmuch);
	if (FAILED (hr)) {
		throw Exception ("RenderException", "PointSpriteCloud::render", "DrawPrimitive failed.\n");

	m_texture->unbind ();
	m_device->SetRenderState (D3DRS_POINTSPRITEENABLE, FALSE);
	m_device->SetRenderState (D3DRS_POINTSCALEENABLE, FALSE);

	m_device->SetRenderState (D3DRS_ALPHABLENDENABLE, FALSE);
	m_device->SetRenderState (D3DRS_ZWRITEENABLE, TRUE);
m_texturs's type is my texture class, which works well for 3d Models. Well, I tried googling for a problem like this, I compared my code to an example that works and didn't find anything. PIX doesn't produce any debug messages. I guess it'll be something truely simple that I've done wrong, but I just can't find it. Thanks for reading. ^^

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!