I'm drawing everything to a sf::RenderTexture specifically so a shader has access to what's drawn on screen for further blending. Then I loop again to draw everything to the window (post shader stuff).
My game uses depth sorting. I've tried with and without the pushGLStates()/popGLStates(). Without them, nothing is drawn (to the render texture) that requires depth sorting. With them, everything appears but is not sorted properly.
For sf::RenderWindow, call push/popGlStates() are not necessary. The pure gl() functions work as is.
Does the sf::RenderTexture texture size need to match the world size (as opposed to the window size)? Are there any key differences between sf::RenderWindow and sf::RenderTexture?
for( VertexLevel vertex : *drawPtr ) {
if( cameraState_ == CameraState::ISOMETRIC_60D ) {
glEnable(GL_DEPTH_TEST);
glEnable( GL_ALPHA_TEST );
app->pixelBuffer_.pushGLStates(); // sf::RenderTexture
app->pixelBuffer_.draw( app->vtexMap_.at( vertex ), app->renderMap_.at( vertex ) );
app->pixelBuffer_.popGLStates();
glDisable( GL_DEPTH_TEST );
glDisable( GL_ALPHA_TEST );
}
}
app->pixelBuffer_.display();
app->testShader_.setUniform( "bufferTexture", app->pixelBuffer_.getTexture() );