I don't know how to get this working, but if you figure it out, let me know!
Hi! Teddy On Sun, 27 Mar 2005 03:24:32 -0500, Casey Bodley <[EMAIL PROTECTED]> wrote: > I'm having trouble setting up a perspective projection for drawing to > a hud element. The following code fails to draw anything to the > screen: (I hope the formatting doesn't get fudged beyond recognition) > > void CHudPerspective::Paint() > { > materials->MatrixMode( MATERIAL_PROJECTION ); > materials->PushMatrix(); > materials->LoadIdentity(); > materials->PerspectiveX( 60.0, 1.3333333, 1.0, 100.0 ); > > materials->MatrixMode( MATERIAL_MODEL ); > materials->PushMatrix(); > materials->LoadIdentity(); > > IMesh* pMesh = materials->GetDynamicMesh( true, NULL, NULL, > m_matWhite ); > CMeshBuilder meshBuilder; > > static const unsigned char clr[] = { 255, 0, 0, 255 }; > static const int BOX_SIZE = 10; > > // draw a red box > meshBuilder.DrawQuad( pMesh, > Vector( -BOX_SIZE, BOX_SIZE, 5.0f ).Base(), > Vector( BOX_SIZE, BOX_SIZE, 5.0f ).Base(), > Vector( BOX_SIZE, -BOX_SIZE, 5.0f ).Base(), > Vector( -BOX_SIZE, -BOX_SIZE, 5.0f ).Base(), clr, true ); > > pMesh->Draw(); > > materials->PopMatrix(); > > materials->MatrixMode( MATERIAL_PROJECTION ); > materials->PopMatrix(); > } > > Replacing PerspectiveX() with Ortho() results in the box drawing > normally. Has anyone had success using PerspectiveX()? I'd love to > see an example, since the only code in the SDK that uses it is in the > utils\hlmviewer project. > > Cheers, > Casey > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, please > visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders