Skip to content
Snippets Groups Projects
Commit c7de7826 authored by Saif Eddine Askri's avatar Saif Eddine Askri
Browse files

set the vao and vertex for praktikum 3

parent 5ff58785
No related branches found
No related tags found
No related merge requests found
Showing with 99 additions and 118 deletions
......@@ -6,6 +6,7 @@ in mat3 animationMatrix;
out vec4 color;
void main() {
vec3 animatedColor = animationMatrix * colorVS;
//vec3 animatedColor = animationMatrix * colorVS;
vec3 animatedColor = colorVS;
color = vec4(animatedColor, 1.0);
}
\ No newline at end of file
#version 330 core
layout (location = 0) in vec3 pos;
layout (location = 1) in vec3 colorRGB;
layout (location = 1) in vec3 normalVector;
layout (location = 2) in vec3 colorRGB;
out vec3 colorVS;
out mat3 animationMatrix;
......
No preview for this file type
......@@ -10,7 +10,7 @@
7540 9264 7686065192309264 libs/glfw-3.2.1/src/CMakeFiles/glfw.dir/win32_window.c.obj f3663704c5e7b483
22 3445 7686065134113940 CMakeFiles/OpenGL_Praktikum.dir/framework/OpenGLWindow.cpp.obj 34ea2011e57f2170
8264 10755 7686065207221889 libs/glew-2.1.0/build/cmake/CMakeFiles/glew_s.dir/__/__/src/glew.c.obj 49302988e0a6d721
19 2425 7692151096724377 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
13 2314 7692174810008034 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
6279 7932 7686065179033527 libs/glfw-3.2.1/src/CMakeFiles/glfw.dir/window.c.obj 4f7adc10a9b5c100
3446 5087 7686065150584678 libs/glfw-3.2.1/src/CMakeFiles/glfw.dir/context.c.obj 25e8349415fc9756
3713 5273 7686065152431421 libs/glfw-3.2.1/src/CMakeFiles/glfw.dir/init.c.obj c23d9b4a554c4f26
......@@ -26,52 +26,12 @@
6842 8491 7686065184420325 libs/glfw-3.2.1/src/CMakeFiles/glfw.dir/egl_context.c.obj a926327ff0927a5f
8361 8516 7686065184908185 libs/glew-2.1.0/build/cmake/CMakeFiles/glew_s.dir/__/glew.rc.obj b31ab018f98307f0
8516 8843 7686065188136532 libs/stb/CMakeFiles/stb.dir/stb_image_write.c.obj 3526fea5ed75b7b5
4 749 7692044051857988 build.ninja e200cd586be24cf3
4 749 7692175495458573 build.ninja e200cd586be24cf3
7932 9454 7686065194250355 libs/glfw-3.2.1/src/CMakeFiles/glfw.dir/wgl_context.c.obj 6893a4a99f5b69c5
8492 9494 7686065194635396 libs/stb/CMakeFiles/stb.dir/stb_image.c.obj e492735f915a3aa
9494 9620 7686065195935485 libs/stb/libstb.a 5abafcb88860c9c8
10756 10849 7686065208208944 lib/libglew32d.a bc6e147c3a6b7648
2425 2989 7692151102308506 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
2314 2919 7692174815999842 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
13 74 7686767474063569 CMakeFiles/OpenGL_Praktikum.dir/src/Game/wajdi.cpp.obj 20b3fc935b3f3aa4
15 2466 7692151568551477 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2467 3030 7692151574140461 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
12 2083 7692155176160940 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2083 2649 7692155181728914 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
14 2113 7692155970141004 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2113 2700 7692155975890811 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
28 2559 7692157589710965 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2559 3193 7692157596008471 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
9 2460 7692157901324491 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2461 3203 7692157908696680 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
10 2329 7692160653427143 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2329 2961 7692160659691101 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
30 2669 7692161048578145 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2669 3236 7692161054181193 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
27 2496 7692161519427577 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2497 3103 7692161525414993 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
10 2358 7692161639874414 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2358 2908 7692161645318503 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
13 2050 7692162128447673 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2050 2602 7692162133907493 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
9 2270 7692162504786348 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2270 2839 7692162510417811 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
7 2531 7692162707113644 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2531 3075 7692162712493091 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
7 2248 7692163390809165 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2249 2890 7692163397165142 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
34 2492 7692163725432711 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2492 3133 7692163731775177 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
8 2524 7692164167209100 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2525 3114 7692164173068653 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
12 2145 7692164597182390 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2145 2804 7692164603729082 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
10 2415 7692165141355730 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2415 2983 7692165147010564 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
13 2495 7692165303779516 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2496 3156 7692165310294970 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
8 2352 7692165385505571 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2352 2939 7692165391324594 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
7 2256 7692165646149942 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2256 2846 7692165651998118 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
7 2467 7692166031829316 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2468 3028 7692166037380832 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
7 2285 7692176035625664 CMakeFiles/OpenGL_Praktikum.dir/src/Game/Scene.cpp.obj a89dc091bea583c7
2285 2829 7692176041012060 OpenGL_Praktikum.exe 9fec4fbaeb613d2c
No preview for this file type
......@@ -69,6 +69,6 @@ CMake Deprecation Warning at libs/stb/CMakeLists.txt:1 (cmake_minimum_required):
CMake that the project does not need compatibility with older versions.
-- Configuring done (0.3s)
-- Configuring done (0.5s)
-- Generating done (0.1s)
-- Build files have been written to: C:/Users/saifa/Desktop/Visual Computing/repo/cmake-build-debug
No preview for this file type
Start testing: May 17 22:23 Mitteleuropische Sommerzeit
Start testing: May 17 22:40 Mitteleuropische Sommerzeit
----------------------------------------------------------
End testing: May 17 22:23 Mitteleuropische Sommerzeit
End testing: May 17 22:40 Mitteleuropische Sommerzeit
......@@ -6,6 +6,7 @@ in mat3 animationMatrix;
out vec4 color;
void main() {
vec3 animatedColor = animationMatrix * colorVS;
//vec3 animatedColor = animationMatrix * colorVS;
vec3 animatedColor = colorVS;
color = vec4(animatedColor, 1.0);
}
\ No newline at end of file
#version 330 core
layout (location = 0) in vec3 pos;
layout (location = 1) in vec3 colorRGB;
layout (location = 1) in vec3 normalVector;
layout (location = 2) in vec3 colorRGB;
out vec3 colorVS;
out mat3 animationMatrix;
......
9.55332,16.1199,104.676,62.0351
8.37541,17.7173,119.397,56.442
8.21206,17.0291,121.772,58.723
11.5022,21.1709,86.94,47.2346
11.3184,20.3647,88.3515,49.1046
11.0885,17.6205,90.1838,56.7521
11.2509,21.0727,88.8817,47.4548
11.581,20.8078,86.3487,48.0589
11.1825,17.8693,89.4253,55.9619
11.3275,20.6107,88.281,48.5185
10.7088,17.8789,93.3808,55.9319
11.771,20.5132,84.9544,48.7491
13.0609,20.7399,76.5641,48.2162
228.782,6710.84,4.37098,0.149013
13.6825,25.3838,73.086,39.3952
10.9025,20.418,91.7217,48.9764
10.5033,17.9763,95.2086,55.6288
10.6172,13.605,94.1864,73.5024
10.7801,17.5242,92.7634,57.0639
10.6972,17.2651,93.482,57.9203
10.8364,20.549,92.2819,48.6642
10.626,17.5531,94.1087,56.97
10.9303,20.8172,91.4891,48.0372
11.011,17.7004,90.8185,56.4959
11.0069,17.5076,90.8523,57.1181
11.1556,17.2654,89.6411,57.9193
10.8597,17.9812,92.0838,55.6136
10.9989,20.5644,90.9185,48.6277
10.7732,21.0052,92.8228,47.6073
11.2493,20.7625,88.8945,48.1638
10.9407,20.8895,91.4019,47.8709
7.72728,18.2588,129.412,54.7681
9.30915,13.8221,107.421,72.3479
10.7099,17.8313,93.3714,56.0812
10.5412,14.0087,94.8659,71.3842
10.9238,20.9154,91.5432,47.8117
10.7064,17.6518,93.4025,56.6514
10.6996,13.8318,93.4611,72.2972
10.6992,17.3903,93.4652,57.5033
10.5488,14.003,94.7974,71.4133
8.4931,13.8159,117.743,72.3804
10.7055,18.2899,93.4103,54.675
10.6145,13.8521,94.2105,72.1912
12.2765,17.8747,81.4562,55.945
10.6862,14.2372,93.5789,70.2385
10.853,17.5068,92.1405,57.1207
12.9229,14.9633,77.3818,66.8302
11.5691,26.8532,86.437,37.2395
10.8311,20.3933,92.3267,49.0357
14.0504,141.496,71.1726,7.06731
9.63027,16.5575,103.839,60.3956
14.0531,18.8094,71.1589,53.1649
10.7378,16.14,93.1292,61.9579
10.7157,17.5091,93.3211,57.1132
10.7615,20.3542,92.924,49.1299
11.4212,20.9038,87.5568,47.8382
10.7757,17.5094,92.8014,57.1122
10.9347,17.496,91.4521,57.1559
10.8413,20.7932,92.2395,48.0926
10.8569,17.7613,92.107,56.3022
11.0058,20.7413,90.8613,48.213
10.8398,20.4669,92.2524,48.8594
10.8514,17.7736,92.154,56.2632
10.9272,20.9221,91.5149,47.7963
10.8534,17.694,92.1368,56.5163
11.1691,20.8271,89.5329,48.0144
11.0069,17.3086,90.8518,57.7747
10.9379,17.5873,91.4255,56.8592
9.37321,20.5845,106.687,48.5802
11.0787,20.9632,90.2631,47.7026
11.0809,17.6249,90.2452,56.7379
11.629,21.1175,85.9919,47.3541
12.4808,16.7333,80.1231,59.7611
......@@ -29,10 +29,16 @@ void createAndBindVAO(GLuint& vaoID){
}
void defineVAOAttribute_XY_RGB(){
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);
// vertices, normals, colors: x, y, z, n_z, n_y, n_z, r, g, b
const int numberOfElement = 9;
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, numberOfElement * sizeof(float), (void*)0);
glEnableVertexAttribArray(0);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)(3 * sizeof(float)));
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, numberOfElement * sizeof(float), (void*)(3 * sizeof(float)));
glEnableVertexAttribArray(1);
glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, numberOfElement * sizeof(float), (void*)(6 * sizeof(float)));
glEnableVertexAttribArray(2);
}
void createAndBindIBO(GLuint& iboID, unsigned int* indices, GLsizeiptr sizeIndices){
......@@ -56,7 +62,7 @@ void createAndBind_VBO_VAO_IBO(ObjectBuffer& objectBuffer){
void drawObject(ObjectBuffer& obj){
glBindVertexArray(obj.vaoID);
glDrawElements(GL_TRIANGLES, obj.indicesLength, GL_UNSIGNED_INT, 0);
glDrawArrays(GL_TRIANGLES,0,obj.verticesLength);
glBindVertexArray(0);
}
......@@ -188,7 +194,7 @@ bool Scene::init()
m_shader->use();
// assign the length of vertices and indices to the obj
obj.verticesLength = 48;
obj.verticesLength = 324;
obj.indicesLength = 36;
// assign the length of vertices and indices in Bytes to the obj
......@@ -197,14 +203,53 @@ bool Scene::init()
// define the Vertices
obj.vertices = new float[obj.verticesLength] {
0.5, -0.5, -0.5, 1, 0, 0,
0.5, -0.5, 0.5, 0, 1, 0,
-0.5, -0.5, 0.5, 0, 0, 1,
-0.5, -0.5, -0.5, 1, 1, 0,
0.5, 0.5, -0.5, 1, 0, 1,
0.5, 0.5, 0.5, 0, 1, 1,
-0.5, 0.5, 0.5, 1, 1, 1,
-0.5, 0.5, -0.5, 0.5, 1, 0.5
// back
-0.5, -0.5, -0.5, 0, 0, -1, 1, 1, 0,
0.5, 0.5, -0.5, 0, 0, -1, 1, 0, 1,
0.5, -0.5, -0.5, 0, 0, -1, 1, 0, 0,
0.5, 0.5, -0.5, 0, 0, -1, 1, 0, 1,
-0.5, -0.5, -0.5, 0, 0, -1, 1, 1, 0,
-0.5, 0.5, -0.5, 0, 0, -1, 0.5, 1, 0.5,
// front
-0.5, -0.5, 0.5, 0, 0, 1, 0, 0, 1,
0.5, -0.5, 0.5, 0, 0, 1, 0, 1, 0,
0.5, 0.5, 0.5, 0, 0, 1, 0, 1, 1,
0.5, 0.5, 0.5, 0, 0, 1, 0, 1, 1,
-0.5, 0.5, 0.5, 0, 0, 1, 1, 1, 1,
-0.5, -0.5, 0.5, 0, 0, 1, 0, 0, 1,
// right
-0.5, 0.5, 0.5, -1, 0, 0, 1, 1, 1,
-0.5, 0.5, -0.5, -1, 0, 0, 0.5, 1, 0.5,
-0.5, -0.5, -0.5, -1, 0, 0, 1, 1, 0,
-0.5, -0.5, -0.5, -1, 0, 0, 1, 1, 0,
-0.5, -0.5, 0.5, -1, 0, 0, 0, 0, 1,
-0.5, 0.5, 0.5, -1, 0, 0, 1, 1, 1,
// left
0.5, 0.5, 0.5, 1, 0, 0, 0, 1, 1,
0.5, -0.5, -0.5, 1, 0, 0, 1, 0, 0,
0.5, 0.5, -0.5, 1, 0, 0, 1, 0, 1,
0.5, -0.5, -0.5, 1, 0, 0, 1, 0, 0,
0.5, 0.5, 0.5, 1, 0, 0, 0, 1, 1,
0.5, -0.5, 0.5, 1, 0, 0, 0, 1, 0,
// bottom
-0.5, -0.5, -0.5, 0, -1, 0, 1, 1, 0,
0.5, -0.5, -0.5, 0, -1, 0, 1, 0, 0,
0.5, -0.5, 0.5, 0, -1, 0, 0, 1, 0,
0.5, -0.5, 0.5, 0, -1, 0, 0, 1, 0,
-0.5, -0.5, 0.5, 0, -1, 0, 0, 0, 1,
-0.5, -0.5, -0.5, 0, -1, 0, 1, 1, 0,
// top
-0.5, 0.5, -0.5, 0, 1, 0, 0.5, 1, 0.5,
0.5, 0.5, 0.5, 0, 1, 0, 0, 1, 1,
0.5, 0.5, -0.5, 0, 1, 0, 1, 0, 1,
0.5, 0.5, 0.5, 0, 1, 0, 0, 1, 1,
-0.5, 0.5, -0.5, 0, 1, 0, 0.5, 1, 0.5,
-0.5, 0.5, 0.5, 0, 1, 0, 1, 1, 1
};
// define the Indices
......@@ -233,9 +278,8 @@ bool Scene::init()
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glClearDepth(1.0f);
glDepthFunc(GL_LESS); // Default-Value, könnte auch weggelassen werden
glClearDepth(1.0); // Default-Value, könnte auch weggelassen werden
//glDepthMask(GL_FALSE);
......@@ -252,7 +296,7 @@ bool Scene::init()
void Scene::render(float dt)
{
glClearColor(0.7f, 0.3f, 0.1f, 1.0f);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
float animationSpeed = 1.00f;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment