質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
C++

C++はC言語をもとにしてつくられた最もよく使われるマルチパラダイムプログラミング言語の1つです。オブジェクト指向、ジェネリック、命令型など広く対応しており、多目的に使用されています。

GLSL

GLSL (OpenGL Shading Language) はC言語をベースとしたシェーディング言語です。

Q&A

1回答

3082閲覧

GLSLを4.2に対応する方法が知りたい。

退会済みユーザー

退会済みユーザー

総合スコア0

C++

C++はC言語をもとにしてつくられた最もよく使われるマルチパラダイムプログラミング言語の1つです。オブジェクト指向、ジェネリック、命令型など広く対応しており、多目的に使用されています。

GLSL

GLSL (OpenGL Shading Language) はC言語をベースとしたシェーディング言語です。

0グッド

1クリップ

投稿2021/10/06 10:21

編集2022/01/12 10:55

提示コードですが error: GLSL 4.20 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, and 3.00 ES 表示されてしまいます。どうすればに対応できるのでしょうか?その他のバージョン3.3 4.2等を試しましたがどれも対応していません。また1.○○バージョンだとコンパイルエラーになるので使いたくありませんこれはどうやって対応するのでしょうか?
自分の環境は現在4.2まで対応しているのですがどうすればGLSLを4.2に対応できるのでしょうか?

参考サイト: https://stackoverflow.com/questions/27407774/get-supported-glsl-versions/27410925

参考サイト: https://01.org/linuxgraphics/downloads/stack

試したこと

別のバージョンで試した。

$ glxinfo | grep OpenGL OpenGL vendor string: Intel Open Source Technology Center OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 4000 (IVB GT2) OpenGL core profile version string: 4.2 (Core Profile) Mesa 21.1.5 OpenGL core profile shading language version string: 4.20 OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: OpenGL version string: 3.0 Mesa 21.1.5 OpenGL shading language version string: 1.30 OpenGL context flags: (none) OpenGL extensions: OpenGL ES profile version string: OpenGL ES 3.0 Mesa 21.1.5 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00 OpenGL ES profile extensions:
$ ./GL Complie Error: Vertex Shader 0:4(10): error: GLSL 4.20 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, and 3.00 ES Complie Error: Fragment Shader 0:4(10): error: GLSL 4.20 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, and 3.00 ES Program Info Log: error: linking with uncompiled/unspecialized shadererror: linking with uncompiled/unspecialized shader Complie Error: Vertex Shader 0:4(10): error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, and 3.00 ES Complie Error: Fragment Shader 0:4(10): error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, and 3.00 ES Program Info Log: error: linking with uncompiled/unspecialized shadererror: linking with uncompiled/unspecialized shader setBindAttribVertex(): -1 setBindAttribVertex(): -1 glGetError(): 0x502 GL: source/Shader.cpp:261: void FrameWork::Shader::setUniform4f(const char*, glm::vec4): Assertion `0' failed. 中止 (コアダンプ)
#include "../header/FrameWork.hpp" #include <iostream> #include "../header/FrameWork.hpp" #include "../header/Camera.hpp" int main() { FrameWork::Init(glm::ivec2(48 * 26, 48 * 18), glm::ivec2(3,3), "Dungeon"); // 初期化 FrameWork::Camera_2D::Init(); //カメラ初期化 FrameWork::Circle circle; FrameWork::Text text; text.setString(30,glm::vec4(255,0,0,255),"Hello World"); while (*FrameWork::windowContext) { FrameWork::windowContext->FrameUpdate(glm::vec4(0,0,0,255)); //circle.Draw(glm::vec2(100,100),glm::vec4(0,255,0,255),100,100,20); text.DrawString(glm::vec2(100,100)); FrameWork::windowContext->Wait(); FrameWork::windowContext->SwapBuffers(); } return 0; }
/*######################################################################### # ###########################################################################*/ #version 330 #extension GL_ARB_explicit_uniform_location : require // ###################### ###################### layout(location = 0) in vec2 vertexPosition; layout(location = 1) in vec2 vertexUV; // ###################### ###################### layout(location = 1) out vec2 texCoord; // ###################### Uniform ###################### uniform mat4 uViewProjection; void main() { vec4 vertex = vec4(vertexPosition.x,vertexPosition.y,0.0,1.0); gl_Position = (uViewProjection * vertex); texCoord = vertexUV; }
/*######################################################################### # ###########################################################################*/ #version 330 #extension GL_ARB_explicit_uniform_location : require // ###################### ###################### layout(location = 1 ) in vec2 texCoord; // ###################### ###################### out vec4 color; // ###################### Unifrom ###################### uniform sampler2D text; uniform vec4 uFragment; void main() { vec4 sampled = vec4(1.0, 1.0, 1.0, texture(text, texCoord).r); color = uFragment * sampled; }

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

OpenGL のプロファイルとして 4.2 を指定してみては如何でしょうか?

c++

1glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); 2glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); 3glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); 4glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); 5

<参考>
https://tokoik.github.io/GLFWdraft.pdf / P46

投稿2021/10/06 13:26

cx20

総合スコア4632

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問