Home | History | Annotate | Download | only in src
      1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // Adapted from the javascript implementation upon WebGL by kwaters@.
      6 
      7 #ifndef SHADER_H_INCLUDED
      8 #define SHADER_H_INCLUDED
      9 
     10 #include <GLES2/gl2.h>
     11 
     12 #include "matrixop.h"
     13 
     14 typedef struct {
     15     // program
     16     GLuint program;
     17     // attribute
     18     GLint pos;
     19     GLint normal;
     20     GLint colorIn;
     21     // uniform
     22     GLint mvp;
     23     GLint normalMatrix;
     24     GLint ambient;
     25     GLint shininess;
     26     GLint light_0_direction;
     27     GLint light_0_diffuse;
     28     GLint light_0_specular;
     29     GLint light_1_direction;
     30     GLint light_1_diffuse;
     31     GLint light_2_direction;
     32     GLint light_2_diffuse;
     33 } SHADERLIT;
     34 
     35 typedef struct {
     36     // program
     37     GLuint program;
     38     // attribute
     39     GLint pos;
     40     GLint colorIn;
     41     // uniform
     42     GLint mvp;
     43 } SHADERFLAT;
     44 
     45 typedef struct {
     46     // program
     47     GLuint program;
     48     // attribute
     49     GLint pos;
     50     // uniform
     51     GLint minFade;
     52 } SHADERFADE;
     53 
     54 extern Matrix4x4 sModelView;
     55 extern Matrix4x4 sProjection;
     56 
     57 extern SHADERLIT sShaderLit;
     58 extern SHADERFLAT sShaderFlat;
     59 extern SHADERFADE sShaderFade;
     60 
     61 extern int initShaderPrograms();
     62 extern void deInitShaderPrograms();
     63 extern void bindShaderProgram(GLuint program);
     64 
     65 #endif  // SHADER_H_INCLUDED
     66 
     67