Jump to content
  • Advertisement
Sign in to follow this  

Depth problem with Point Sprites

This topic is 4504 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 everyone! I've been reading this forum for a while now and usually I find what I'm looking for. But I'm having a problem with my point sprite implementation for a particle engine and was hoping some of you can help me :) I found a good example tutorial of how to use point sprites and tried messing around with it using the NeHe base code. It draws the points, but whenever I try to zoom in and out on them, the size doesn't change at all. I was thinking maybe I need to glEnable some other states in my current Init function:
	glShadeModel(GL_SMOOTH);							// Enable Smooth Shading
	glClearColor(0.0f, 0.0f, 0.0f, 0.5f);				// Black Background
	glClearDepth(1.0f);									// Depth Buffer Setup
	glEnable(GL_DEPTH_TEST);							// Enables Depth Testing
	glDepthFunc(GL_LEQUAL);								// The Type Of Depth Testing To Do
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	// Really Nice Perspective Calculations

My current function for drawing the point sprites is this:
void DrawPoints()
	float quadric[] = {0.0f, 0.0f, 0.0f};
	glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, quadric);
	float maxSize = 0.0f;
	glGetFloatv(GL_POINT_SIZE_MAX_ARB, &maxSize);

	glPointParameterfARB(GL_POINT_SIZE_MAX_ARB, maxSize);
	glPointParameterfARB(GL_POINT_SIZE_MIN_ARB, 0.0f );



	glBegin(GL_POINTS); //just a bunch of random points
            glColor4f( 0.0f, 
                       1.0f );
		glVertex3f(0.0f, 0.0f, -6.0f);
		glVertex3f(1.0f, 0.0f, -6.0f);
		glVertex3f(-1.0f, 0.0f, -6.0f);
		glVertex3f(0.0f, 1.0f, -6.0f);
		glVertex3f(0.0f, -1.0f, -6.0f);


I would really appreciate if someone could point out why it doesn't alter the size of the points when I zoom in and out of the scene using glTranslatef. Thanks!

Share this post

Link to post
Share on other sites
The size doesn't change bacause you set the attenuation factors to 0:

float quadric[] = {0.0f, 0.0f, 0.0f};

Share this post

Link to post
Share on other sites
My final attenuation factors was {1.0f, 0.0f, 0.01f}, it works really well for my particle engine but I don't know if this is how the pros would normally do it :p

I found the tutorial at:

but in the meantime I also found this one:


It's basically the same thing and I think the first mentioned tutorial is better but it's nice to have an example :)

Share this post

Link to post
Share on other sites
I'm using the same tutorial as above but I have found a weird problem...

When I'm using attenuation I can only get a max size of 63, but without attenuation I have "unlimited" size...

Does anyone know how to remedy this? Is this a graphics driver issue ?

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!