Jump to content
  • Advertisement
Sign in to follow this  

Problem with glPointSize

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

I use glPointSize to set point size but the point seem not the size I am set. I use glDisable(GL_LIGHTING) before I draw points glDisable(GL_LIGHTING); glPointSize(4.0); glColor3f(1.0,0.0,0.0); glBegin(GL_POINTS); glVertex3f(0.0,0.0,0.0); glEnd(); glEnable(GL_LIGHTING); After I do this, the point seems like size 1, not size 4 and I change point size, the point does change it's size What's wrong, can anyone explain this.Help! void UISpace::uiDisplay() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glMatrixMode(GL_MODELVIEW); glRotatef(angleX,1.0,0.0,0.0); glRotatef(angleY,0.0,1.0,0.0); glRotatef(angleZ,0.0,0.0,1.0); glScalef(sx,sy,sz); glGetDoublev(GL_MODELVIEW_MATRIX,mvmatrix); glEnable(GL_DEPTH_TEST); drawMesh(); glPopMatrix(); glutSwapBuffers(); } void UISpace::uiInit() { oldx = 0; oldy = 0; //glMatrixMode(GL_PROJECTION); //glLoadIdentity(); glClearColor(0.1,0.1,0.1,0.0); glColor3f(0.0f,0.0f,0.0f); GLfloat lambient0[] = {0.3,0.3,0.3,1.0}; GLfloat lp0[] = {0.0,0.0,5.0,0.0}; GLfloat ldiffuse0[] = {0.7,0.7,0.7,1.0}; glLightfv(GL_LIGHT0,GL_POSITION,lp0); glLightfv(GL_LIGHT0,GL_AMBIENT,lambient0); glLightfv(GL_LIGHT0,GL_DIFFUSE,ldiffuse0); GLfloat lambient1[] = {0.3,0.3,0.3,1.0}; GLfloat lp1[] = {0.0,0.0,-5.0,0.0}; GLfloat ldiffuse1[] = {0.7,0.7,0.7,1.0}; glLightfv(GL_LIGHT1,GL_POSITION,lp1); glLightfv(GL_LIGHT1,GL_AMBIENT,lambient1); glLightfv(GL_LIGHT1,GL_DIFFUSE,ldiffuse1); GLfloat mat_ambient[] = {0.6,0.6,0.6,1.0}; GLfloat mat_diffuse[] = {0.46,0.80,0.88,1.0}; GLfloat mat_specular[]= {0.46,0.80,0.88,1.0}; GLfloat mat_shininess[] = {10.0}; glMaterialfv(GL_FRONT,GL_AMBIENT,mat_ambient); glMaterialfv(GL_FRONT,GL_DIFFUSE,mat_diffuse); glMaterialfv(GL_FRONT,GL_SPECULAR,mat_specular); glMaterialfv(GL_FRONT,GL_SHININESS,mat_shininess); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_LIGHT1); glDepthFunc(GL_LESS); glShadeModel(GL_FLAT); createFileMenu(); } void UISpace::uiReshape(int w, int h) { if(h==0) h = 1; ratio = 1.0*w/h; glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0,0,w,h); gluPerspective(60,ratio,1,1000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(xX,yY,zZ, 0.0,0.0,0.0, 0.0f,1.0f,0.0f); }

Share this post


Link to post
Share on other sites
Advertisement
Try glEnable(GL_POINT_SMOOTH).

Quote:
man glPointSize:
If point antialiasing is disabled, the actual size is determined by rounding the supplied size to the nearest integer. (If the rounding results in the value 0, it is as if the point size were 1.) If the rounded size is odd, then the center point (x, y) of the pixel fragment that represents the point is computed as

( |_xw_|+.5, |_yw_|+.5)

where w subscripts indicate window coordinates. All pixels that lie within the square grid of the rounded size centered at (x, y) make up the fragment. If the size is even, the center point is

( |_xw+.5_|, |_yw+.5_|)

and the rasterized fragment's centers are the half-integer window coordinates within the square of the rounded size centered at (x, y). All pixel fragments produced in rasterizing a nonantialiased point are assigned the same associated data, that of the vertex corresponding to the point.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!