PDA

View Full Version : glScale3f but on a GLSL vertex shader?



noobscratcher
03-18-2012, 02:24 PM
Hello I've finally figured out how to use vertex arrays inside Opengl 3.3x but having issues with my shaders now


I was wondering how to change the size of a quad using a shader this is my current vertex array


static const GLfloat g_vertex_buffer_data[] = {
//X Y Z
-1.0f,-1.0f, 0.0f,
1.0f,-1.0f, 0.0f,
1.0f, 1.0f, 0.0f,
-1.0f, 1.0f, 0.0f,

};



and here is my current fragment shader and vertex shader code


//VERTEX SHADER

#version 330 core

layout(location = 0) in vec3 Position;

void main()
{
gl_Position.xyz = Position;


}



//FRAGMENT SHADER

out vec3 color;

void main(){
color = vec3(1,1,0);
}


Thanks in Advance

BionicBytes
03-18-2012, 02:43 PM
Your vertex shader is missing 'standard' features such as multiply in position by a model matrix and then a camera matrix.
Eg.
gl_Position = cameramatrix * modelmatrix * Position;

In your case the uniform modelmatrix would be an identity matrix which has then been scaled. The. Camera matrix would be just identity.