Game Development Reference
In-Depth Information
using MFC, rather than case statements the Win32 way. Now that we
have our window and can draw a cube, we will experiment with some
alternative ways of viewing the cube.
Highlighting the vertices
In all the examples so far we have drawn the cube using unshaded
polygons; OpenGL has the facility to draw in several different modes. It is
often useful to highlight aspects of an object so that it can be distinguished
from other objects in a scene. This technique is used extensively in
development engines. If we want to highlight the vertices that make up the
cube then we can append the 'DrawCube' function with the following
code:
if (m_drawVertices){
glPointSize(3.0f);
glColor3f(0.5f, 1.0f, 1.0f);
glBegin(GL_POINTS);
glVertex3f(-10.0f, -10.0f, 10.0f);
glVertex3f(10.0f, -10.0f, 10.0f);
glVertex3f(10.0f, 10.0f, 10.0f);
glVertex3f(-10.0f, 10.0f, 10.0f);
Figure 3.4 Cube with vertices highlighted.
 
Search Nedrilad ::




Custom Search