hi everyone,
i am a c++ and opengl learner, so any help/idea/advice/suggestion would be appreciated a lot.
here is the problem; I am trying to get some information from a text file in order to draw some shapes, according to latest test which i tried for my code it is working and getting data from the file correctly, however , it is not drawing anything, and i do not know why… here is the some piece of the code::
void twoPoints(double **s,int numpo)//i am using this //method,in order to get two points’ coordinates from the file
{
double **copy;
copy= new double *[numpo];
for(int i=0;i<numpo;i++)
{
copy[i]=new double [3];
copy[i][0]=s[i][0];
copy[i][1]=s[i][1];
copy[i][2]=s[i][2];
}
for(int i=0;i<numpo;i++)
{
a0=copy[i][0];
b0=copy[i][1];
a1=copy[i+1][0];
b1=copy[i+1][1];
/*cout<<a0<<" "<<b0<<endl;
cout<<a1<<" "<<b1<<endl;*/
drawLine();
}
}
void drawLine()
{
glPointSize(posize);
/glBegin(GL_POINTS);/
GLdouble x0=a0,y0=b0,x1=a1,y1=b1,x, y, d, m, deltax, deltay, tempx, tempy;
deltax = x1-x0;
deltay = y1-y0;
//=========some conditions… this part is long…==== then
if( m == 1) // case 1: 0 <= m <= 1
{
y = y0;
d = 2*(y0-y1)*(x0+1) + (x1-x0)*(2*y0+1) + 2*x0*y1 - 2*x1*y0;
glBegin(GL_POINTS);
for( x = x0; x <= x1; x++)
{
glVertex2d(x, y);
if(d < 0)
{
y = y + 1;
d = d + 2*(x1 - x0) + 2*(y0 - y1);
}
else
d = d + 2*(y0-y1);
}
glEnd();
}
//========other conditions…then
glFlush();
}
//====then main…
when it runs, it gives information box with this: “programName.exe has stopped , a problem caused the program to stop correctly…”
can someone tell me what i am doing wrong?