PDA

View Full Version : Problems with 2D graph



hariparisodhana
04-23-2004, 06:36 PM
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

plasmonster
04-23-2004, 06:52 PM
It might help to know how you are drawing the graph: points, lines, polys?

ZbuffeR
04-24-2004, 01:29 AM
... maybe using GLdouble coordinates will help too.

hariparisodhana
04-24-2004, 06:36 AM
i am using the glortho to draw only graphs of lines that is all but is there another way without using glortho?

plasmonster
04-24-2004, 02:53 PM
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();
...