cometlinear
25th September 2006, 07:53
Hi all,
Over the weekend, I ported my OpenGl application from Qt3 to Qt4. Everything went fine, except that renderText is now rendering the text *behind* my geometry in the projection matrix (perspective). I am still only passing the X and Y coordinates to the function. Again, I did not change anything from Qt3 to Qt4.
Has anyone experienced this? Anyone know the solution? The relevant code is pasted below.
Thanks!! Kindest regards,
-joshua
////////////////////////////////////////////
//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);
////////////////////////////////////////////
Over the weekend, I ported my OpenGl application from Qt3 to Qt4. Everything went fine, except that renderText is now rendering the text *behind* my geometry in the projection matrix (perspective). I am still only passing the X and Y coordinates to the function. Again, I did not change anything from Qt3 to Qt4.
Has anyone experienced this? Anyone know the solution? The relevant code is pasted below.
Thanks!! Kindest regards,
-joshua
////////////////////////////////////////////
//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);
////////////////////////////////////////////