Opengl GLGS:我该怎么做;“连接”;纹理的采样器?

Opengl GLGS:我该怎么做;“连接”;纹理的采样器?,opengl,glsl,geometry-shader,Opengl,Glsl,Geometry Shader,我试图从几何体着色器中的3D纹理中读取: #version 150 layout(points) in; // origo of cell layout(points, max_vertices = 1) out; uniform sampler3D text; void main (void) { for(int i = 0; i < gl_in.length(); ++i) { // texture coordinates:

我试图从几何体着色器中的3D纹理中读取:

#version 150

layout(points) in; // origo of cell
layout(points, max_vertices = 1) out;

uniform sampler3D text;

void main (void) 
{   
    for(int i = 0; i < gl_in.length(); ++i)
    {
        // texture coordinates:
        float u, v, w;

        // set u, v, and w somehow
        ...

        float value = texture(text, vec3(u, v, w)).r;

        bool show;

        // set show based on value somehow:
        ...

        if(show) {      
            gl_Position = gl_in[i].gl_Position;
            EmitVertex();
            EndPrimitive();  
        }  
    }
}
但是如何将几何体着色器中的采样器“文本”与我的纹理相关联?

到目前为止,我还没有告诉OpenGL有一个名为“文本”的采样器,它将对纹理进行采样

编辑:我尝试了以下方法:

GLint textLoc = glGetUniformLocation(program, "text");
glUniform1i(textLoc, 0); // sends 0 to "text" in shader
// why do I not just hardcode 0 inside the geometry shader instead ? 
glBindTexture(GL_TEXTURE_3D , texture); 
glActiveTexture(GL_TEXTURE0); // same as 0 ?
GLuint sampler_state = 0;
glGenSamplers(1, &sampler_state);
glBindSampler(0, sampler_state); // what does this do?

这里出了什么问题?

My compiler(VS2008)给了我:错误C3861:“glBindSampler”:找不到标识符。我包括“GLee.h”和“glut.h”。我在哪个.h文件中找到glBindSampler?解决了它。包括glew.h而不是GLee.h(并链接到glew32.lib)。看起来glew和GLee是相互排斥的,并且做着同样的事情,但是glew更符合时代?
GLint textLoc = glGetUniformLocation(program, "text");
glUniform1i(textLoc, 0); // sends 0 to "text" in shader
// why do I not just hardcode 0 inside the geometry shader instead ? 
glBindTexture(GL_TEXTURE_3D , texture); 
glActiveTexture(GL_TEXTURE0); // same as 0 ?
GLuint sampler_state = 0;
glGenSamplers(1, &sampler_state);
glBindSampler(0, sampler_state); // what does this do?