Hi everyone,
Recently, I tried to use the SFML port for Android, and I tried to use OpenGL ES code in order to do some 3D rendering on my phone.
For the moment, I'm just trying to draw a cube with different colors for each face, but I seem to have a problem with the depth buffer. It seems that, even though I try to create a window with a depthBits of 24, when my window is created, the depthBits is 0, and I guess that's why my depth buffer doesn't work.
Here is my minimal example :
#include <SFML/Graphics.hpp>
#include <SFML/OpenGL.hpp>
#include <android/log.h>
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG , "MyApp", __VA_ARGS__)
int main(int argc, char *argv[])
{
sf::ContextSettings settings(24, 8, 0, 1, 1);
sf::RenderWindow window(sf::VideoMode::getDesktopMode(), "", sf::Style::Default, settings);
LOGD("OpenGL Version : %s", glGetString(GL_VERSION));
LOGD("DepthBits = %d", window.getSettings().depthBits);
return 0;
}
My output is
D/MyApp (22428): OpenGL Version : OpenGL ES-CM 1.1
D/MyApp (22428): DepthBits = 0
I have seen that the
the tutorials say that
OpenGL versions above 3.0 are supported by SFML (as long as your graphics driver can handle them), but you can't set flags for now. This means that you can't create debug or forward compatible contexts; in fact SFML automatically creates contexts with the "compatibility" flag, because it uses deprecated functions internally. This should be improved soon, and flags will then be exposed in the public API.
Is this the cause of my problems ? Is there any way to enable the depth buffer on Android ?
Thank you !