Graphics Reference
In-Depth Information
void CGrfxWindowOGL::OnPaint() {
.
C1: with the selected render buffer set the render state and matrix processors.
Step 2: initialize selected hardware and set the coordinate system parameters.
glDisable( GL _ CULL _ FACE );
Source file.
GrfxWindowOGL.cpp file in
the GrfxWindow folders of the
OGL _ Rectangles2D project.
.
glMatrixMode(GL _ MODELVIEW);
glLoadIdentity();
glMatrixMode(GL _ PROJECTION);
glTranslated(-1.0, -1.0, 0.0);
.
C2: Send drawing commands to the RC (render context: m_hRenderContext ).
.
Step 3: clear drawing buffer and draw two squares.
.
glBegin(GL _ QUADS);
.
glVertex3d(160,122,0); // The vertices of the large square
.
glEnd();
Listing 4.2. Re-examine drawing with OpenGL (Tutorial 3.2).
The four-step drawing procedure we derived from Tutorials 3.1 and 3.2 (List-
ings 3.3 and 3.4) implements (C). For example, if we include comments from the
GHC/RC framework in the D3D drawing routine ( CGrfxWndD3D::OnPaint() ),
we get Listing 4.1. We observe the following.
• C1 maps nicely to Step 2 of the drawing procedure. At this point, although
we still do not know what a D3DRS _ LIGHTING is, we do know that it is per
graphics device. In addition, we see that the D3D graphics device has three
matrix processors: WORLD , VIEW ,and PROJECTION . We observe that in our
drawing, we only programmed the VIEW processor with the w2n matrix and
left the other two processors initialized to identity.
• C2 is simply Step 3 of the four-step drawing procedure. In the case of the
D3D API, DrawPrimitiveUP() is the drawing command. We see explicit
Search WWH ::




Custom Search