this is bullshit, the first VAO without std::vector get drawn but not the second with vector :confused: : Vector3f Vertices[4]; Vertices[0] = Vector3f(-1.0f, -1.0f, 0.5773f); Vertices[1] = Vector3f(0.0f, -1.0f, -1.15475f); Vertices[2] = Vector3f(1.0f, -1.0f, 0.5773f); Vertices[3] = Vector3f(0.0f, 1.0f, 0.0f); unsigned int Indices[] = { 0, 3, 1, 1, 3, 2, 2, 3, 0, 0, 1, 2 }; GLuint VBO[2]; GLuint IBO[2]; unsigned int id[2]; glGenVertexArrays(2, id); glGenBuffers(2, VBO); glGenBuffers(2, IBO); glBindVertexArray(id[0]); glBindBuffer(GL_ARRAY_BUFFER, VBO[0]); glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO[0]); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Indices), Indices, GL_STATIC_DRAW); struct Vertex { Vector3f position; //Vector2f texCoord; //Vector3f normal; //int Boneindices[4]; //float Weights[4]; }; vector Vertices2; Vertex* v=new Vertex(); v->position = Vector3f(-1.0f, -0.0f, 0); Vertices2.push_back(v); v->position = Vector3f(1.0f, -0.0f, -1); Vertices2.push_back(v); v->position = Vector3f(1.0f, -0.0f, 0); Vertices2.push_back(v); v->position = Vector3f(0.0f, 1.0f, 0.0f); Vertices2.push_back(v); struct Triangle { int indices[3]; }; Triangle* t = new Triangle(); t->indices[0]=0; t->indices[1]=3; t->indices[2]=1; vector Indices2; Indices2.push_back(t); t->indices[0] = 1; t->indices[1] = 3; t->indices[2] = 2; Indices2.push_back(t); t->indices[0] = 2; t->indices[1] = 3; t->indices[2] = 0; Indices2.push_back(t); t->indices[0] = 0; t->indices[1] = 1; t->indices[2] = 2; Indices2.push_back(t); glBindVertexArray(id[1]); glBindBuffer(GL_ARRAY_BUFFER, VBO[1]); glBufferData(GL_ARRAY_BUFFER, sizeof(Vertex)* Vertices2.size(), &Vertices2[0], GL_STATIC_DRAW); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO[1]); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Triangle)* Indices2.size(), &Indices2[0], GL_STATIC_DRAW); for (size_t i = 0; i < 2; i++) { glBindVertexArray(id[i]); glDrawElements(GL_TRIANGLES, 12, GL_UNSIGNED_INT, 0); glBindVertexArray(0); }
Isawyouoo
Posts
-
Drawing a simple triangle horror when using std::vector -
c# stupid severe issue loop !thank god you people, I've lost my mind one moment, I was gonna throw my laptop from the window :laugh:
-
c# stupid severe issue loop !so what is the best way to make the loop generate those numbers correctly? just by i.ToString("0.00")
-
c# stupid severe issue loop !wtf is hapening ? for(float i=-5.0f ; i<5.0f ; i+=0.1f) Console.WriteLine(i+"\n"); // with while float r=-5.0f; while (r < 5.0f) { Console.WriteLine(r+"\n");; r += 0.1f; } //output at -4.5 //-4,9 //-4,8 //-4,7 //-4,6 //-4,5 //-4,400001 <--- this is bullshit makes me angry :mad:
-
earning money (paypal) from a game ?I made a pool 8 ball, in nodejs where 2 players put some amount of money to the server before playing, the server where they send money to my paypal account using the client id and secret, but if a player wins he must earn (his money + the oponent money - as_server_I_take_some); so how can I send money to the winner, is there any implementation or transaction to be saved (I use node js paypal rest sdk).
-
how svd(singular decompostion value) works for matrix?I will check some math then !
-
how svd(singular decompostion value) works for matrix?thank you for you're post, I read all the algorithms, and remain all the same. I didn't get the idea of what they do, first lines of the loop they decompose it into qr, the diagonal in s and the super diagonal in e. but after ... too hairy (eigen values, eigen vectors)
-
how svd(singular decompostion value) works for matrix?Hi all! this algorithm written in c# : // Derived from LINPACK code. // Initialize. double[][] A = Arg; // m = Arg.RowDimension; // n = Arg.ColumnDimension; int nu = System.Math.Min(m, n); double[] s = new double[System.Math.Min(m + 1, n)]; double[][] U = new double[m][]; for (int i = 0; i < m; i++) { U[i] = new double[nu]; } double[][] V = new double[n][]; for (int i2 = 0; i2 < n; i2++) { V[i2] = new double[n]; } double[] e = new double[n]; double[] work = new double[m]; bool wantu = true; bool wantv = true; // Reduce A to bidiagonal form, storing the diagonal elements // in s and the super-diagonal elements in e. int nct = System.Math.Min(m - 1, n); int nrt = System.Math.Max(0, System.Math.Min(n - 2, m)); for (int k = 0; k < System.Math.Max(nct, nrt); k++) { if (k < nct) { // Compute the transformation for the k-th column and // place the k-th diagonal in s[k]. // Compute 2-norm of k-th column without under/overflow. s[k] = 0; for (int i = k; i < m; i++) { s[k] = System.Math.Sqrt(s[k] * s[k] + A[i][k] * A[i][k]); } if (s[k] != 0.0) { if (A[k][k] < 0.0) { s[k] = -s[k]; } for (int i = k; i < m; i++) { A[i][k] /= s[k]; } A[k][k] += 1.0; } s[k] = -s[k]; } for (int j = k + 1; j < n; j++) { if ((k < nct) & (s[k] != 0.0)) { // Apply the transformation. double t = 0; for (int i = k; i < m; i++) { t += A[i][k] * A[i][j]; } t = (-t) / A[k][k]; for (int i = k; i < m;
-
robot detecting algorithms ?That will the most beautiful day ! :)
-
robot detecting algorithms ?you said : but one cannot 'define' them because they are unique. if they are unique, sure they can be defined due to their unicity. the algorithm above, will be more understandable if it was in assembly or MSIL code, since it's very easy to examine each instruction and conclude the main idea and the objectif of the algorithm. As I say always, it's possible to figure what algorithms do, since every composition of instructions is unique.
-
robot detecting algorithms ?You're insisting you know, of course a computer can :) did you heard about Artificial Intelligence, Deep Learning ... We should just find the way even if it is difficult
-
Least squares conformal mapHello ! Can you mathmaticiens, help me ! I'm stuck for weaks to understand this;(least squares conformal mapping) In the file uvedit_parametrizer.c (in blender or any src code) this part of code : /* angle based lscm formulation */ ratio = (sina3 == 0.0f) ? 1.0f : sina2 / sina3; cosine = cosf(a1) * ratio; sine = sina1 * ratio; EIG_linear_solver_matrix_add(context, row, 2 * v1->u.id, cosine - 1.0f); EIG_linear_solver_matrix_add(context, row, 2 * v1->u.id + 1, -sine); EIG_linear_solver_matrix_add(context, row, 2 * v2->u.id, -cosine); EIG_linear_solver_matrix_add(context, row, 2 * v2->u.id + 1, sine); EIG_linear_solver_matrix_add(context, row, 2 * v3->u.id, 1.0); row++; EIG_linear_solver_matrix_add(context, row, 2 * v1->u.id, sine); EIG_linear_solver_matrix_add(context, row, 2 * v1->u.id + 1, cosine - 1.0f); EIG_linear_solver_matrix_add(context, row, 2 * v2->u.id, -sine); EIG_linear_solver_matrix_add(context, row, 2 * v2->u.id + 1, -cosine); EIG_linear_solver_matrix_add(context, row, 2 * v3->u.id + 1, 1.0); row++; (sparsematrix) prepares a matrix. what kind of eqaution is getting solved, Thanks!
-
robot detecting algorithms ?actually it's possible
-
robot detecting algorithms ?Hi! I'm thinking months of a bot(algorithm) that can detect algorithms(written in assembly or any language) and say what they are talking about. int factorial(int number){ int fact=1; for(int i=1;i<=number;i++){ fact*=i; } return fact; } the robot will read this(analyze it) and say to me that this is an algorithm that calculate factorial, it's a function that return an integer, what...(maybe he should execute it virtually, track registers, vars...) our technology is slow in development, we just invented computers, no robots yet :(
-
ampersand don't underline my first letter in labelby pressing the alt key, or using a timer with sendkeys.send("%"), or turning on 'the Hide keyboard navigation indicators until I use the Alt key on control panel' fixed this poblem :)
-
ampersand don't underline my first letter in labelwhy me?
-
ampersand don't underline my first letter in labelit's in c#, windows form; I followd the steps Label.UseMnemonic Property (System.Windows.Forms)[^] doesn't work
-
ampersand don't underline my first letter in labelhi! ampersand don't underline my label when i debug, usemenomic is true :(
-
tableadapter updating!of course by turning the read only false
-
tableadapter updating!Hi! can we update dataset tableadapter without changing from database?