remove vertex value and tweak some rendering
This commit is contained in:
parent
c336bdff65
commit
a08dc34da9
|
@ -1,10 +0,0 @@
|
|||
unsigned char fragmentShader_glsl[] = {
|
||||
0x23, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x33, 0x33, 0x30,
|
||||
0x20, 0x63, 0x6f, 0x72, 0x65, 0x0a, 0x69, 0x6e, 0x20, 0x76, 0x65, 0x63,
|
||||
0x33, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f, 0x69,
|
||||
0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x09,
|
||||
0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72,
|
||||
0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x28, 0x63, 0x6f, 0x6c, 0x6f,
|
||||
0x72, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x7d
|
||||
};
|
||||
unsigned int fragmentShader_glsl_len = 82;
|
|
@ -16,7 +16,6 @@ typedef struct {
|
|||
GLfloat x;
|
||||
GLfloat y;
|
||||
GLfloat z;
|
||||
GLfloat value;
|
||||
} Point;
|
||||
|
||||
GLuint program;
|
||||
|
@ -28,16 +27,17 @@ GLfloat aspectRatio = 1.0f;
|
|||
GLfloat step = 0.0f;
|
||||
|
||||
|
||||
GLfloat corners[] = {
|
||||
1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, -1.0f, 0.0f,
|
||||
1.0f, -1.0f, 1.0f, 1.0f,
|
||||
1.0f, -1.0f, -1.0f, 0.0f,
|
||||
-1.0f, 1.0f, 1.0f, 1.0f,
|
||||
-1.0f, 1.0f, -1.0f, 0.0f,
|
||||
-1.0f, -1.0f, 1.0f, 1.0f,
|
||||
-1.0f, -1.0f, -1.0f, 0.0f
|
||||
Point corners[] = {
|
||||
{ 1.0f, 1.0f, 1.0f },
|
||||
{ 1.0f, 1.0f, -1.0f },
|
||||
{ 1.0f, -1.0f, 1.0f },
|
||||
{ 1.0f, -1.0f, -1.0f },
|
||||
{ -1.0f, 1.0f, 1.0f },
|
||||
{ -1.0f, 1.0f, -1.0f },
|
||||
{ -1.0f, -1.0f, 1.0f },
|
||||
{ -1.0f, -1.0f, -1.0f }
|
||||
};
|
||||
|
||||
GLuint indices[] = {
|
||||
0, 1,
|
||||
0, 2,
|
||||
|
@ -98,6 +98,7 @@ void rotationZ(GLfloat* out, GLfloat angle) {
|
|||
out[5] = cos(angle);
|
||||
}
|
||||
|
||||
// CREATE 4x4 ROTATION MATRIX AROUND Y AXIS
|
||||
void rotationY(GLfloat* out, GLfloat angle) {
|
||||
identity(out);
|
||||
out[0] = cos(angle);
|
||||
|
@ -106,6 +107,7 @@ void rotationY(GLfloat* out, GLfloat angle) {
|
|||
out[10] = cos(angle);
|
||||
}
|
||||
|
||||
// CREATE 4x4 ROTATION MATRIX AROUND Y AXIS
|
||||
void rotationX(GLfloat* out, GLfloat angle) {
|
||||
identity(out);
|
||||
out[5] = cos(angle);
|
||||
|
@ -272,15 +274,6 @@ void init(void) {
|
|||
0
|
||||
);
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(
|
||||
1,
|
||||
1,
|
||||
GL_FLOAT,
|
||||
GL_FALSE,
|
||||
sizeof(Point),
|
||||
(GLvoid*)(3 * sizeof(GLfloat))
|
||||
);
|
||||
glEnableVertexAttribArray(1);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindVertexArray(0);
|
||||
|
||||
|
@ -299,7 +292,7 @@ void init(void) {
|
|||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
|
||||
|
||||
|
||||
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
|
||||
glClearColor(0.01f, 0.01f, 0.01f, 1.0f);
|
||||
}
|
||||
|
||||
void draw(void) {
|
||||
|
@ -321,8 +314,8 @@ void draw(void) {
|
|||
|
||||
identity(M);
|
||||
rotateY(M, M, step * 3.14159f * 2);
|
||||
rotateZ(M, M, step * 3.14159f * 2 + 0.5f);
|
||||
rotateX(M, M, step * 3.14159f * 2 + 1.0f);
|
||||
rotateZ(M, M, step * 3.14159f * 2 + 0.5f);
|
||||
scale(M, M, scaleBy);
|
||||
// translate(M, M, translateBy);
|
||||
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
unsigned char vertexShader_glsl[] = {
|
||||
0x23, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x33, 0x33, 0x30,
|
||||
0x20, 0x63, 0x6f, 0x72, 0x65, 0x0a, 0x6c, 0x61, 0x79, 0x6f, 0x75, 0x74,
|
||||
0x20, 0x28, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d,
|
||||
0x20, 0x30, 0x29, 0x20, 0x69, 0x6e, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20,
|
||||
0x61, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x6c,
|
||||
0x61, 0x79, 0x6f, 0x75, 0x74, 0x20, 0x28, 0x6c, 0x6f, 0x63, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x31, 0x29, 0x20, 0x69, 0x6e, 0x20,
|
||||
0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78,
|
||||
0x56, 0x61, 0x6c, 0x75, 0x65, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f,
|
||||
0x72, 0x6d, 0x20, 0x6d, 0x61, 0x74, 0x34, 0x20, 0x74, 0x72, 0x61, 0x6e,
|
||||
0x73, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a,
|
||||
0x6f, 0x75, 0x74, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x63, 0x6f, 0x6c,
|
||||
0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69,
|
||||
0x6e, 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x63, 0x6f, 0x6c, 0x6f, 0x72,
|
||||
0x20, 0x3d, 0x20, 0x61, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x20, 0x2f, 0x20, 0x32, 0x20, 0x2b, 0x20, 0x76, 0x65, 0x63, 0x33, 0x28,
|
||||
0x30, 0x2e, 0x35, 0x2c, 0x20, 0x30, 0x2e, 0x35, 0x2c, 0x20, 0x30, 0x2e,
|
||||
0x35, 0x29, 0x3b, 0x0a, 0x09, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x61, 0x6e, 0x73,
|
||||
0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x2a, 0x20,
|
||||
0x76, 0x65, 0x63, 0x34, 0x28, 0x61, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x7d
|
||||
};
|
||||
unsigned int vertexShader_glsl_len = 263;
|
|
@ -1,6 +1,5 @@
|
|||
#version 330 core
|
||||
layout (location = 0) in vec3 aPosition;
|
||||
layout (location = 1) in float vertexValue;
|
||||
uniform mat4 transformation;
|
||||
out vec3 color;
|
||||
void main() {
|
||||
|
|
Loading…
Reference in New Issue