Problems with 2D graph

I am using the gluOrhto2D() to define the area
in which graph is to be drawn but, this makes
the graph look ugly for very small values of right and left positions in the function

is there any other way to draw graphs other
than glOrtho and gluOrho2D
please help me out

thank you

It might help to know how you are drawing the graph: points, lines, polys?

… maybe using GLdouble coordinates will help too.

i am using the glortho to draw only graphs of lines that is all but is there another way without using glortho?

I’m assuming that you’re using glOrtho(…) because you want a 2D projection, and you have made the right choice. I doubt this is your problem, unless you are using extremely exotic values in the glOrtho(…) call.

the graph look ugly for very small values of right and left positions in the function

For this kind of problem, antialiasing might be what you need. Try something like this for drawing lines:


glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
// can be any width within hardware limits
glLineWidth(1.41);
glBegin(GL_LINES);
…draw your lines
glEnd();