2016-07-01 2 views
0

내가하여 컨텍스트를 만들 GLSL 때 나는 하나 개의 확장 EXT_texture_compression_s3tc와 OpenGL을 3.3 핵심 정보에 대한 glLoadGen으로 확장을로드하고있어오류 컴파일 쉐이더 3.30

new sf::Window(sf::VideoMode(800, 600), "OpenGL", 
              sf::Style::Default, 
              sf::ContextSettings(24, 8, 0, 3, 3, sf::ContextSettings::Core))); 

. 내가 쉐이더를 컴파일있을 때 :

ERROR: Shader compilation error at shader: "media/shaders/shader.vs.glsl" 
0:7(1): error: uniform explicit location requires GL_ARB_explicit_uniform_location and either GL_ARB_explicit_attrib_location or GLSL 3.30. 
0:8(1): error: uniform explicit location requires GL_ARB_explicit_uniform_location and either GL_ARB_explicit_attrib_location or GLSL 3.30. 
0:9(1): error: uniform explicit location requires GL_ARB_explicit_uniform_location and either GL_ARB_explicit_attrib_location or GLSL 3.30. 

하지만 OpenGL을 3.3 (3.30 그래서 GLSL)이 있습니다

#version 330 core 

layout (location = 0) in vec3 vertPos; 

layout (location = 5) uniform mat4 modelMat; 
layout (location = 6) uniform mat4 viewMat; 
layout (location = 7) uniform mat4 projectionMat; 

out vec4 fragColor; 

void main() 
{ 
    gl_Position = projectionMat * viewMat * modelMat * vec4(vertPos, 1.0); 
    fragColor = vec4(0.5, 0.5, 0.5, 1.0); 
} 

``

#version 330 core 

in vec4 fragColor; 
out vec4 outColor; 

void main() 
{ 
    outColor = fragColor; 
} 

나는 오류 문자열을 얻을. glxinfo 지문 :

Extended renderer info (GLX_MESA_query_renderer): 
    Vendor: X.Org (0x1002) 
    Device: AMD JUNIPER (DRM 2.43.0, LLVM 3.8.0) (0x68be) 
    Version: 11.2.0 
    Accelerated: yes 
    Video memory: 512MB 
    Unified memory: no 
    Preferred profile: core (0x1) 
    Max core profile version: 3.3 
    Max compat profile version: 3.0 
    Max GLES1 profile version: 1.1 
    Max GLES[23] profile version: 3.0 
OpenGL vendor string: X.Org 
OpenGL renderer string: Gallium 0.4 on AMD JUNIPER (DRM 2.43.0, LLVM 3.8.0) 
OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.2.0 
OpenGL core profile shading language version string: 3.30 
OpenGL core profile context flags: (none) 
OpenGL core profile profile mask: core profile 
OpenGL core profile extensions: 

그래서 나는 수 사용 GLSL 3.30이어야한다.

+0

: 당신은 3.30 쉐이더로 유지하기를 원하며 (대신 AMD의 드라이버의 오픈 소스 드라이버를 사용하고 있기 때문에) 확장으로 사용할 경우, 당신은 #version 선언 아래 extension declaration가 필요합니다 'GL_ARB_explicit_uniform_location' 확장이 실제로 존재합니까? 오류 메시지의 표현에서 glsl 3.30이 사용 가능할지라도 추측하고 있습니다. –

+0

사용 가능 합니다만, 메시지는'GLSL 3.30'이나'OpenGL core profile shading language version string : 3.30'을 가지고 있습니다. – bajos

답변

0

당신은 #version 330 core 아래의 확장을 가능하게하는 다음 줄을 추가 시도 할 수 :

#extension GL_ARB_explicit_uniform_location : require 
3

쉐이더에서 균일 한 위치를 지정하는 기능은 OpenGL을 버전 3.3 또는 GLSL 버전 3.30의 일부가 아닙니다. 이것은 GL 4.3 또는 GLSL 4.30의 핵심 기능입니다. 버텍스 쉐이더 입력 및 프래그먼트 쉐이더 출력 위치를 지정하는 기능은 3.30이지만 균일 한 위치는 아닙니다.

명시 적으로 균일 한 위치 지정이 실제로 수행되지 않음 특수 하드웨어; 그것은 순전히 인터페이스 일입니다. 따라서, 4.x 이전 하드웨어가이를 구현할 수 있습니다. 그러나 하드웨어가 GL 3.3으로 제한되어 있다면 하드웨어가 오래되어 IHV에서 새로운 OpenGL 기능으로 업데이트를 중단 할 가능성이 매우 높습니다. 따라서 IHV가 하드웨어를 업데이트하는 것을 중단 한 후에 기능을 지원할 수는 있습니다.

NVIDIA는 3.3 버전의 하드웨어를 최신의 비 하드웨어 기능으로 최신 버전으로 유지했지만 Intel 또는 AMD에서도 마찬가지입니다. 따라서 NVIDIA 3.x GPU를 사용하더라도 Intel 또는 AMD의 3.x GPU가 작동하지 않을 가능성이 있습니다.

"주니퍼"는 Radeon 67xx 라인을 나타냅니다. 이들은 GL 4.x 부품입니다. 그러나 AMD의 실제 Linux 드라이버가 아닌 오픈 소스 드라이버를 사용하고 있으므로 3.3 버전 만 사용할 수 있습니다.

쉐이더에 맞게 OpenGL 버전을 부딪 치는 것이 좋습니다.

#extension GL_ARB_explicit_uniform_location : require 
+0

나는 Windows 용 Radeon HD5750을 가지고 있는데, OGL 4.4가 있지만 Ubuntu Linux에는 OGL 3.3 만 있고 새로운 Linux Kernel 4.x fglrx (OGL 4.4 제공)는 작동하지 않습니다. 나는 최신 libdrm, llvm, libmesa로 배포판에 대한 배포판을 변경하려고 생각하고있다. (OpenGL 4.1이 나에게 줄 것이다.) ( – bajos