You are on page 1of 4

Faculty of Computer Science and Engineering

Department of Computer Science

Bi tp 1
Lu : Tt c cc bi tp u phi VIT TAY
Cu 1:
i)

ii)

iii)

iv)

b = 18, khng c LUT


B m: 18 bit
Dung lng b m: 102476818 = 14155776 bit = 1769472 bytes
b = 18, w = 21
B m: 18 bit
LUT : 21 bit
Dung lng b m: 102476818 = 14155776 bit = 1769472 bytes
Dung lng LUT: 21821 = 5505024 bit = 688128 bytes
b = 8, w = 24
B m: 8 bit
LUT: 24 bit
Dung lng b m: 10247688 = 6291456 bit = 786432 bytes
Dung lng LUT: 2824 = 6144 bit = 768 bytes
b = 6, khng c LUT
B m: 6 bit
Dung lng b m: 10247686 = 4718592 bit = 589824 bytes

Cu 2:
a) Thi gian c 1 pixel: T = 1/(721280960) (s) = 11.303 ns
b) Thi gian c 1 pixel: T = 1/((60/2)800600) (s) = 694.4 ns
Cu 3: V cc i tng c bn ca OpenGL
Gi tr nScale c gn ty phng to hnh nh.
a)
glBegin(GL_TRIANGLES);
glVertex2i(10*nScale, 10*nScale); //v0
glVertex2i(40*nScale, 10*nScale); //v2
glVertex2i(20*nScale, 30*nScale); //v1
glVertex2i(60*nScale, 20*nScale); //v3
glVertex2i(90*nScale, 30*nScale); //v4
glVertex2i(70*nScale, 50*nScale); //v5
1

Faculty of Computer Science and Engineering


Department of Computer Science
glEnd();
b)
glBegin(GL_TRIANGLE_STRIP);
glVertex2i(10*nScale, 10*nScale); //v0
glVertex2i(20*nScale, 30*nScale); //v1
glVertex2i(40*nScale, 10*nScale); //v2
glVertex2i(70*nScale, 50*nScale); //v5
glVertex2i(60*nScale, 20*nScale); //v3
glVertex2i(90*nScale, 30*nScale); //v4
glEnd();
c)
glBegin(GL_TRIANGLE_FAN);
glVertex2i(70*nScale, 50*nScale); //v5
glVertex2i(20*nScale, 30*nScale); //v1
glVertex2i(10*nScale, 10*nScale); //v0
glVertex2i(40*nScale, 10*nScale); //v2
glVertex2i(60*nScale, 20*nScale); //v3
glVertex2i(90*nScale, 30*nScale); //v4
glEnd();
d)
glBegin(GL_TRIANGLE_STRIP);
glVertex2i(10*nScale, 10*nScale); //v0
glVertex2i(40*nScale, 10*nScale); //v2
glVertex2i(20*nScale, 30*nScale); //v1
glVertex2i(60*nScale, 20*nScale); //v3
glVertex2i(70*nScale, 50*nScale); //v5
glVertex2i(90*nScale, 30*nScale); //v4
glEnd();
e)
glBegin(GL_QUAD_STRIP);
glVertex2i(10*nScale, 10*nScale); //v0
glVertex2i(40*nScale, 10*nScale); //v2
glVertex2i(20*nScale, 30*nScale); //v1
glVertex2i(60*nScale, 20*nScale); //v3
glVertex2i(70*nScale, 50*nScale); //v5
glVertex2i(90*nScale, 30*nScale); //v4

Faculty of Computer Science and Engineering


Department of Computer Science
glEnd();

Cu 4: V cc i tng c bn ca OpenGL
a)
glBegin(GL_LINE_LOOP);
glVertex2i(450, 500); //v0
glVertex2i(495, 362); //v1
glVertex2i(640, 362); //v2
glVertex2i(523, 276); //v3
glVertex2i(568, 138); //v4
glVertex2i(450, 224); //v5
glVertex2i(332, 138); //v6
glVertex2i(377, 276); //v7
glVertex2i(260, 362); //v8
glVertex2i(405, 362); //v9
glEnd();
b)
v0 = 300, 400
v8 = 473, 300
v1 = 387, 350
v9 = 473, 200
v2 = 387, 250
v10 = 387, 150
v3 = 300, 200
v11 = 213, 150
v4 = 213, 250
v12 = 127, 200
v5 = 213, 350
v13 = 127, 300
v6 = 300, 500
v14 = 213, 450
v7 = 387, 450
bn trong du ngoc l ta ca cc nh
glBegin(GL_LINE_LOOP);
glVertex2i(...); //v3
glVertex2i(...); //v2
glVertex2i(...); //v7
glVertex2i(...); //v6
glVertex2i(...); //v14
glVertex2i(...); //v4
glVertex2i(...); //v3
glVertex2i(...); //v10
glVertex2i(...); //v9
glVertex2i(...); //v8
glVertex2i(...); //v0
glVertex2i(...); //v13
3

Faculty of Computer Science and Engineering


Department of Computer Science
glVertex2i(...); //v12
glVertex2i(...); v11
glEnd();
glBegin(GL_LINES);
glVertex2i(...); //v0
glVertex2i(...); //v6
glVertex2i(...); //v2
glVertex2i(...); //v9
glVertex2i(...); //v4
glVertex2i(...); //v12
glEnd();
c)
v0 = 300, 300
v1 = 300, 500
v2 = 326, 315
v3 = 473, 200
v4 = 300, 270
v5 = 127, 200
v6 = 274, 315
glBegin(GL_TRIANGLE_FAN);
glVertex2i(...); //v0
glVertex2i(...);//v1
glVertex2i(...);//v2
glVertex2i(...);//v3
glVertex2i(...);//v4
glVertex2i(...);//v5
glVertex2i(...);//v6
glVertex2i(...);//v1
glEnd();
-Ht-