_NoName_

06-24-2016, 01:41 PM

(Sorry for my english skills...)

I tryed to write my own GLSL #version440 schader but when I add my projectionMatrix I get a black screen, I think because of any reason my matrix is 0 (when I use the vertex coords for the color the object is black (matrix is not added to the vertex but to the color....))

Matrix :

// projectionMatrix is defined

void Perspective(float fovy, float aspect, float near, float far)

{

fovy = degree*90;

float f;

f = 1/tan(fovy/2);

projectionMatrix[0] = f/aspect; projectionMatrix[1] = 0; projectionMatrix[2] = 0; projectionMatrix[3] = 0;

projectionMatrix[4] = 0; projectionMatrix[5] = f; projectionMatrix[6] = 0; projectionMatrix[7] = 0;

projectionMatrix[8] = 0; projectionMatrix[9] = 0; projectionMatrix[10] = (far+near)/(near-far); projectionMatrix[11] = (2*far*near)/near-far;

projectionMatrix[12] = 0; projectionMatrix[13] = 0; projectionMatrix[14] = -1; projectionMatrix[15] = 1;

glUniformMatrix4fv(posProjectionMatrix, 1, GL_FALSE, projectionMatrix);

}

Vertex shader :

#version 440

in vec4 vertexPosition;

in vec4 vertexColor;

out vec4 Color;

uniform mat4 modelMatrix;

uniform mat4 projectionMatrix;

uniform mat4 viewMatrix;

void main()

{

gl_Position = projectionMatrix*vec4(vertexPosition.xyz, 10);

Color = vertexColor;

}

//END

Do anyone know why I get a black screen ??

I tryed to write my own GLSL #version440 schader but when I add my projectionMatrix I get a black screen, I think because of any reason my matrix is 0 (when I use the vertex coords for the color the object is black (matrix is not added to the vertex but to the color....))

Matrix :

// projectionMatrix is defined

void Perspective(float fovy, float aspect, float near, float far)

{

fovy = degree*90;

float f;

f = 1/tan(fovy/2);

projectionMatrix[0] = f/aspect; projectionMatrix[1] = 0; projectionMatrix[2] = 0; projectionMatrix[3] = 0;

projectionMatrix[4] = 0; projectionMatrix[5] = f; projectionMatrix[6] = 0; projectionMatrix[7] = 0;

projectionMatrix[8] = 0; projectionMatrix[9] = 0; projectionMatrix[10] = (far+near)/(near-far); projectionMatrix[11] = (2*far*near)/near-far;

projectionMatrix[12] = 0; projectionMatrix[13] = 0; projectionMatrix[14] = -1; projectionMatrix[15] = 1;

glUniformMatrix4fv(posProjectionMatrix, 1, GL_FALSE, projectionMatrix);

}

Vertex shader :

#version 440

in vec4 vertexPosition;

in vec4 vertexColor;

out vec4 Color;

uniform mat4 modelMatrix;

uniform mat4 projectionMatrix;

uniform mat4 viewMatrix;

void main()

{

gl_Position = projectionMatrix*vec4(vertexPosition.xyz, 10);

Color = vertexColor;

}

//END

Do anyone know why I get a black screen ??