以下は、NEHE Production(レッスン25)からコピーしたコードの全長です。 私はちょうど遊んでいましたが、各ポイントを変更することはできません。個々の球も円柱もありません。
どういうわけか私の調整をしたときに、それらは想定されている方法で配置されず、回転しません。
このチュートリアルでは、後でライトを追加する予定です。ポイントをシェイプに変換するのに助けが必要
感謝=]
int InitGL(GLvoid)
{
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearDepth(1.0);
glDepthFunc(GL_LESS);
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_SMOOTH);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
maxver=0;
objload("data/sphere.txt",&morph1);
objload("data/torus.txt",&morph2);
objload("data/Tube.txt",&morph3);
objallocate(&morph4,10300);
for(int i=0;i<10300;i++)
{
morph4.points[i].x=((float)(rand()%14000)/1000)-7;
morph4.points[i].y=((float)(rand()%14000)/1000)-7;
morph4.points[i].z=((float)(rand()%14000)/1000)-7;
}
objload("data/Tube.txt",&helper);
sour=dest=&morph1;
return TRUE;
}
void DrawGLScene(GLvoid)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(cx,cy,cz);
glRotatef(xrot,1,0,0);
glRotatef(yrot,0,1,0);
glRotatef(zrot,0,0,1);
xrot+=xspeed; yrot+=yspeed; zrot+=zspeed;
GLfloat tx,ty,tz;
VERTEX q;
glPointSize(2.0f);
//glBegin(GL_POINTS);
for(int i=0;i<morph3.verts;i++)
{
if(morph)
q=calculate(i);
else
q.x=q.y=q.z=0;
helper.points[i].x-=q.x;
helper.points[i].y-=q.y;
helper.points[i].z-=q.z;
tx=helper.points[i].x;
ty=helper.points[i].y;
tz=helper.points[i].z;
glColor3f(0,1,1);
glPushMatrix(); //i have modified this part onwards
gltranslaste(tx,ty,tz);
glutSolidSphere(2,6,6);
glPopMatrix();
/*glVertex3f(tx,ty,tz);
glColor3f(0,0.5f,1);
tx-=2*q.x; ty-=2*q.y; ty-=2*q.y;
glVertex3f(tx,ty,tz);
glColor3f(0,0,1);
tx-=2*q.x; ty-=2*q.y; ty-=2*q.y;
glVertex3f(tx,ty,tz);*/
}
//glEnd();
if(morph && step<=steps)
step++;
else
{
morph=FALSE; sour=dest; step=0;
}
}
あなたの質問を編集して、すべてのコードをさらに4スペース分インデントする必要があります。そのようにすれば、すべてが1つのブロックに正しく表示されます。 – Beska
正規表現がゴールドに置換される場所( "; \ s \ s +") –
Applaud @ LFSRは私がコミットしたいと思っている以上の仕事をしています! –