question

FyMa2618-9573 avatar image
0 Votes"
FyMa2618-9573 asked JeanineZhang-MSFT commented

Visual Stuido C++ / OpenGL question

Good day,
i try to pogramm a Triangle whit OpenGl (glew and GLFW)i´ve rigth noiw do it the 2th time because i forget to save, but when i start to type in glBufferData and in that my data it came a error calledto many arguments in this function(See code downside).
Thanks in advance.``
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <iostream>

 int main(void)
 {
     GLFWwindow* window;
    
    
    
     /* Initialize the library */
     if (!glfwInit())
         return -1;
    
        
     /* Create a windowed mode window and its OpenGL context */
     window = glfwCreateWindow(640, 480, "GotGames-Engine", NULL, NULL);
     if (!window)
     {
         glfwTerminate();
         return -1;
     }
    
    
     /* Make the window's context current */
     glfwMakeContextCurrent(window);
    
     //Auf fehler überprüfen
     if (glfwInit() != GLEW_OK)
         //wen ja schreibe in Konsole ...
         std::cout << "error Noobs!" << std::endl;
    
     //Print Version in Console
     std::cout << glGetString(GL_VERSION) << std::endl;
    
     //Position für ein Buffer, Wie viele in []
     float position[6] =
     {
         -0.5f, -0.5f,
          0.0f, 0.5f,
          0.5f, -0.5f
     };
    
     //Buffer erstellen (ID)
     unsigned int buffer;
     //Buffer generienren, Wie viele Buffer generiert werden sollen, Buffer(unsigned int festlegen)
     glGenBuffers(1, &buffer);
     //Buffer festlgeen, (Vermutlich)Typ, Buffer auswählen
     glBindBuffer(GL_ARRAY_BUFFER, buffer);
     //Daten festlgen, (Vermutlich)Typ, Nummer die in den Float Position festgelegt habe., Formation (Position)
     glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(float), position, GL_STATIC_DRAW);
    
    
     /* Loop until the user closes the window */
     while (!glfwWindowShouldClose(window))
     {
         /* Render here */
         glClear(GL_COLOR_BUFFER_BIT);
    
        // glBegin(GL_TRIANGLES); out
        // glVertex2f(-0.5f, -0.5f); out
        // glVertex2f(0.0f, 0.5f); out
        // glVertex2f(0.5f, -0.5f); out
        // glEnd(); out
    
         /* Swap front and back buffers */
         glfwSwapBuffers(window);
    
         /* Poll for and process events */
         glfwPollEvents();
     }
    
     glfwTerminate();
     return 0;
 }
c++
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@FyMa2618-9573

According to your description, as far as I'm concerned, it is related to OpenGL, I suggest you could post the issue to Khronos Community Forums for better help.


0 Votes 0 ·

0 Answers