Based on hp-adaptive pseudospectral method, this paper presents a new optimal control method to solve the rapid gliding trajectory optimization. In order to meet the speed and precision requirements, this new theory combines the global pseudospectral method with the finite element method, adopts double layer optimization strategy to adjust adaptively the segment breaks and the polynomial degree in each segment. The simulation based on hp-adaptive pseudospectral method is carried out, the result is validated by Pontryagin minimum principle, and compared with the result of Gauss pseudospectral method. The results show that the algorithm is robust, has fast convergence and not sensitive to the initial control values. The method in this paper has a great value in the practical applications.