Hi. I need to plot a 3D graphic using OpenGL. Y display labels with the numbers of the axis using GL_QUADS. The axis and the graphic can be rotated but i need the labels to face always front so they’ll be readable by user.
This is my code, comented to explain what i do in each line:
//Get the modelview matrix with rotations and translations
//Store the matrix
//Load identity matrix
//Store the position into an array
//I’m sure the coordinates are right cause i use them
//to draw the axis
position = width+2;
position = YAxisCut;
position = ZAxisCut;
position = 1.0f;
//This function multiplies mv x position and stores
//the resulting vector into position2
transformarVector(position, mv, position2);
//Translate to position2 coordinates. That’s where i might
//be wrong; I’m supposing that being working with the
//identity matrix and multiplying my coordinates by
//the modelview matrix, i will get the correct coordinates
//to work with the identity matrix
glTranslatef(position2, position2, position2);
//Once i’m translated to the point, i can draw the label
//I need to be working with the identity matrix to
//draw it always facing front the screen
point.x = 0; point.y = 0; point.z = 0;
//This function draws the label with point as center.
//It works well and draws the label facing front. What have
//to be wrong is the point which i translated to.
//Restore the matrix for future drawing
I don’t know if the entire idea is wrong or if i’m doing someting wrong.
If you have another idea or see something wrong in my code, please tell me.
Sorry about my poor English; hope you can understand it.
Thanks in advance.