summaryrefslogtreecommitdiffstats
path: root/fiz/naloga/gl
diff options
context:
space:
mode:
Diffstat (limited to 'fiz/naloga/gl')
-rw-r--r--fiz/naloga/gl/fragment.glsl8
-rw-r--r--fiz/naloga/gl/helmholtz.c5
2 files changed, 7 insertions, 6 deletions
diff --git a/fiz/naloga/gl/fragment.glsl b/fiz/naloga/gl/fragment.glsl
index 095cb78..eed4bb7 100644
--- a/fiz/naloga/gl/fragment.glsl
+++ b/fiz/naloga/gl/fragment.glsl
@@ -5,7 +5,6 @@
#define SEG 32
-#define I .5
#define n 100.
#define PI 3.1415
@@ -33,14 +32,15 @@ vec3 tuljava (vec3 pz, float R) {
void main () {
+ float I = -.5;
float R = 0.8;
- float R2 = abs(sin((time+8.2)/.6))+0.5;
+ float R2 = (abs(sin((time+8.2)/.6))+0.5)*0+R;
vec2 uv = UVo;
vec2 poz = vec2(uv*2.); // zavrteti moramo tako točke same, kot tudi
vec2 offset = vec2(R/2.,0); // njihove komponente
float kot = time/.4;
float multi = n*I/**abs(sin(time/.2)+0.2)*/;
- vec2 dodatek = vec2(sin(time/.6)*.5, cos(time/.4)*.6);
+ vec2 dodatek = vec2(sin(time/.6)*.5, cos(time/.4)*.6)*0;
vec3 rez = tuljava(
vec3(poz+offset, 1/2*R), R
)*n*I +
@@ -65,7 +65,7 @@ void main () {
1);
rez *= 1000.;
#ifdef show_vec
- fragColor = vec4(rez, 1);
+ fragColor = vec4(rez+0.5, 1);
#else
fragColor = vec4(vec3(length(rez)), 1);
#endif
diff --git a/fiz/naloga/gl/helmholtz.c b/fiz/naloga/gl/helmholtz.c
index 5f8f44d..5858039 100644
--- a/fiz/naloga/gl/helmholtz.c
+++ b/fiz/naloga/gl/helmholtz.c
@@ -29,7 +29,7 @@ int main (void) {
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 1);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 4);
// glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // forward compat is ogl 3.0+
- GLFWwindow * okno = glfwCreateWindow(800, 600, "okno", NULL, NULL);
+ GLFWwindow * okno = glfwCreateWindow(80, 60, "okno", NULL, NULL);
if (!okno) {
fprintf(stderr, "glfwCreateWindow failed\n");
glfwTerminate();
@@ -123,6 +123,7 @@ int main (void) {
glfwSwapBuffers(okno);
glfwPollEvents(); // wait / poll
frame++;
+ /*
char fn[25];
sprintf(fn, "animacija%04d.ppm", frame);
int fd;
@@ -148,7 +149,7 @@ int main (void) {
if (close(fd) == -1) {
perror("close");
abort();
- }
+ } */
}
glfwDestroyWindow(okno);
glfwTerminate();