DrawLine affected by glPointSize

BlitzMax Forums/BlitzMax Programming/DrawLine affected by glPointSize

A while back, an optional parameter was added to the DrawLine command to draw the last pixel in the line. This last pixel is obviously being drawn with a Plot command, but as you can see in the example code below, this results in the last pixel being affected by glPointSize() when using the GLMax2DDriver().

I know it's not technically a bug, but something that had me stumped for a while until I remembered the 'draw_last_pixel' thing.

SetGraphicsDriver GLMax2DDriver()

Graphics 800, 600

While Not KeyHit( KEY_ESCAPE ) = True

	Cls
	
	glPointSize 5.0
	SetColor 255, 0, 0
	DrawLine 400, 300, 500, 400
	
	Flip

Wend
End


Hi,

There are many OpenGL calls you can make that will affect the operation of Max2D in GL mode like this.

The solution is simple: if you want to use GL while using Max2D, you *must* save and restore any GL state you modify.

I presume also changing the line thickness would NOT change the thickness of the last pixel plotted.