tavli

diff src/game.cc @ 16:d6209903454b

opengl capabilities
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 28 Jun 2015 08:48:25 +0300
parents b1a195c3ee16
children 16a420432aa3
line diff
     1.1 --- a/src/game.cc	Sun Jun 28 08:34:24 2015 +0300
     1.2 +++ b/src/game.cc	Sun Jun 28 08:48:25 2015 +0300
     1.3 @@ -1,5 +1,5 @@
     1.4  #include <stdio.h>
     1.5 -#include <GL/glew.h>
     1.6 +#include "opengl.h"
     1.7  #include "game.h"
     1.8  #include "board.h"
     1.9  #include "scenery.h"
    1.10 @@ -21,23 +21,32 @@
    1.11  
    1.12  bool game_init()
    1.13  {
    1.14 +	if(init_opengl() == -1) {
    1.15 +		return false;
    1.16 +	}
    1.17 +
    1.18  	glEnable(GL_DEPTH_TEST);
    1.19  	glEnable(GL_CULL_FACE);
    1.20  	glEnable(GL_NORMALIZE);
    1.21  	glEnable(GL_LIGHTING);
    1.22  	glEnable(GL_LIGHT0);
    1.23  
    1.24 -	if(GLEW_ARB_multisample) {
    1.25 +	if(glcaps.sep_spec) {
    1.26 +		glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
    1.27 +	}
    1.28 +
    1.29 +	if(glcaps.fsaa) {
    1.30  		glEnable(GL_MULTISAMPLE);
    1.31  	}
    1.32  
    1.33 -	Mesh::use_custom_sdr_attr = false;
    1.34 -
    1.35 -	if(!(sdr_phong = create_program_load("sdr/phong.v.glsl", "sdr/phong.p.glsl"))) {
    1.36 -		return false;
    1.37 -	}
    1.38 -	if(!(sdr_phong_notex = create_program_load("sdr/phong.v.glsl", "sdr/phong-notex.p.glsl"))) {
    1.39 -		return false;
    1.40 +	if(glcaps.shaders) {
    1.41 +		Mesh::use_custom_sdr_attr = false;
    1.42 +		if(!(sdr_phong = create_program_load("sdr/phong.v.glsl", "sdr/phong.p.glsl"))) {
    1.43 +			return false;
    1.44 +		}
    1.45 +		if(!(sdr_phong_notex = create_program_load("sdr/phong.v.glsl", "sdr/phong-notex.p.glsl"))) {
    1.46 +			return false;
    1.47 +		}
    1.48  	}
    1.49  
    1.50  	if(!board.init()) {