Ich arbeite an einem Projekt, das ein Malprogramm mit OpenGL und GLUT auf C++ erstellt.Erstellen eines rechten Menüs auf C++ mit OpenGL
Bis jetzt habe ich ein Farbmenü auf der linken Seite und jetzt versuche ich, ein Werkzeugmenü auf der rechten Seite zu machen, aber ich kann nicht herausfinden, wie man es auf der rechten Seite bekommt.
Dies ist, was ich bisher:
int inwindow(int x, int y)
{
return (x > WLEFT && x < WRIGHT && y > WBOTTOM && y < WTOP);
}
static float colormenu[][8] = {{Red}, {Orange}, {Yellow}, {Green}, {Cyan}, {Blue}, {Purple}, {Black}};
int incolormenu(int x, int y)
{
return (x >= 0 && x <= MENUWIDTH && y >= 0 && y <= HEIGHT);
}
int colormenuindex(int x, int y)
{
if(!incolormenu(x, y))
return -1;
else
return(y/BOXHEIGHT);
}
static float toolmenu[][6] = {{Pencil}, {Line}, {Box}, {Rectangle}, {Circle}, {FCircle}};
int intoolmenu(int x, int y)
{
return (x >= 0 && x <= MENUWIDTH && y >= 0 && y <= HEIGHT);
}
int toolmenuindex(int x, int y)
{
if(!intoolmenu(x, y))
return -1;
else
return(y/BOXHEIGHT);
}
void drawSketch()
{
int i;
glClearColor(Grey, 1);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(Black);
for(i = 0; i < NCOLORS; i++)
{
glColor3f(colormenu[i][R], colormenu[i][G], colormenu[i][B]);
glRecti(1, BOXHEIGHT * i + 1, MENUWIDTH - 1, BOXHEIGHT * (i + 1) - 1);
}
for(i = 0; i < NCOLORS; i++)
{
glColor3f(toolmenu[i][Pencil], toolmenu[i][Line], toolmenu[i][Box]);
glRasterPos3f(0.2, -0.8, -1.5);
}
glFlush();
}
Was 'glRasterPos3f' soll in diesem Fall tun? – Mars
Was sind R, G und B im ersten 'glColor3f'? Und warum rufst du den zweiten mit einigen nicht verwandten Werten an? Welches Ergebnis erwartest du? – Mars