Ich bin neu zu OpenGL und GLM. Ich habe Online-Tutorials verfolgt, in der Hoffnung, eines zu finden, das funktioniert. Ein Tutorial sagt mir diese Schnipsel zu verwenden:Glm :: Value_ptr hat zu viele Argumente
//Define the screen width and height, and get the ratio
const float S_WIDTH = 800;
const float S_HEIGHT = 600;
const float S_RATIO = S_WIDTH/S_HEIGHT;
//In my shader "shdprog" get the uniform variable "ortho"'s location
GLuint orthoadr = glGetUniformLocation(shdprog, "ortho");
//Create a 4x4 matrix using glm
glm::mat4 ortho = glm::ortho(-S_RATIO, S_RATIO, -1.f, 1.f, -1.f, 1.f);
//Set the custom GLSL "ortho" uniform to the value of the glm::mat4 ortho
glUniform4fv(orthoadr, 1, GL_FALSE, glm::value_ptr(ortho)/*too many arguments in function call*/);
Aus welchem Grund auch immer, Visual Studio sagt mir, dass glm::value_ptr()
zu viele Argumente hat („zu viele Argumente in Funktionsaufruf“). Selbst wenn Sie alle Argumente entfernen, ändert sich nichts.
Ist mein Tutorial falsch? Oder habe ich etwas vertippt?
Bitte senden Sie eine [MCVE], zusammen mit der genauen Fehlermeldung, die Sie erhalten. –
Entschuldigung. Ist das besser? –
Das ist nicht dein Problem, aber 'const float S_RATIO = S_WIDTH/S_HEIGHT' ergibt einen Wert von 1. Du machst * integer * math, was zu einem Integer führt, das dann in float umgewandelt wird. 800/600 ist 1, wenn Sie auf die nächste Ganzzahl runden. –