added a test for compatibility
This commit is contained in:
parent
9c2c8315b0
commit
de4936399e
@ -9,24 +9,29 @@
|
|||||||
|
|
||||||
bool SparrowRenderer::modernOpenglAvailable = false;
|
bool SparrowRenderer::modernOpenglAvailable = false;
|
||||||
|
|
||||||
void SparrowRenderer::initGL(int width, int height)
|
void SparrowRenderer::initGL(int width, int height, bool forceCrappy)
|
||||||
{
|
{
|
||||||
glewExperimental = GL_TRUE;
|
glewExperimental = GL_TRUE;
|
||||||
GLenum err = glewInit();
|
GLenum err = glewInit();
|
||||||
if (GLEW_OK != err)
|
if (GLEW_OK != err)
|
||||||
fprintf(stderr, "Warning: glewInit failed!\n");
|
fprintf(stderr, "Warning: glewInit failed!\n");
|
||||||
if (!GLEW_ARB_vertex_program ||
|
if (!forceCrappy &&
|
||||||
!GLEW_ARB_fragment_program ||
|
GLEW_ARB_vertex_program &&
|
||||||
!GLEW_ARB_texture_float ||
|
GLEW_ARB_fragment_program &&
|
||||||
!GLEW_ARB_draw_buffers ||
|
GLEW_ARB_texture_float &&
|
||||||
!GLEW_ARB_framebuffer_object ||
|
GLEW_ARB_draw_buffers &&
|
||||||
!glewIsSupported("GL_VERSION_3_3"))
|
GLEW_ARB_framebuffer_object &&
|
||||||
|
glewIsSupported("GL_VERSION_3_3") &&
|
||||||
|
GLEW_VERSION_3_3)
|
||||||
|
{
|
||||||
|
modernOpenglAvailable = true;
|
||||||
|
printf("Modern OpenGL available.\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
modernOpenglAvailable = false;
|
modernOpenglAvailable = false;
|
||||||
fprintf(stderr, "Warning: modern OpenGL not supported!\nEnabling fallback crappy rendering mode\n");
|
fprintf(stderr, "Warning: modern OpenGL not supported!\nEnabling fallback crappy rendering mode\n");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
modernOpenglAvailable = true;
|
|
||||||
|
|
||||||
std::cout << "OpenGL version " << glGetString(GL_VERSION) << std::endl;
|
std::cout << "OpenGL version " << glGetString(GL_VERSION) << std::endl;
|
||||||
std::cout << "GLSL version " << glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl;
|
std::cout << "GLSL version " << glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl;
|
||||||
|
@ -11,7 +11,7 @@ class SparrowRenderer
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// main methods
|
// main methods
|
||||||
void initGL(int width, int height);
|
void initGL(int width, int height, bool forceCrappy = false);
|
||||||
void destroyGL();
|
void destroyGL();
|
||||||
void resizeGL(int width, int height);
|
void resizeGL(int width, int height);
|
||||||
void renderGL();
|
void renderGL();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user