Well, I fixed it through the reference, and it works :P.Place of appointment void color_prohod1(GLfloat *cwet_chikl, int b);
Function locationGLfloat cwet_chikl[360];
color_prohod1(cwet_chikl, 360);
The function itself. Implication of the colouring function of the " flashing " line in the rainbow of flowers.void color_prohod1(GLfloat *cwet_chikl, int b)
{
int t1 = b/30; int t2 = b%30;
int prohod = t1/7;
qDebug() << "t1 = b/30: " << t1;
qDebug() << "t2 = b%30: " << t2;
qDebug() << "prohod = t1/7: " << prohod;
int s =0; // элемент "позиция " массива прим: ranbow_color[124]; s ==124;
int i = 0;
int i_t1 = 0;
for (int a_g =0; a_g < prohod+1; a_g++) {
qDebug() << "2444!!!!!!!!!!!!!!!a_g:" << a_g;
if (i == 0) {
i = 1;
GLfloat per = 0.0;
for (int a = 0; a < 10 ; a++) {
for (int a_i = 0; a_i < 3; a_i++) {
if(a_i == 0) {
per += 0.1f;
cwet_chikl[s] = per;
s++;
}
if(a_i == 1) {
cwet_chikl[s] = 0.0f;
s++;
}
if(a_i == 2) {
cwet_chikl[s] = 0.0f;
s++;
}
}
}
qDebug() << "tyt i:" << i << " cwet_chikl[" << s << "]" << cwet_chikl[s];
i_t1 = i_t1 +1;
if(t1 <= i_t1) continue;
}
if(i == 1){
i = 2;
GLfloat per = 0.0;
for (int a = 0; a < 10 ; a++) {
for (int a_i = 0; a_i < 3; a_i++) {
if(a_i == 0) {
cwet_chikl[s] = 0.0f;
s++;
}
if(a_i == 1) {
per += 0.1f;
cwet_chikl[s] = per;
s++;
}
if(a_i == 2) {
cwet_chikl[s] = 0.0f;
s++;
}
}
}
qDebug() << "tyt i:" << i << " cwet_chikl[" << s << "]" << cwet_chikl[s];
i_t1 = i_t1 +1;
if(t1 <= i_t1) continue;
}
...
if (i == 6) {
i = 0;
GLfloat per = 0.0;
for (int a = 0; a < 10 ; a++){
for (int a_i = 0; a_i < 3; a_i++){
if(a_i == 0){
per += 0.1f;
cwet_chikl[s] = per;
s++;
}
if(a_i == 1){
cwet_chikl[s] = 0.0f;
s++;
}
if(a_i == 2){
cwet_chikl[s] = 0.0f;
s++;
}
}
}
qDebug() << "tyt i:" << i << " cwet_chikl[" << s << "]" << cwet_chikl[s];
i_t1 = i_t1 +1;
if(t1 <= i_t1) continue;
}
}
// выводим одноцветно
int i_t =0;
for(int i1 = 0;i1 < t2;i1++)
{
if(i_t == 0)
{
cwet_chikl[s] = 0.8f;
s++;
i_t = 1;
}
else if(i_t == 1)
{
cwet_chikl[s] = 0.21f;
s++;
i_t = 2;
}
else if(i_t == 2)
{
cwet_chikl[s] = 0.14f;
s++;
i_t = 0;
}
}
}
Simple example of work with indicators #include <stdio.h>
#include <stdlib.h>
#include <string.h>
void addOne(float *buf, int N);
int main()
{
float A[5] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f};
float *B[5];
// заполним массивы
printf("vvod A \n");
addOne(&A, 5); // по адресу
printf(" vvod B \n");
addOne(B, 5); // по указателю
printf("game ower");
system("pause>null");
return 0;
}
void addOne(float *Buf, int N)
{
// memset(Buf, 0, sizeof(Buf));
for (int n = 0; n< N; n++)
{
Buf[n] = Buf[n] + 1.0f;
printf("%f, \n", Buf[n]);
}
printf("\n");
}
I noticed that the question was intersecting with a standard simple question of how to put a mass in the mass.
So I use two methods.
First, stupid overboard. float S[5] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f};
float C[5] = {0.0f, 0.0f, 0.0f,0.0f, 0.0f};
for (int i = 0; i < 5; i++){
C[i] = S[i];
printf("%f, \n", S[i]);
}
Second (most) : function memcpy float S[5] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f};
float C[5] = {0.0f, 0.0f, 0.0f,0.0f, 0.0f};
memcpy (C, S, sizeof(float)*5);