I have a structural shader problem in OpenGL. Heres a shader designed to render quads…
- User
I have a structural shader problem in OpenGL. Heres a shader designed to render quads with only colors in it:
#version 330 core
layout (location = 0) in vec2 vertexPos; layout (location = 2) in vec4 color;
uniform mat4 orthoMatrix; uniform mat4 modelMatrix;
out DATA { vec4 color; } vs_out;
void main() { gl_Position = orthoMatrix * modelMatrix * vec4(vertexPos, 0.0, 1.0); vs_out.color = color; } And with tex coords: #version 330 core
layout (location = 0) in vec2 vertexPos; layout (location = 1) in vec2 textureCoords;
uniform mat4 orthoMatrix; uniform mat4 modelMatrix;
out DATA { vec2 textureCoords; } vs_out;
void main() { gl_Position = orthoMatrix * modelMatrix * vec4(vertexPos, 0, 1); vs_out.textureCoords = textureCoords; }
I want even more shaders for different VBOs. Should I combined all of them into one shader, or would that be too costly?
- Assistant