0

私はopenglにかなり慣れていないので、glColor3f、glVertex2f、およびpRectという関数が見つからないというエラーが表示されます。私の含まれているものは

#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef MAC
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif

問題のコードは次のとおりです。

void display()
{
    // Rotate objects
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    //glMatrixMode(GL_MODELVIEW);
    //glLoadIdentity();

    glBegin(GL_QUADS);   //We want to draw a quad, i.e. shape with four sides
    glColor3F(1, 0, 0); //Set the colour to red
    glVertex2F(0, 0);            //Draw the four corners of the rectangle
    glVertex2F(0, pRect->h);
    glVertex2F(pRect->w, pRect->h);
    glVertex2F(pRect->w, 0);
    glEnd();
    glPopMatrix();

    //glFlush();
}

必要なファイルをすべて含めていると思います。コンパイルするときは、次のコマンドを使用します。

g++ main.cpp -lgut -IGL -IGLU 

しかし、それも問題ではないようです。どんなアドバイスも素晴らしいでしょう!どうもありがとう!

編集:変更

 g++ main.cpp -lgut -IGL -IGLU 

g++ main.cpp -lgut -lGL -lGLU 

エラーコードは次のとおりです。

 glColor3F : not declared in this scope
 glVertex2F : not declared in this scope
 pRect: not declared in this scope
4

0 に答える 0