#10 3D Game Engine Tutorial: GLSL

thebennybox · 28K views · 2013 · 11:11

Open on YouTube

Computer graphics & renderingGame programming & enginestutorialdated

Why Stack Overflow recommends it

Stack Overflow users mention it because many learners follow this tutorial series and then ask about shader compile, link and validation errors that come up while copying it.

Recommended by 0 people across 0 different months, 2013 to 2014.

What it is

An 11-minute episode in thebennybox's Java/OpenGL 3D game engine series. It writes a first set of basic GLSL vertex and fragment shaders to test the shader loading and compiling classes built in the previous video. The code is on GitHub.

What people said

Cites Kate · 2013-07 · Stack Overflow · on “OpenGL Shader errors (storage qualifiers, undeclared identifiers and float conversions)”

I'm starting out with OpenGL and have made my first shaders (following a tutorial [this video] ). Despite following the tutorial to the letter, I got a few errors (unlike the tutorial-giver). Despite thorough and inventive googling, I have found no help or explaination of what's going wrong. The source for my shaders is as follows: basicVertex.vs: #version 330 layout (location = 0) in vec3 position; void main() { gl_Position = vec4(position, 1.0); } basicFragment.fs: #version 330 out vec4 fragColor; void main() { fragColor = vec4(0.0, 1.0, 1.0); } and the errors are as follows: Shader could not be run: ERROR: 0:? : '' : storage qualifier not valid with layout qualifier id ERROR: 0:7: 'gl_Position

Cites Zeveso · 2013-11 · Stack Overflow · on “Not sure how to solve shader errors?”

Error: ERROR: 0:1: 'basicVertex120' : syntax error parse error Code: #version 120 attribute vec3 position; attribute vec2 texCoord; varying vec2 texCoord0; uniform mat4 transform; void main() { gl_Position = transform * vec4(position, 1.0); texCoord0 = texCoord; } I have been following the tutorial from here: [this video] All code from his tutorial are here: [LINK] I am not following it exactly, but as far as shader class and all go it is exactly the same. If you need any other code posted... let me know. I am still very new to OpenGL 2.0+ and GLSL and trying to figure out how to know which line has the error. Is there something for vertex shaders like GL11.glGetError();? Are there any tools I ca

Cites hacksoi · 2014-10 · Stack Overflow · on “OpenGL Shaders: glLinkProgram() and glValidateProgram() doesn't work”

I've been following along with this [this video] tutorial, and that particular video is where my problem comes from. At that time in the video, he begins incorporating his Shader class (I copied everything exactly how he did it, by the way). Anyways, when I call the compileShader() method, which looks like this, public void compileShader() { glLinkProgram(program); if(glGetProgrami(program, GL_LINK_STATUS) == GL_FALSE) { System.err.println(glGetShaderInfoLog(program, 1024)); System.exit(1); } glValidateProgram(program); if(glGetProgrami(program, GL_VALIDATE_STATUS) == GL_FALSE) { System.err.println(glGetShaderInfoLog(program, 1024)); System.exit(1); } } My program crashes because the glGetProgram