Draw coordinate lines in OpenGL

In this post, we will draw some lines to illustrate the 3D coordinate . The red line ... drawCoordinates(){ // draw some lines glColor3f(1.0,0.0,0.0); // red x glBegin(GL_LINES); // x aix ... and arrow represent x axis, green lines represent y axis, blue represent z axis. glColor3f(1.0,0.0,0.0 ... , 0.0f ,4.0f ); glVertex3f(0.0, -1.0f ,3.0f ); glEnd(); glFlush(); The following code draw

glClear reference

Usually , the glClear is the first function call in your display function. Before any pixel is write to the screen, the screen has to be prepared, for example set the background color. Actually, glClear will use a color specified by glClearColor() to clear the screen, its like set the background color of the canvas.

Vertex buffer object and glGenBuffersARB

The glGenBuffersARB create a new vertex buffer object and return the ID of the vbo to a local variable.

First parameter is the number of buffers needs to be created.

glDrawBuffer

void glDrawBuffer(GLenum mode);

Specify, Select which color buffers are to be drawn into.

What is Write-Combined memory

Write-Combining can batches writes to the same cache line so they can be transferred in a single bus clock.

The data will be combined and stored in the write combine buffer, and then write is in burst mode.

Vertex array and indexes and Vertex Buffer Object(VBO)

The most obvious reason is that if an entity consist of many polygons , the adjacent polygons will share a lot of vertexes , if every polygons has it own vertexes, there will be a lot of redundant data.

The second reason is that dealing with every individual vertex separately are wasteful. Vertex arrays allows you to send vertex data in sets instead of individually.This can improve the performance. OpenGL can process an array of vertexes with just one function call.

The second reason is that dealing with every individual vertex separately are wasteful. Vertex arrays allows you to send vertex data in sets .