This is a variation on an old Putnam problem: "Prove that there are an infinite number of integer triples such that they are consecutive and each can be expressed as the sum of a perfect square." Only difference is, looking for a specific proof, a generator of such triples having a particular form.
Consider the triplet: $$8=2^2+2^2$$ $$9=0^2+3^2$$ $$10=1^2+3^2$$
The first of the triplet must be divisible by 4, in this particular case it's twice a perfect square. More generally we have such a triplet for ordered pair solutions of $1=y^2-2x^2$ where $y$ is the greater of the two.
It can be shown we have a solution if $x=0$ and $y=1$. Further if we have an ordered pair of solutions $(x_n,y_n)$, then $x_{n+1}=3x_n+2y_n$ and $y_{n+1}=4x_n+3y_n$ forms another ordered pair of solutions.
Given this iterative process with some principles from linear algebra, it can be shown that we have the first element of such a triplet $a_n$ when:
$$a_n=\frac{(17+12\sqrt{2})^n+(17-12\sqrt{2})^n-2}{4}$$
It can also be shown that this number is 8 times a triangular number that's also a perfect square, but it's an exponential function, not a polynomial.
We have two questions here. Firstly, do we have a polynomial which can be used to get triplets of consecutive integers that can be expressed as sum of two squares, each? Secondly, which numbers are both triangular and square?
For the first question: \begin{eqnarray} (2n^2+1)^2 -1 & =& \;\;\; (2n^2)^2 \;\;\; + (2n)^2 \\ (2n^2+1)^2 + 0 & =& (2n^2+1)^2 + \;\; 0^2 \\ (2n^2+1)^2 +1 & =& (2n^2+1)^2 + \;\; 1^2 \end{eqnarray} or alternatively \begin{eqnarray} (2n^2+2n)^2 + 0 & =& (2n^2+2n)^2\;\;\;\;\;\; + 0^2 \\ (2n^2+2n)^2 + 1 & =& (2n^2+2n)^2\;\;\;\;\;\; + 1^2 \\ (2n^2+2n)^2 + 2 & =& (2n^2+2n-1)^2 + (2n+1)^2 \end{eqnarray}
Regarding the second question: Here is a proof sketch (!) that the formula $$ a_0 = 0,\; a_1=1,\; a_{n+2} = 34a_{n+1}-a_n+2 $$ which is equivalent with $$ a_n = \frac{\left(17+12\sqrt{2}\right)^n+\left(17-12\sqrt{2}\right)^n-2}{32} $$ gives us all non-negative integers that are both triangular and square.
Let \begin{eqnarray} q_0 & = & 0,\; q_1 = 1,\; q_{n+2} = 6q_{n+1} - q_n \\ t_0 & = & 0,\; t_1 = 1,\; t_{n+2} = 6t_{n+1} - t_n +2 \end{eqnarray} Then $$ q_n^2 = \frac{t_n(t_n+1)}{2} = a_n $$ It can be shown that $t_{n+1}-t_n$ and $q_{n+1}-q_n$ are coprime: $$ (q_{n+1}-q_{n})(2t_n+1)-(t_{n+1}-t_{n})(2q_n)=1 $$ If we connect $(t_n,q_n)$ and $(t_{n+1},q_{n+1})$ with a straight line in the $t$-$q$-plane, then this line has a minimum distance (in $q$-direction) of $1/(t_{n+1}-t_n)$ to any other point with integer coordinates $(t,q)$ and $t_n< t<t_{n+1},$ because $t_{n+1}-t_n$ and $q_{n+1}-q_n$ are coprime.
All the points $(t,q)$ with $q^2 = \frac{t(t+1)}{2}$ lie on a hyperbola. We have to show that the hyperbola does not contain any points with non-negative integer coordinates except $(t_n,q_n),\;n=0,1,2,\ldots$
It can be shown that the maximum distance (in $q$-direction) between the section of the hyperbola that connects $(t_n,q_n)$ and $(t_{n+1},q_{n+1})$ and the straight line that connects $(t_n,q_n)$ and $(t_{n+1},q_{n+1})$ is less than the aforementioned $1/(t_{n+1}-t_n).$ This means that the hyperbola is too far away from all points with integer coordinates between $(t_n,q_n)$ and $(t_{n+1},q_{n+1})$, except for $(t_n,q_n)$ and $(t_{n+1},q_{n+1})$ themselves.