Okay, I know that I’m doing something very stupid in the following code, but I can’t figure out what I forgot to do… I run the program and I never see it draw the single line I told it to… I copied most of this out of the OpenGL Redbook… I’m using MSVC++. Thanks

#include <gl/glut.h>

void DrawOneLine(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);

void DrawOneLine(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
		glVertex2f(x1, y1);
		glVertex2f(x2, y2);

void init()
	glClearColor(0.0, 0.0, 0.0, 0.0);

void display()
	glColor3f(1.0, 1.0, 1.0);
	glLineStipple(1, 0x0101);
	DrawOneLine(250.0, 125.0, 150.0, 125.0);

void reshape(int w, int h)
	glViewport(0, 0, (GLsizei) w, (GLsizei) h);
	gluOrtho2D(0.0, 0.0, (GLdouble) w, (GLdouble) h);

int main(int argc, char** argv)
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
	glutInitWindowSize(400, 150);
	glutInitWindowPosition(100, 100);
	return 0;

Ok, I now know that it isn’t a line stipple problem, but a problem drawing lines, polys, whatever in general… I just switched from AUX to GLUT, and this appears to be the problem… I just altered one of my old programs but I had no luck in getting it do display with the same code for everything else besides the windoing part…

Code is fine, you are just drawing outside the viewport.

Thanks, it appears that the version of the redbook that I’m reading is one that has been converted to glut, and there are some instances(like this one) where the port wasn’t done that well

Actually Dfrey…I have many lines outside the viewport and they appear just fine. But as it turns out, he is drawing his line within the viewport! I don’t think it would be the viewport problem but something else. My friends have had this similar problem where the program appears fine but when they run it at home, it runs fine. As soon as they run it at school, the line will either not draw or the line will draw as a regular line and not a stippled one. I think it may have something to do with either the video card setup or the Computer itself…but I’m not a hardware expert so I cannot speak in depth about those issues. But one thing I would recomend is a driver update “just in case” that could be the problem…

Cheers Guys!

[This message has been edited by yoda (edited 10-13-2000).]

No, it is the viewport problem. I tested his code verbatum (cut and paste) and then added two more lines to draw: (0,0)-(250,125) and (0,0)-(150,125). I could clearly see those 2 lines as they approach the one line he was drawing. See, his viewport’s X axis goes from -200 to 200, and his Y axis goes from -75 to 75, but he is drawing from (250,125) to (150,125). Both of those endpoints lie outside the viewport.

[This message has been edited by DFrey (edited 10-13-2000).]

Actually, I havent specified a scale yet, so on my computer it goes from -1.0, to 1.0 in all directions…(or so messing with it for a while led me to believe).

As yes, you are indeed correct. I simply figured gluOrtho2D did a unit to pixel mapping, as thats how I normally use glOrtho.
In the end I was still correct in why you weren’t seeing anything.

Yes DFrey…I’m sorry you are right!