Jump to content
  • Advertisement
Sign in to follow this  
Esmo2000

OpenGl linewidth function doesn't work

This topic is 4573 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi All! I'm writing a program that only has to do some very basic things (Its being used for modelling some basic polygons). I want to make the lines thicker, but, call glLineWidth() does not seem to change the size of the lines I'm drawing no matter what. Can anyone suggest why not? I thought you might need some code snippets of where I did init code etc... Thanks!! int main(int argc, char** argv) { glutInit(&argc, argv); initGraphics(); glutMainLoop(); return 0; } void initGraphics() { glHint(GL_POINT_SMOOTH_HINT, GL_FALSE); glPointSize(1.0); glLineWidth(10.0f); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); glutInitWindowSize(Width,Height); glutInitWindowPosition(400,400); glutCreateWindow("Bounding box application"); glutDisplayFunc(drawDisplay); glutReshapeFunc(resizeFunc); } void resizeFunc(int w, int h) { if (h<=0) h=1; glViewport(0,0,w,h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0,w,h,0); glMatrixMode(GL_MODELVIEW); Width=w; Height=h; }

Share this post


Link to post
Share on other sites
Advertisement
I don't know how glut works, but perhaps the problem is that you call glLineWidth before glutInitDisplayMode. Maybe OpenGL is not ready to receive calls until after the glutInitDisplayMode function runs.Try moving the call to glLineWidth to right before you draw the lines.

Sorry if that's way off the mark.

Share this post


Link to post
Share on other sites
Almost correct, the context is not created at the time. But you have to move it after glutCreateWindow; that's where the context is created.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!