Ok, here is some code used in generating a quad strip with many sections. How could I texture it? Is there any way to place the texture over every 20 strips instead of eachone? Is it not possible the way I have it drawn? I cant think of any way to do this. Its modeling the bending of a beam with an end load:
glBegin(GL_QUAD_STRIP); do{ x=L*(i/500); i++; incx=(x+(L/500)); w=5*((P*x*x)*((3*L)-x))/(6*E*I); //beam deflection equation for end load theta=atan2(-w,incx); //angle caused by deflection /**begin translation and rotation**/ GLfloat savx=oldx; GLfloat savwp=-oldw+(m_height/2); GLfloat savwn=-oldw-(m_height/2); //move to origin savx=savx-oldx; savwp=savwp+oldw; savwn=savwn+oldw; //rotate about z axis GLfloat xp1= savx*cos(theta)-savwp*sin(theta); GLfloat yp1= savx*sin(theta)+savwp*cos(theta); GLfloat xp2= savx*cos(theta)-savwn*sin(theta); GLfloat yp2= savx*sin(theta)+savwn*cos(theta); //move back to original coordinates xp1=xp1+oldx; yp1=yp1-oldw; xp2=xp2+oldx; yp2=yp2-oldw; /**end translation and rotation**/ if(side==1){ glNormal3d(0.0,0.0,1.0); glVertex3f(xp1,yp1,m_width/2); glVertex3f(xp2,yp2,m_width/2);} if(side==2){ glNormal3d(0.0,0.0,-1.0); glVertex3f(xp2,yp2,-m_width/2); glVertex3f(xp1,yp1,-m_width/2);} if(side==3){ glNormal3d(0.0,1.0,0.0); glVertex3f(xp1,yp1,-m_width/2); glVertex3f(xp1,yp1,m_width/2);} if(side==4){ glNormal3d(0.0,-1.0,0.0); glVertex3f(xp2,yp2,m_width/2); glVertex3f(xp2,yp2,-m_width/2);} GLfloat var1=(incx-oldx); GLfloat var2=(w-oldw); GLfloat dx2=var1*var1; GLfloat dy2=var2*var2; length=length+(sqrt(dx2+dy2)); //actual length of beam endx=oldx; oldx=incx; endw=oldw; oldw=w; }while(length<=L && length>0); //draw strips until section is L units long glEnd();
It a do while loop to preserve the actual length of the quad strip as it bends and rotates. I need 500 or more so the strip looks like a curve. Any ideas?