aboutsummaryrefslogtreecommitdiff
path: root/src/render/jsl.h
blob: 857381c52b4ec4a9aa3a8a824b18a31acf731381 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef __JIN_JSL_H
#define __JIN_JSL_H
#include <string>
#include <map>
#include "image.h"
#include "libs/GLee/GLee.h"
namespace jin
{
namespace render
{
    /**
    * A JSL program for shadering textures which is 
    * actually a glsl program.
    */
    class JSLProgram
    {
    public:

        void init(const char* program);

        void use();
        
        static void unuse();

        void sendFloat(const char* name, float number);
        void sendImage(const char*  name, const Image* image);
        //void sendMatrix(const char*  name, int size, const GLfloat* m, int count);
        //void sendCanvas(const char* name, const Canvas& canvas);

    private:
        JSLProgram();

        // only id for identify glsl program
        GLuint pid; 

        static GLint _current_texture_unit;
        static GLint _max_texture_units;
        static std::map<std::string, GLint> _texture_unit_pool;
        static GLint getTextureUnit(const std::string& name);
    };
}
}

#endif