This paper describes a novel phase error compensation method for reducing the measurement error caused by nonsinusoidal waveforms in phase-shifting methods. For 3-D shape measurement systems using commercial video projectors, the nonsinusoidal waveform of the projected fringe patterns as a result of the nonlinear gamma of projectors causes significant phase measurement error and therefore shape measurement error. The proposed phase error compensation method is based on our finding that the phase error due to the nonsinusoidal waveform depends only on the nonlinearity of the projector's gamma. Therefore, if the projector's gamma is calibrated and the phase error due to the nonlinearity of the gamma is calculated, a lookup table that stores the phase error can be constructed for error compensation. Our experimental results demonstrate that by using the proposed method, the measurement error can be reduced by 10 times. In addition to phase error compensation, a similar method is also proposed to correct the nonsinusoidality of the fringe patterns for the purpose of generating a more accurate flat image of the object for texture mapping. While not relevant to applications in metrology, texture mapping is important for applications in computer vision and computer graphics.