atomes 1.2.1
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
d_background.c
Go to the documentation of this file.
1/* This file is part of the 'atomes' software
2
3'atomes' is free software: you can redistribute it and/or modify it under the terms
4of the GNU Affero General Public License as published by the Free Software Foundation,
5either version 3 of the License, or (at your option) any later version.
6
7'atomes' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9See the GNU General Public License for more details.
10
11You should have received a copy of the GNU Affero General Public License along with 'atomes'.
12If not, see <https://www.gnu.org/licenses/>
13
14Copyright (C) 2022-2025 by CNRS and University of Strasbourg */
15
23/*
24* This file: 'd_background.c'
25*
26* Contains:
27*
28
29 - The functions to prepare the OpenGL gradient background
30
31*
32* List of functions:
33
34 void create_background_lists ();
35
36*/
37
38#include "global.h"
39#include "glview.h"
40
47{
49 wingl -> create_shaders[BACKG] = FALSE;
50
51 wingl -> n_shaders[BACKG][0] = 1;
52 object_3d * back = g_malloc0 (sizeof*back);
53 back -> vert_buffer_size = 2;
54 back -> num_vertices = 4;
55 back -> vertices = allocfloat (back -> vert_buffer_size*back -> num_vertices);
56 back -> vertices[0] = back -> vertices[1] = back -> vertices[3] = back -> vertices[4] = -1.0;
57 back -> vertices[2] = back -> vertices[5] = back -> vertices[6] = back -> vertices[7] = 1.0;
58 wingl -> ogl_glsl[BACKG][0] = g_malloc0 (sizeof*wingl -> ogl_glsl[BACKG][0]);
59 switch (plot -> back -> gradient)
60 {
61 case 1:
62 wingl -> ogl_glsl[BACKG][0][0] = init_shader_program (BACKG, GLSL_BACK, background_vertex, NULL, background_linear, GL_TRIANGLE_STRIP, 1, 5, FALSE, back);
63 break;
64 case 2:
65 wingl -> ogl_glsl[BACKG][0][0] = init_shader_program (BACKG, GLSL_BACK, background_vertex, NULL, background_circular, GL_TRIANGLE_STRIP, 1, 5, FALSE, back);
66 break;
67 }
68 g_free (back);
69}
void create_background_lists()
prepare background OpenGL rendering
float * allocfloat(int val)
allocate a float * pointer
Definition global.c:398
Global variable declarations Global convenience function declarations Global data structure defin...
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
image * plot
Definition ogl_draw.c:70
glwin * wingl
Definition ogl_draw.c:63
void cleaning_shaders(glwin *view, int shader)
re-initialize an OpenGL shader
glsl_program * init_shader_program(int object, int object_id, const GLchar *vertex, const GLchar *geometry, const GLchar *fragment, GLenum type_of_vertices, int narray, int nunif, gboolean lightning, object_3d *obj)
create an OpenGL shader program
@ BACKG
Definition glwin.h:103
const GLchar * background_circular
const GLchar * background_vertex
const GLchar * background_linear
@ GLSL_BACK
Definition ogl_shading.h:46