Commits

Alex Szpakowski  committed 4c62d46

Fixed smooth line primitives

  • Participants
  • Parent commits 8031875
  • Branches GLES2-compatibility

Comments (0)

Files changed (1)

File src/modules/graphics/opengl/Graphics.cpp

 void Graphics::setBlendMode(Graphics::BlendMode mode)
 {
 	Context::BlendState s;
-	
+
 	s.function = (mode == BLEND_SUBTRACTIVE) ? GL_FUNC_REVERSE_SUBTRACT : GL_FUNC_ADD;
 
 	switch (mode)
 	{
 		overdraw = new Vector[2*count+2];
 		// TODO: is there a better way to get the pixel size at the current scale?
-		GLfloat m[16];
-		glGetFloatv(GL_MODELVIEW_MATRIX, m);
+		const float *m = ctx->modelViewStack.back().getElements();
 		float det  = m[0]*m[5]*m[10] + m[4]*m[9]*m[2] + m[8]*m[1]*m[6];
 		det       -= m[2]*m[5]*m[8]  + m[6]*m[9]*m[0] + m[10]*m[1]*m[4];
-		pixel_size = 1.f / sqrt(det);
+		pixel_size = 1.f / sqrtf(det);
 
 		overdraw_factor = pixel_size / halfwidth;
 		halfwidth = std::max(.0f, halfwidth - .25f*pixel_size);