Re: [Mesa-dev] opengl fill modes

2014-12-06 Thread Brian Paul

On 12/05/2014 08:30 PM, Roland Scheidegger wrote:

Hi,

this might be a stupid question, but if you use opengl fill mode line /
point are the shared edges/vertices in strip (or fan) primitives drawn
multiple times? My pedantic reading of the spec would seem to say yes
(because it essentially says tri strips form individual triangles for
rasterization, and only there are they converted to points/lines), and
this is what we actually do in the draw module, but I have some doubts
that it's actually true or at least that modern hw operates like that?


Coincidentally, I was wondering the same thing a few weeks ago and 
hacked a Mesa trivial test to check it out.  nvidia's driver and Mesa do 
as you suspect (shared edge lines are drawn twice, shared vertex points 
are drawn twice or three times).  I'm attaching my test program.  It 
uses ADD blending to it's easy to see the effect.




Oh and a followup question if it's wrong, what would be the primitive
ids associated with such lines / points when resulting from such
decomposed tri strips?


I suspect they're inherited from the original triangle, but I'd have to 
write a test program to see what a few drivers do.  Your turn. :-)


-Brian


#include stdio.h
#include string.h
#include stdlib.h
#include glut_wrap.h


static void Init(void)
{
   fprintf(stderr, GL_RENDERER   = %s\n, (char *) glGetString(GL_RENDERER));
   fprintf(stderr, GL_VERSION= %s\n, (char *) glGetString(GL_VERSION));
   fprintf(stderr, GL_VENDOR = %s\n, (char *) glGetString(GL_VENDOR));
   fflush(stderr);
   glClearColor(0.0, 0.0, 1.0, 0.0);
}

static void Reshape(int width, int height)
{
   glViewport(0, 0, (GLint)width, (GLint)height);
   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
   glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
   glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{
   if (key == 27)
  exit(0);
   glutPostRedisplay();
}

static void Draw(void)
{
   int i;

   glEnable(GL_BLEND);
   glBlendFunc(GL_ONE, GL_ONE);

   glPointSize(10.0);
   glLineWidth(10);

   glClear(GL_COLOR_BUFFER_BIT);


   glColor4f(0.25, 0.25, 0.25, 0.5);

   glPushMatrix();
   glTranslatef(0, -0.25, 0);
   glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
   for (i = 0; i  2; i++) {
  glBegin(GL_TRIANGLE_STRIP);
  glVertex3f( 0.9, -0.5, -30.0);
  glVertex3f( 0.9,  0.0, -30.0);
  glVertex3f( 0.0,  -0.5, -30.0);
  glVertex3f( 0.0,  0.0, -30.0);
  glVertex3f(-0.9,  -0.5, -30.0);
  glVertex3f(-0.9,  0.0, -30.0);
  glEnd();
  glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
  glTranslatef(0, 1, 0);
   }
   glPopMatrix();

   glutSwapBuffers();
}

int main(int argc, char **argv)
{
   glutInit(argc, argv);
   glutInitWindowPosition(0, 0);
   glutInitWindowSize(250, 250);
   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
   if (glutCreateWindow(*argv) == GL_FALSE) {
  exit(1);
   }

   Init();

   glutReshapeFunc(Reshape);
   glutKeyboardFunc(Key);
   glutDisplayFunc(Draw);
   glutMainLoop();
   return 0;
}
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] opengl fill modes

2014-12-05 Thread Roland Scheidegger
Hi,

this might be a stupid question, but if you use opengl fill mode line /
point are the shared edges/vertices in strip (or fan) primitives drawn
multiple times? My pedantic reading of the spec would seem to say yes
(because it essentially says tri strips form individual triangles for
rasterization, and only there are they converted to points/lines), and
this is what we actually do in the draw module, but I have some doubts
that it's actually true or at least that modern hw operates like that?

Oh and a followup question if it's wrong, what would be the primitive
ids associated with such lines / points when resulting from such
decomposed tri strips?

Roland
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev