////////////////////////////////////////////
//render some text
//lighting should be disabled before calling this
//or we won't be able to set the color
//disable textures
glDisable(GL_TEXTURE_2D);
glDisable(GL_LIGHTING);
my_font.setPointSize(14);
//this is a required bug-fix
my_font.
setStyleHint(QFont::AnyStyle,
QFont::PreferBitmap);
glColor4f(1.0, 1.0, 1.0, 1.0);
//if they are viewing the earth/moon system
//from perspective view then show a label
if(view == 1){
renderText(27, 27, "The Earth & Moon from Perspective", my_font);
}
//if they are viewing the earth and moon from the sun
if(view == 2){
renderText(27, 27, "The Earth & Moon from the Sun", my_font);
}
//if they are viewing the moon from earth
//then iterate through the moon_coord_array
if(view == 3){
//render a label
renderText(27, 27, "The Moon from the Earth", my_font);
//now make the font size smaller
my_font.setPointSize(11);
for(int i=0; i<coord_array_index; i++){
double my_x = moon_coord_array[i].getX();
double my_y = moon_coord_array[i].getY();
QString my_label
= moon_coord_array
[i
].
getLabel();
renderText(my_x, my_y, my_label, my_font);
}
}
//if they are viewing the earth from the moon
if(view == 4){
renderText(27, 27, "The Earth from the Moon", my_font);
}
//re-enable lighting
glEnable(GL_LIGHTING);
//enable textures
glEnable(GL_TEXTURE_2D);
////////////////////////////////////////////
////////////////////////////////////////////
//render some text
//lighting should be disabled before calling this
//or we won't be able to set the color
//disable textures
glDisable(GL_TEXTURE_2D);
glDisable(GL_LIGHTING);
QFont my_font("Arial");
my_font.setPointSize(14);
//this is a required bug-fix
my_font.setStyleHint(QFont::AnyStyle, QFont::PreferBitmap);
glColor4f(1.0, 1.0, 1.0, 1.0);
//if they are viewing the earth/moon system
//from perspective view then show a label
if(view == 1){
renderText(27, 27, "The Earth & Moon from Perspective", my_font);
}
//if they are viewing the earth and moon from the sun
if(view == 2){
renderText(27, 27, "The Earth & Moon from the Sun", my_font);
}
//if they are viewing the moon from earth
//then iterate through the moon_coord_array
if(view == 3){
//render a label
renderText(27, 27, "The Moon from the Earth", my_font);
//now make the font size smaller
my_font.setPointSize(11);
for(int i=0; i<coord_array_index; i++){
double my_x = moon_coord_array[i].getX();
double my_y = moon_coord_array[i].getY();
QString my_label = moon_coord_array[i].getLabel();
renderText(my_x, my_y, my_label, my_font);
}
}
//if they are viewing the earth from the moon
if(view == 4){
renderText(27, 27, "The Earth from the Moon", my_font);
}
//re-enable lighting
glEnable(GL_LIGHTING);
//enable textures
glEnable(GL_TEXTURE_2D);
////////////////////////////////////////////
To copy to clipboard, switch view to plain text mode
Bookmarks