how to bevel the edges of polyon


 
Thread Tools Search this Thread
Top Forums Programming how to bevel the edges of polyon
# 1  
Old 02-13-2010
how to bevel the edges of polyon

Hi i have written the code for star shape object in opengl but i am not able to bevel the edges of the star.COULD SOMEONE KINDLY TELL ME HOW CAN I BEVEL THE EDGES OF THE STAR SHAPE.
Code:
#include <windows.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <freeglut.h>
#include <stdlib.h>
#include <stdio.h>

#define M_PI 3.14




////////////////////////////////////////////////////////////////////

void init(void)
{
	glClearColor(0.0,0.0,0.0,0.0);
	glOrtho(-15,15,-15,15,-5,5);
	glEnable(GL_DEPTH_TEST);
	

}

////////////////////////////////////////////////////////////////////////////
void CreateStar()
{
	int i,j;


	glBegin(GL_TRIANGLE_FAN);
	glVertex3f(0.0,0.0,0.0);

	for(i = 0; i<=13;i++)
	{
		if(i % 2 == 0)
		{
			
			float angle = 2.0 * M_PI *i/12;
			glTexCoord2f(cos(angle)+0.5,sin(angle)+0.5);
			glVertex3f(cos(angle)*1.0,sin(angle)*1.0,0.0);
		}
		else
		{
			float angle = 2.0 * M_PI *i/12;
			glTexCoord2f(cos(angle)+0.5,sin(angle)+0.5);
			glVertex3f(cos(angle)*0.5,sin(angle)*0.5,0.0);
		}

	}
	glEnd();
	glFlush();

}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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

	CreateStar();


}

//////////////////////////////////////////////////////////////////////////////////////////////////







int _tmain(int argc, CHAR* argv[])
{
	glutInit (&argc, argv);
    glutInitDisplayMode (GLUT_SINGLE||GLUT_RGB);
    glutInitWindowSize (500,500);
	glutCreateWindow ("Star Project");
	glutDisplayFunc (display);
	glutMainLoop ();
    return 0;
	
}


Last edited by pludi; 02-13-2010 at 09:26 AM.. Reason: code tags, please...
# 2  
Old 02-21-2010
Maybe like this? Obj file included on this web page

http://3d-in-perl.com/7-pointed-star.html

--kordaff--
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question