Twilight
2005.03.24, 05:10 AM
Hi,
when I use smoothed GL_POINTS with blending and draw them into the context, I get this:
http://www.pro-pixelmedia.de/rene/gl_points.gif
Some of the gl_points have black corners while others blended correctly.
I use the following code:
OpenGL Setup:
glShadeModel(GL_SMOOTH);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearDepth(1.0f);
glEnable( GL_POINT_SMOOTH );
glEnable( GL_DEPTH_TEST );
glDepthFunc(GL_LEQUAL);
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0,1.0,-1.0,1.0, 1.0, 10.0);
glTranslatef(0.0,0.0,-2.0);
Drawing Routine:
glClearColor( 0.0, 0.0, 0.0, 0.0 );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable (GL_DEPTH_TEST);
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPointSize( 16.0 );
glBegin( GL_POINTS );
float tempZ;
int i;
for(i=0;i<numOfStars;i++) {
tempZ = stars[i].posZ;
if(stars[i].posX > 1.0) stars[i].posX = -1.0;
stars[i].posX = stars[i].posX + 0.001f;
glColor3f (tempZ, tempZ, tempZ );
glVertex3f(stars[i].posX, stars[i].posY, tempZ);
}
glEnd( );
CGLFlushDrawable( contextObj );
What's wrong with this?
when I use smoothed GL_POINTS with blending and draw them into the context, I get this:
http://www.pro-pixelmedia.de/rene/gl_points.gif
Some of the gl_points have black corners while others blended correctly.
I use the following code:
OpenGL Setup:
glShadeModel(GL_SMOOTH);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearDepth(1.0f);
glEnable( GL_POINT_SMOOTH );
glEnable( GL_DEPTH_TEST );
glDepthFunc(GL_LEQUAL);
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0,1.0,-1.0,1.0, 1.0, 10.0);
glTranslatef(0.0,0.0,-2.0);
Drawing Routine:
glClearColor( 0.0, 0.0, 0.0, 0.0 );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable (GL_DEPTH_TEST);
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPointSize( 16.0 );
glBegin( GL_POINTS );
float tempZ;
int i;
for(i=0;i<numOfStars;i++) {
tempZ = stars[i].posZ;
if(stars[i].posX > 1.0) stars[i].posX = -1.0;
stars[i].posX = stars[i].posX + 0.001f;
glColor3f (tempZ, tempZ, tempZ );
glVertex3f(stars[i].posX, stars[i].posY, tempZ);
}
glEnd( );
CGLFlushDrawable( contextObj );
What's wrong with this?