GL_POINT_DISTANCE_ATTENUATION

Everything todo with programming goes HERE.
Post Reply
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

GL_POINT_DISTANCE_ATTENUATION

Post by Jonathan »

I was playing a bit with points, but I just can't figure this out. As soon as I change any of the values the slightest bit, my points render at (near?) zero size.

For example:

Code: Select all

GLfloat distance_attenuation[3] = {1.0f, 0.0f, 0.0f};
glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, distance_attenuation);
glPointSize(32.0f);
glBegin(GL_POINTS);
glVertex2f(0.0f, 0.0f);
glEnd();
renders a 32x32 block in the middle.

Code: Select all

GLfloat distance_attenuation[3] = {1.001f, 0.0f, 0.0f};
glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, distance_attenuation);
glPointSize(32.0f);
glBegin(GL_POINTS);
glVertex2f(0.0f, 0.0f);
glEnd();
renders a single pixel in the middle. Smooth points don't show up at all, even without blending.

I checked for errors, but of course OpenGL reported none.
hannesh
Posts: 1
Joined: Mon Sep 06, 2010 7:47 pm

Re: GL_POINT_DISTANCE_ATTENUATION

Post by hannesh »

You have to set the minSize and maxSize of points before using distance attenuation. The driver looks at this instead of pointsize when your values aren't the default { 1.0, 0.0 0.0 }.
User avatar
Clutch
Shutout Match Winner
Posts: 1008
Joined: Fri Aug 28, 2009 5:53 pm
Location: A frozen wasteland

Re: GL_POINT_DISTANCE_ATTENUATION

Post by Clutch »

Over 2000 views and only one possibly helpful tip :P
Boxed
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Re: GL_POINT_DISTANCE_ATTENUATION

Post by Jonathan »

Wow, it's been so long I forgot what I was doing there. But thank you for your help.
ˌɑrməˈɡɛˌtrɑn
Post Reply