void
display(void)
{
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  glPushMatrix();
  glScalef(1.3, 1.3, 1.3);
  glRotatef(angle, 1.0, 0.0, 0.0);

  glPushMatrix();
  glTranslatef(-0.75, -0.5, 0.0);
  glRotatef(270.0, 1.0, 0.0, 0.0);
  glPolygonStipple(stippleMask[tetraStipple]);
  glCallList(TETRAHEDRON);
  glPopMatrix();

  glPushMatrix();
  glTranslatef(-0.75, 0.5, 0.0);
  glRotatef(90.0, 1.0, 0.0, 0.0);
  glPolygonStipple(stippleMask[torusStipple]);
  glCallList(TORUS);
  glPopMatrix();

  glPushMatrix();
  glTranslatef(0.75, 0.0, -1.0);
  glPolygonStipple(stippleMask[icoStipple]);
  glCallList(ICOSAHEDRON);
  glPopMatrix();

  glPopMatrix();

  glutSwapBuffers();
}
Beispiel #2
0
void display(void)
{
   GLubyte fly[] = {
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x03, 0x80, 0x01, 0xC0, 0x06, 0xC0, 0x03, 0x60, 
      0x04, 0x60, 0x06, 0x20, 0x04, 0x30, 0x0C, 0x20, 
      0x04, 0x18, 0x18, 0x20, 0x04, 0x0C, 0x30, 0x20,
      0x04, 0x06, 0x60, 0x20, 0x44, 0x03, 0xC0, 0x22, 
      0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, 
      0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22,
      0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, 
      0x66, 0x01, 0x80, 0x66, 0x33, 0x01, 0x80, 0xCC, 
      0x19, 0x81, 0x81, 0x98, 0x0C, 0xC1, 0x83, 0x30,
      0x07, 0xe1, 0x87, 0xe0, 0x03, 0x3f, 0xfc, 0xc0, 
      0x03, 0x31, 0x8c, 0xc0, 0x03, 0x33, 0xcc, 0xc0, 
      0x06, 0x64, 0x26, 0x60, 0x0c, 0xcc, 0x33, 0x30,
      0x18, 0xcc, 0x33, 0x18, 0x10, 0xc4, 0x23, 0x08, 
      0x10, 0x63, 0xC6, 0x08, 0x10, 0x30, 0x0c, 0x08, 
      0x10, 0x18, 0x18, 0x08, 0x10, 0x00, 0x00, 0x08};

   GLubyte halftone[] = {
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55};

   glClear (GL_COLOR_BUFFER_BIT);
   glColor3f (1.0, 1.0, 1.0);

/*  draw one solid, unstippled rectangle,	*/	
/*  then two stippled rectangles		*/
   glRectf (25.0, 25.0, 125.0, 125.0);
   glEnable (GL_POLYGON_STIPPLE);
   glPolygonStipple (fly);
   glRectf (125.0, 25.0, 225.0, 125.0);
   glPolygonStipple (halftone);
   glRectf (225.0, 25.0, 325.0, 125.0);
   glDisable (GL_POLYGON_STIPPLE);

   glFlush ();
}
Beispiel #3
0
void display()
{
	GLubyte fly[] = {
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x03, 0x80, 0x01, 0xc0, 0x06, 0xc0, 0x03, 0x60,
		0x04, 0x60, 0x06, 0x20, 0x04, 0x30, 0x0c, 0x20,
		0x04, 0x18, 0x18, 0x20, 0x04, 0x0c, 0x30, 0x20,
		0x04, 0x06, 0x60, 0x20, 0x44, 0x03, 0xc0, 0x22,
		0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22,
		0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22,
		0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22,
		0x66, 0x01, 0x80, 0x66, 0x33, 0x01, 0x80, 0xcc,
		0x19, 0x81, 0x81, 0x98, 0x0c, 0xc1, 0x83, 0x30,
		0x07, 0xe1, 0x87, 0xe0, 0x03, 0x3f, 0xfc, 0xc0,
		0x03, 0x31, 0x8c, 0xc0, 0x03, 0x33, 0xcc, 0xc0,
		0x06, 0x64, 0x26, 0x60, 0x0c, 0xcc, 0x33, 0x30,
		0x18, 0xcc, 0x33, 0x18, 0x10, 0xc4, 0x23, 0x08,
		0x10, 0x63, 0xc6, 0x08, 0x10, 0x30, 0x0c, 0x08,
		0x10, 0x18, 0x18, 0x08, 0x10, 0x00, 0x00, 0x08};

	GLubyte halftone[] = {
		0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
		0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
		0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
		0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
		0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
		0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
		0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
		0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
		0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
		0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
		0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
		0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
		0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
		0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
		0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
		0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55};

	glClear(GL_COLOR_BUFFER_BIT);
	glColor3f(1.0, 1.0, 1.0);
	glRectf(25.0, 25.0, 125.0, 125.0);
	glEnable(GL_POLYGON_STIPPLE);
	glPolygonStipple(fly);
	glRectf(125.0, 25.0, 225.0, 125.0);
	glPolygonStipple(halftone);
	glRectf(225.0, 25.0, 325.0, 125.0);
	glDisable(GL_POLYGON_STIPPLE);
	glFlush();
}
Beispiel #4
0
void CRenderSystemGL::SetStereoMode(RENDER_STEREO_MODE mode, RENDER_STEREO_VIEW view)
{
  CRenderSystemBase::SetStereoMode(mode, view);

  glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
  glDisable(GL_POLYGON_STIPPLE);
  glDrawBuffer(GL_BACK);

  if(m_stereoMode == RENDER_STEREO_MODE_ANAGLYPH_RED_CYAN)
  {
    if(m_stereoView == RENDER_STEREO_VIEW_LEFT)
      glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_TRUE);
    else if(m_stereoView == RENDER_STEREO_VIEW_RIGHT)
      glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE);
  }
  if(m_stereoMode == RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA)
  {
    if(m_stereoView == RENDER_STEREO_VIEW_LEFT)
      glColorMask(GL_FALSE, GL_TRUE, GL_FALSE, GL_TRUE);
    else if(m_stereoView == RENDER_STEREO_VIEW_RIGHT)
      glColorMask(GL_TRUE, GL_FALSE, GL_TRUE, GL_TRUE);
  }
  if(m_stereoMode == RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE)
  {
    if(m_stereoView == RENDER_STEREO_VIEW_LEFT)
      glColorMask(GL_TRUE, GL_TRUE, GL_FALSE, GL_TRUE);
    else if(m_stereoView == RENDER_STEREO_VIEW_RIGHT)
      glColorMask(GL_FALSE, GL_FALSE, GL_TRUE, GL_TRUE);
  }

  if(m_stereoMode == RENDER_STEREO_MODE_INTERLACED)
  {
    glEnable(GL_POLYGON_STIPPLE);
    if(m_stereoView == RENDER_STEREO_VIEW_LEFT)
      glPolygonStipple(stipple_3d);
    else if(m_stereoView == RENDER_STEREO_VIEW_RIGHT)
      glPolygonStipple(stipple_3d+4);
  }

  if(m_stereoMode == RENDER_STEREO_MODE_HARDWAREBASED)
  {
    if(m_stereoView == RENDER_STEREO_VIEW_LEFT)
      glDrawBuffer(GL_BACK_LEFT);
    else if(m_stereoView == RENDER_STEREO_VIEW_RIGHT)
      glDrawBuffer(GL_BACK_RIGHT);
  }

}
void ModelDrawer::RenderSelection (IView *view)
{
	glEnable (GL_POLYGON_OFFSET_FILL);
	glPolygonOffset (0.0f, -10.0f);
	glDepthMask (GL_FALSE);

	ulong pattern[32], *i = pattern;
	ulong val = 0xCCCCCCCC;
	for (;i < pattern+32;) {
		*(i++)=val; *(i++)=val;
		val = ~val;
	}
	glPolygonStipple ((GLubyte *)&pattern[0]);
	glEnable (GL_POLYGON_STIPPLE);
	glDisable (GL_LIGHTING);
	glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
	glDisable (GL_CULL_FACE);

	if (model->root)
		RenderSelection_ (model->root, view);

	glDisable (GL_POLYGON_STIPPLE);
	glDisable (GL_POLYGON_OFFSET_FILL);
	glDepthMask (GL_TRUE);
	glPolygonOffset (0.0f, 0.0f);
}
Beispiel #6
0
void Layer::setLayerFillProperties() const{
		//stipple fill
		glEnable( GL_POLYGON_STIPPLE );
		glPolygonStipple( STIPPLE_MASKS[ clsStippleMask ] );
		glColor4ub( clsFillColor.r, clsFillColor.g, clsFillColor.b, 100);
		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);		
}
static void
draw_translucent_rect(double x0, double y0, double x1, double y1)
{
   /* This stipple is a simple checkerboard of bits, which should
    * make the floor translucent */
   static GLubyte halftone[] = {
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
      0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55};
    
   glEnable (GL_POLYGON_STIPPLE);
   //?? glDisable (GL_CULL_FACE);
   glPolygonStipple (halftone);
   glBegin(GL_POLYGON);
   glVertex3d(x0, 0, y0); 
   glVertex3d(x1, 0, y0); 
   glVertex3d(x1, 0, y1); 
   glVertex3d(x0, 0, y1); 
   glEnd();
   glDisable (GL_POLYGON_STIPPLE);
   //?? glEnable (GL_CULL_FACE);
}
//Set any necessary GL settings
void setup_render_state()
{
	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
	glEnable(GL_POLYGON_STIPPLE);
	glPolygonStipple(fire);
	win_resized(win_w, win_h);
}
Beispiel #9
0
void myDisplay(void)
{
	static GLubyte Mask[128];
	FILE *fb;
	fopen_s(&fb,"mask.bmp","rb");
	if (!fb)
	{
		exit(0);
	}
	if (fseek(fb,-(int)sizeof(Mask),SEEK_END))
	{
		exit(0);
	}
	if (!fread(Mask,sizeof(Mask),1,fb))
	{
		exit(0);
	}
	fclose(fb);

	glClear(GL_COLOR_BUFFER_BIT);
	glEnable(GL_POLYGON_STIPPLE);
	glPolygonStipple(Mask);
	glPolygonMode(GL_FRONT,GL_FILL);
	glPolygonMode(GL_BACK,GL_LINE);
	glRectf(0.0f, 0.0f, 1.0f, 1.0f);
	glDisable(GL_POLYGON_STIPPLE);
	glRectf(-1.0f, -1.0f, 0.0f, 0.0f);
	glFlush();
}
Beispiel #10
0
/* Draw an image using a mask bitmap. */
void drawImageAsFile(void)
{
	static GLubyte uMask[128];
	FILE* fp = 0;
	fp = fopen("E:\\Projects\\lab\\lab\\file\\mask.bmp", "rb");
	if(!fp)
	{
		exit(0);
	}
	if(fseek(fp, -(int)sizeof(uMask), SEEK_END))
	{
		exit(0);
	}
	if(!fread(uMask, sizeof(uMask), 1, fp))
	{
		exit(0);
	}
	fclose(fp);

	Clear();
	glEnable(GL_POLYGON_STIPPLE);

	glPolygonStipple(uMask);
	glRectf(-1.0f, -1.0f, 0.0f, 0.0f);
	glDisable(GL_POLYGON_STIPPLE);
	glRectf(0.0f, 0.0f, 1.0f, 1.0f);

	glFlush();
}
Beispiel #11
0
void
piglit_init(int argc, char **argv)
{
	if (argc < 2)
		print_usage_and_exit(argv[0]);
	{
		char *endptr = NULL;
		num_samples = strtol(argv[1], &endptr, 0);
		if (endptr != argv[1] + strlen(argv[1]))
			print_usage_and_exit(argv[0]);
	}

	piglit_require_gl_version(30);
	piglit_ortho_projection(pattern_width, pattern_height, GL_TRUE);

	/* Skip the test if num_samples > GL_MAX_SAMPLES */
	GLint max_samples;
	glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
	if (num_samples > max_samples)
		piglit_report_result(PIGLIT_SKIP);

	ms_fbo.setup(FboConfig(num_samples, pattern_width, pattern_height));
	resolve_fbo.setup(FboConfig(0, pattern_width, pattern_height));

	buffer_to_test = GL_COLOR_BUFFER_BIT;
	shader_compile();
	glEnable(GL_POLYGON_STIPPLE);
	glPolygonStipple(stipple_pattern);

}
Beispiel #12
0
void
make_stipple(void) {
    GLuint stipple[32];
    int i;
    for(i = 0; i < 32; i++) {
    	stipple[i] = 0xff00ff00;
    }
    glPolygonStipple((GLubyte *)stipple);
}
/* draws a shaded strip, made from gradient + flat color + gradient */
static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, float y1, float x2, float y2)
{
	float ymid1, ymid2;
	
	if (seq->flag & SEQ_MUTE) {
		glEnable(GL_POLYGON_STIPPLE);
		glPolygonStipple(stipple_halftone);
	}
	
	ymid1 = (y2 - y1) * 0.25f + y1;
	ymid2 = (y2 - y1) * 0.65f + y1;
	
	glShadeModel(GL_SMOOTH);
	glBegin(GL_QUADS);
	
	if (seq->flag & SEQ_INVALID_EFFECT) { col[0] = 255; col[1] = 0; col[2] = 255; }
	else if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -50);
	/* else UI_GetColorPtrShade3ubv(col, col, 0); */ /* DO NOTHING */
	
	glColor3ubv(col);
	
	glVertex2f(x1, y1);
	glVertex2f(x2, y1);

	if (seq->flag & SEQ_INVALID_EFFECT) { col[0] = 255; col[1] = 0; col[2] = 255; }
	else if (seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 5);
	else UI_GetColorPtrShade3ubv(col, col, -5);

	glColor3ubv((GLubyte *)col);
	
	glVertex2f(x2, ymid1);
	glVertex2f(x1, ymid1);
	
	glEnd();
	
	glRectf(x1,  ymid1,  x2,  ymid2);
	
	glBegin(GL_QUADS);
	
	glVertex2f(x1, ymid2);
	glVertex2f(x2, ymid2);
	
	if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -15);
	else UI_GetColorPtrShade3ubv(col, col, 25);
	
	glColor3ubv((GLubyte *)col);
	
	glVertex2f(x2, y2);
	glVertex2f(x1, y2);
	
	glEnd();
	
	if (seq->flag & SEQ_MUTE) {
		glDisable(GL_POLYGON_STIPPLE);
	}
}
Beispiel #14
0
/* Draw an image using a mask array. */
void drawImageAsMask(void)
{
	Clear();
	glEnable(GL_POLYGON_STIPPLE);

	glPolygonStipple(Mask);
	glRectf(-1.0f, -1.0f, 0.0f, 0.0f);
	glDisable(GL_POLYGON_STIPPLE);
	glRectf(0.0f, 0.0f, 1.0f, 1.0f);

	glFlush();
}
Beispiel #15
0
void ccGenericMesh::EnableGLStippleMask(bool state)
{
	if (state)
	{
		glPolygonStipple(s_stippleMask);
		glEnable(GL_POLYGON_STIPPLE);
	}
	else
	{
		glDisable(GL_POLYGON_STIPPLE);
	}
}
void RAS_OpenGLRasterizer::SetEye(const StereoEye eye)
{
	m_curreye = eye;
	switch (m_stereomode)
	{
		case RAS_STEREO_QUADBUFFERED:
			glDrawBuffer(m_curreye == RAS_STEREO_LEFTEYE ? GL_BACK_LEFT : GL_BACK_RIGHT);
			break;
		case RAS_STEREO_ANAGLYPH:
			if (m_curreye == RAS_STEREO_LEFTEYE) {
				glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE);
			}
			else {
				//glAccum(GL_LOAD, 1.0f);
				glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE);
				ClearDepthBuffer();
			}
			break;
		case RAS_STEREO_VINTERLACE:
		{
			// OpenGL stippling is deprecated, it is no longer possible to affect all shaders
			// this way, offscreen rendering and then compositing may be the better solution
			glEnable(GL_POLYGON_STIPPLE);
			glPolygonStipple((const GLubyte*) ((m_curreye == RAS_STEREO_LEFTEYE) ? left_eye_vinterlace_mask : right_eye_vinterlace_mask));
			if (m_curreye == RAS_STEREO_RIGHTEYE)
				ClearDepthBuffer();
			break;
		}
		case RAS_STEREO_INTERLACED:
		{
			glEnable(GL_POLYGON_STIPPLE);
			glPolygonStipple((const GLubyte*) &hinterlace_mask[m_curreye == RAS_STEREO_LEFTEYE?0:1]);
			if (m_curreye == RAS_STEREO_RIGHTEYE)
				ClearDepthBuffer();
			break;
		}
		default:
			break;
	}
}
Beispiel #17
0
void fdrawcheckerboard(float x1, float y1, float x2, float y2)
{
	unsigned char col1[4] = {40, 40, 40}, col2[4] = {50, 50, 50};

	glColor3ubv(col1);
	glRectf(x1, y1, x2, y2);
	glColor3ubv(col2);

	glEnable(GL_POLYGON_STIPPLE);
	glPolygonStipple(stipple_checker_8px);
	glRectf(x1, y1, x2, y2);
	glDisable(GL_POLYGON_STIPPLE);
}
void RAS_OpenGLRasterizer::SetEye(const StereoEye eye)
{
	m_curreye = eye;
	switch (m_stereomode)
	{
		case RAS_STEREO_QUADBUFFERED:
			glDrawBuffer(m_curreye == RAS_STEREO_LEFTEYE ? GL_BACK_LEFT : GL_BACK_RIGHT);
			break;
		case RAS_STEREO_ANAGLYPH:
			if (m_curreye == RAS_STEREO_LEFTEYE) {
				glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE);
			}
			else {
				//glAccum(GL_LOAD, 1.0);
				glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE);
				ClearDepthBuffer();
			}
			break;
		case RAS_STEREO_VINTERLACE:
		{
			glEnable(GL_POLYGON_STIPPLE);
			glPolygonStipple((const GLubyte*) ((m_curreye == RAS_STEREO_LEFTEYE) ? left_eye_vinterlace_mask : right_eye_vinterlace_mask));
			if (m_curreye == RAS_STEREO_RIGHTEYE)
				ClearDepthBuffer();
			break;
		}
		case RAS_STEREO_INTERLACED:
		{
			glEnable(GL_POLYGON_STIPPLE);
			glPolygonStipple((const GLubyte*) &hinterlace_mask[m_curreye == RAS_STEREO_LEFTEYE?0:1]);
			if (m_curreye == RAS_STEREO_RIGHTEYE)
				ClearDepthBuffer();
			break;
		}
		default:
			break;
	}
}
static void drawmeta_stipple(int value)
{
	if (value) {
		glEnable(GL_POLYGON_STIPPLE);
		glPolygonStipple(stipple_halftone);
		
		glEnable(GL_LINE_STIPPLE);
		glLineStipple(1, 0x8888);
	}
	else {
		glDisable(GL_POLYGON_STIPPLE);
		glDisable(GL_LINE_STIPPLE);
	}
}
Beispiel #20
0
// This function does any needed initialization on the rendering
// context. 
void SetupRC()
	{
	// Black background
	glClearColor(0.0f, 0.0f, 0.0f, 1.0f );

	// Set drawing color to red
	glColor3f(1.0f, 0.0f, 0.0f);
	
	// Enable polygon stippling
	glEnable(GL_POLYGON_STIPPLE);
	
	// Specify a specific stipple pattern
	glPolygonStipple(fire);
	}
Beispiel #21
0
void PolygonChunk::activate(DrawActionBase *, UInt32)
{
// cullFace

    if(_sfCullFace.getValue() != GL_NONE)
    {
        glCullFace(_sfCullFace.getValue());
        glEnable(GL_CULL_FACE);
    }

// frontFace

    if(_sfFrontFace.getValue() != GL_CCW)
        glFrontFace(_sfFrontFace.getValue());

// smooth

    if(_sfSmooth.getValue()) 
        glEnable(GL_POLYGON_SMOOTH);

// mode

    if(_sfFrontMode.getValue() != GL_FILL)
        glPolygonMode(GL_FRONT, _sfFrontMode.getValue());

    if(_sfBackMode.getValue() != GL_FILL)
        glPolygonMode(GL_BACK, _sfBackMode.getValue());

// offset
   
    if(_sfOffsetFactor.getValue() != 0.f || _sfOffsetBias.getValue() != 0.f)    
        glPolygonOffset(_sfOffsetFactor.getValue(), _sfOffsetBias.getValue());

    if(_sfOffsetPoint.getValue())    
        glEnable(GL_POLYGON_OFFSET_POINT);

    if(_sfOffsetLine.getValue()) 
        glEnable(GL_POLYGON_OFFSET_LINE);

    if(_sfOffsetFill.getValue()) 
        glEnable(GL_POLYGON_OFFSET_FILL);

// stipple

    if(_mfStipple.size() == 32)
    {
        glPolygonStipple(reinterpret_cast<const GLubyte *>(&(_mfStipple[0])));
        glEnable(GL_POLYGON_STIPPLE);
    }
}
Beispiel #22
0
void myDisplay (void)
{
	glClear (GL_COLOR_BUFFER_BIT);  
	GLubyte fillPattern [ ] = 
	{	0x0f, 0xf0, 0x0f, 0xf0,
		0x0f, 0xf0, 0x0f, 0xf0,
		0x0f, 0xf0, 0x0f, 0xf0,
		0x0f, 0xf0, 0x0f, 0xf0,
		0xf0, 0x0f, 0xf0, 0x0f,
		0xf0, 0x0f, 0xf0, 0x0f,
		0xf0, 0x0f, 0xf0, 0x0f,
		0xf0, 0x0f, 0xf0, 0x0f,
		0xf0, 0x0f, 0xf0, 0x0f,
		0xf0, 0x0f, 0xf0, 0x0f,
		0xf0, 0x0f, 0xf0, 0x0f,
		0xf0, 0x0f, 0xf0, 0x0f,
		0x0f, 0xf0, 0x0f, 0xf0,
		0x0f, 0xf0, 0x0f, 0xf0,
		0x0f, 0xf0, 0x0f, 0xf0,
		0x0f, 0xf0, 0x0f, 0xf0,
		0x0f, 0xf0, 0x0f, 0xf0,
		0x0f, 0xf0, 0x0f, 0xf0,
		0x0f, 0xf0, 0x0f, 0xf0,
		0x0f, 0xf0, 0x0f, 0xf0,
		0xf0, 0x0f, 0xf0, 0x0f,
		0xf0, 0x0f, 0xf0, 0x0f,
		0xf0, 0x0f, 0xf0, 0x0f,
		0xf0, 0x0f, 0xf0, 0x0f,
		0xf0, 0x0f, 0xf0, 0x0f,
		0xf0, 0x0f, 0xf0, 0x0f,
		0xf0, 0x0f, 0xf0, 0x0f,
		0xf0, 0x0f, 0xf0, 0x0f,
		0x0f, 0xf0, 0x0f, 0xf0,
				0x0f, 0xf0, 0x0f, 0xf0,
		0x0f, 0xf0, 0x0f, 0xf0,
		0x0f, 0xf0, 0x0f, 0xf0,
	};
	glPolygonStipple (fillPattern);

	glEnable (GL_POLYGON_STIPPLE);
	glBegin (GL_POLYGON);			// Polygon with 4 vertices.
		glVertex2i (100, 100);		
		glVertex2i (300, 100); 		
		glVertex2i (300, 300); 		
		glVertex2i (100, 300); 		
	glEnd ( );

	glFlush ( );     
}
Beispiel #23
0
void display(void) {
  int i;
  glClear(GL_COLOR_BUFFER_BIT);
  glDisable(GL_POLYGON_STIPPLE);

  glEnable(GL_POLYGON_STIPPLE);
  glColor3f(r, g, 1.0);
  glPolygonStipple(tux);
  glBegin(GL_POLYGON);
  glVertex2i(100, 63); glVertex2i(50, 150); glVertex2i(100, 237);
  glVertex2i(200, 237); glVertex2i(250, 150); glVertex2i(200, 63);
  glEnd();
  glFlush();
  glutSwapBuffers();
}
Beispiel #24
0
static void wm_method_draw_stereo3d_interlace(wmWindow *win)
{
	wmDrawData *drawdata;
	int view;

	wm_interlace_masks_create(win);

	for (view = 0; view < 2; view ++) {
		drawdata = BLI_findlink(&win->drawdata, (view * 2) + 1);

		glEnable(GL_POLYGON_STIPPLE);
		glPolygonStipple(view ? (GLubyte *) right_interlace_mask : (GLubyte *) left_interlace_mask);

		wm_triple_draw_textures(win, drawdata->triple, 1.0f);
		glDisable(GL_POLYGON_STIPPLE);
	}
}
Beispiel #25
0
/** test that lines aren't effected by polygon stipple */
static GLboolean
test_lines_no_stippling(void)
{
   const GLfloat x0 = 5.0, x1 = 40.0, xmid = 0.5 * (x0 + x1);
   const GLfloat x2 = 45.0, x3 = 85.0, xmid_aa = 0.5 * (x2 + x3);
   const GLfloat y0 = 50.0;
   GLubyte stipple[4 * 32];
   GLboolean pass = GL_TRUE;

   memset(stipple, 0, sizeof(stipple));
   glPolygonStipple(stipple);
   glEnable(GL_POLYGON_STIPPLE);

   glLineWidth(3.0);

   /* Non-AA */
   glBegin(GL_LINES);
   glVertex2f(x0, y0);
   glVertex2f(x1, y0);
   glEnd();
   if (black_pixel(xmid, y0)) {
      fprintf(stderr, "Error: Line not drawn because of polygon stipple.\n");
      pass = GL_FALSE;
   }

   /* AA */
   glEnable(GL_LINE_SMOOTH);
   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
   glEnable(GL_BLEND);

   glBegin(GL_LINES);
   glVertex2f(x2, y0);
   glVertex2f(x3, y0);
   glEnd();
   if (black_pixel(xmid_aa, y0)) {
      fprintf(stderr, "Error: AA Line not drawn because of polygon stipple.\n");
      pass = GL_FALSE;
   }

   glDisable(GL_BLEND);
   glDisable(GL_LINE_SMOOTH);
   glDisable(GL_POLYGON_STIPPLE);
   glLineWidth(1.0);

   return pass;
}
Beispiel #26
0
static void RenderScene()
{
	glClear(GL_COLOR_BUFFER_BIT);
  glColor3f(1.0f, 1.0f, 0.0f);
  //¿ªÆô¶à±ßÐε㻭Ìî³ä
  glEnable(GL_POLYGON_STIPPLE);
  //ÉèÖÃÌî³äģʽ
  glPolygonStipple(fire);
	glBegin(GL_POLYGON);
		glVertex2f(0.0f, 0.0f);
		glVertex2f(50.0f, 0.0f);
		glVertex2f(50.0f, 50.0f);
		glVertex2f(0.0f, 50.0f);
	glEnd();

	glFlush();
}
Beispiel #27
0
static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth, int lheight)
{
	if(sel[0] <= str_len_draw && sel[1] >= 0) {
		int sta = MAX2(sel[0], 0);
		int end = MIN2(sel[1], str_len_draw);

		glEnable(GL_POLYGON_STIPPLE);
		glPolygonStipple(stipple_halftone);
		glEnable( GL_BLEND );
		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
		glColor4ub(255, 255, 255, 96);

		glRecti(xy[0]+(cwidth*sta), xy[1]-2 + lheight, xy[0]+(cwidth*end), xy[1]-2);

		glDisable(GL_POLYGON_STIPPLE);
		glDisable( GL_BLEND );
	}
}
Beispiel #28
0
void trend::Tolder::setStipple()
{
   const byte* tellStipple = _drawprop->getCurrentFill();
   if (NULL == tellStipple)
   {
      glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
   }
   else
   {
      byte FlipStillple [128];
      for (word i = 0; i < 32; i++)
         for (word j = 0; j < 4; j++)
            FlipStillple[(31-i)*4 + j] = tellStipple[i*4 + j];
      glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
      glEnable(GL_POLYGON_STIPPLE);
      glPolygonStipple(FlipStillple);
   }
}
Beispiel #29
0
void render()
{   
	GLubyte data[32*4];
	
	for(int i=0;i<32*4;++i)
	{  data[i]=rand();  }
	
	// Lock surface if needed
	if (SDL_MUSTLOCK(screen))
		if (SDL_LockSurface(screen) < 0) 
			return;
	
	// Ask SDL for the time in milliseconds
	int tick = SDL_GetTicks();
	
	glClearColor(1,0,1,0);
	glClear(GL_COLOR_BUFFER_BIT);
	
	// and the mighty triangle....
	glPushMatrix();
	glRotatef(tick*0.01, 0,0,1);
	
	glEnable(GL_POLYGON_STIPPLE);
	
	glPolygonStipple(data);
	
	glBegin(GL_TRIANGLES);						// Drawing Using Triangles
	glVertex3f( 0.0f, 1.0f, 0.0f);				// Top
	glVertex3f(-1.0f,-1.0f, 0.0f);				// Bottom Left
	glVertex3f( 1.0f,-1.0f, 0.0f);				// Bottom Right
	glEnd();	
	
	glPopMatrix();

	glDisable(GL_POLYGON_STIPPLE);

	
	// Unlock if needed
	if (SDL_MUSTLOCK(screen)) 
		SDL_UnlockSurface(screen);
	
	// Tell SDL to update the whole screen
	SDL_UpdateRect(screen, 0, 0, 640, 480);    
}
Beispiel #30
0
static void Init(void)
{
    GLint i;

    if (!rgb) {
	for (i = 0; i < 16; i++) {
	    glutSetColor(i+CI_OFFSET_1, 0.0, 0.0, i/15.0);
	    glutSetColor(i+CI_OFFSET_2, 0.0, i/15.0, 0.0);
	}
    }

    glClearColor(0.0, 0.0, 0.0, 0.0);
    glClearIndex(0.0);

    glPolygonStipple(stippleBits);

    antiAlias = GL_FALSE;
    stipple = GL_FALSE;
}