-
Obese OGL Lines???
Heyo all, I'm having a bit of a strange problem. The following segment of my app:
PHP Code:
glDisable(GL_BLEND);
glLineWidth(1.0);
glColor3f(0.0, 0.0, 0.0);
glBegin(GL_LINE_LOOP);
point.m_i = 0 - NODE_CLEARANCE;
point.m_j = 0 - NODE_CLEARANCE;
WindowToGlCoords(MakeWindowCoords(point)).glVertex3d();
point.m_i = doc.width - 1 + NODE_CLEARANCE;
WindowToGlCoords(MakeWindowCoords(point)).glVertex3d();
point.m_j = doc.height - 1 + NODE_CLEARANCE;
WindowToGlCoords(MakeWindowCoords(point)).glVertex3d();
point.m_i = 0 - NODE_CLEARANCE;
WindowToGlCoords(MakeWindowCoords(point)).glVertex3d();
glEnd();
glEnable(GL_BLEND);
// note to those reading this code:
// WindowToGlCoords basically just inverts the y coord
// MakeWindowCoords converts the units relative to the
// origin of the active document to relative to the window
// point is a variable of type Vector (a 3d vector class
// I made for my app.
// The two aforementioned functions take and return vectors
// the glVertex3d member function of the Vector class
// calls opengl's glVertex3d function with the coords of the vector
// In breif: the problem does not lie there, as i've tried using
// static coords with the same results.
...is drawing lines that are *2* pixels in width. If I increase the line width, the outputted line width increases, if it take it down to (for example) 0.001 it still takes up 2 pixels in the ouput, when logically it should take 1 or none, rite?... My viewport is scaled (and tested at this because I'm drawing other things - chiefly little circles) so that one pixel equals one gl unit, but it also acted in this way when I had the window scaled so the gl units went from -1 to 1 from left to right and bottom to top of my window.
Another problem that might be related (and thus possibly help diagnose the problem???) is that if blending is enabled while I paint a white rectangle:
PHP Code:
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_QUADS);
point.m_i = 0 - NODE_CLEARANCE;
point.m_j = 0 - NODE_CLEARANCE;
WindowToGlCoords(MakeWindowCoords(point)).glVertex3d();
point.m_i = doc.width - 1 + NODE_CLEARANCE;
WindowToGlCoords(MakeWindowCoords(point)).glVertex3d();
point.m_j = doc.height - 1 + NODE_CLEARANCE;
WindowToGlCoords(MakeWindowCoords(point)).glVertex3d();
point.m_i = 0 - NODE_CLEARANCE;
WindowToGlCoords(MakeWindowCoords(point)).glVertex3d();
glEnd();
...then it displays a very very thin diagonal grey line through my window, which is not visible when I turn off blending.
Anyone got any ideas on whats going on? :confused: :(
Thanks,
Jeff
-
I guess it might help if I post a zip of my app so you can see what's happening, its probably some really simple stupid mistake I'm making setting up OpenGL or something - Í've never used it before this project.
I'm at work on my lunch break atm, but i'll post it when I get home.
Thanks all,
Jeff
-
Ok, I've zipped (well... "rar"ed actually) my project up and uploaded it to http://members.optushome.com.au/jeff..._pre_alpha.rar
For those kind enough to look at it, the (msvc++6) workspace should open showing my painting function. The function that initialized opengl is in glfuncs.h.
Thanks all for your time and any help you can provide!
-jEFF