open (jsyeh/3dcg10)>download>data,window32,glut32>
>extract window 32 file
>extract data file into window 32
>place glut 32 into window 32
open transformation app>to do swap change
>on command window right click open the small window to do swap change

1-02 figure rotate

case a translate/rotate
>the translate
>rotate
>
case b rotate/translate
>the object will bigger on right side
>camera moved
classwork 02
\\>>rotate in OpenGL
glPushMatrix();
glRotatef(rotX,0,1,0);//設x為水平線
int main(int argc,char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("hello 3d");
glutDisplayFunc(display);
glutMotionFunc(motion);//開啟旋轉
Question 1:
BUFFER-
>>ome block of memory. People tend to use the word "buffer" when talking about moving data around,
>>because the data will be placed in the buffer, then placed in its final destination.
Question 2:>>glPushMatrix(); //push =back up //backup matrix (translate,rotate,scale)
>>glPopMatrix();//pop =recover to default
>>As the name implies, a double has 2x the precision of flaot
classwork 03
x,y rotate

>>float rotX=0,rotY=0; //宣告一個浮點單位
>>glRotatef(rotX,0,1,0);//設x為水平線
>>glRotatef(rotY,1,0,0);//Y的移動量,讓它對Y軸轉
>>void motion(int x,int y)
{
rotX=x;
rotY=y;
display();
}
>>glutInitWindowSize(300,450);//窗口大小
>>glutInitWindowPosition(300,400);//窗口位置
沒有留言:
張貼留言