COMPUTER GRAPHIC
In today's computer graphics, we used openGL to draw lines, triangles, quads and a final product. I did not really do a good job so I intended to go home and further improve.
LINES
The belowing codes is the one I added the function(GL_LINES) to draw the lines.
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(200.0f, 200.0f, 0.0f);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(-200.0f, -200.0f, 0.0f);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(-200.0f, 200.0f, 0.0f);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(200.0f, -200.0f, 0.0f);
The product is the following:
TRIANGLES
The belowing codes is the one I added the function(GL_TRIANGLE) to draw the triangle.
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(200.0f, -200.0f, 0.0f);
glVertex3f(200.0f, 200.0f, 0.0f);
The product is the following:
QUADS
The belowing codes is the one I added the function(GL_QUADS) to draw the quad.
glVertex3f(-0.25,0.25,0);
glVertex3f(-0.25,-0.25,0.0);
glVertex3f(0.25,-0.25,0.0);
glVertex3f(0.25,0.25,0.0);
The product is the following:
FINAL WORK
This is just something that I created without an idea, but it is still SOMETHING alright?
The only thing that people need to take note is:
1) The colour varies from 0 - 1.
2) Positions of the pixel varies from -1 to 1, where the middle is considered 0.
No comments:
Post a Comment