Monday, 10 July 2017

opengl tutorial - basic part 1 (drawing object)



  • glClearColor 0, 0, 0, 0 and  glClear GL_COLOR_BUFFER_BIT Or GL_DEPTH_BUFFER_BIT

this is funtion for clear window
On a computer,memory for displaying images usually filled with images that come from the latest drawing commands, so it needs to be cleared with the background color before it is drawn again. The following example command is used to clean the screen with a black background andbufferwhat will be cleaned. In this case,the buffercolor will be cleared becausethe buffercolor is where the image is stored

  • glColor3f  1, 0, 0

this is func for color spesify RGB
In OpenGL object with a color to describe the object is a process that runs on its own. Before the colors changed, all objects drawn after the command will use the last color contained in the coloring scheme.For color used commands glColor3f . The following example shows the sequence of steps in the process before the object drawn color specifications. Color display is red

  • glFlush

Forcing Process Drawing Up Finish
Most modern graphics systems already using the system graphics pipeline . Where the main CPU give the issue of drawing commands and other hardware that perform transformation, clipping , shading , texturing and others. In the architecture of such processes are not performed on one computer for each computer has its own task. The main CPU does not have to wait for the process on each computer had been completed, but could give the issue a command next picture. For this OpenGL provides commands glFlush which forces the client to immediately send a packet network , although not fully. The program should be written using this command because glFlush not force the process to complete the picture but forces the image to be executed, so that secured all previously drawing commands will be executed within a certain time.


  • glVertex3f  4, 4, 0

To draw a point used an OpenGL commands are: glVertex . This function can have 2 to 4 parameters of various types of data. For example, the command glVertex below will specify a point on the x-axis position 4, 4 axis y and 0 for the z-axis. glVertex3f 4, 4, 0. Now we know how to specify a point in space in OpenGL. Furthermore, that should be added is additional information on that point, if that point the end of a line, or a vertex of a polygon or another, because the definition of the geometric of a vertex is actually not just a dot on the screen but rather a point where there intersection of two lines or curves.

  • glbegin and glend

proces start and end drawing vertex




next tutorial part 2.


                          

No comments:

Post a Comment

Tingkat keanekaragaman hayati tingkat gen

Tingkat keanekaragaman hayati tingkat gen -- Keanekaragaman hayati adalah sebuah istilah untuk menggambarkan keanekaragaman mahluk hidup di ...