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;
}