Commit c8480e25 authored by Vitaly Budovski's avatar Vitaly Budovski Committed by Alexandre Julliard

wined3d: Fixed some typos and prevented divide by 0.

parent d6201e23
......@@ -3502,7 +3502,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
{
/*
* POINTSCALEENABLE controls how point size value is treated. If set to
* true, the point size is scaled with repsect to height of viewport.
* true, the point size is scaled with respect to height of viewport.
* When set to false point size is in pixels.
*
* http://msdn.microsoft.com/library/en-us/directx9_c/point_sprites.asp
......@@ -3512,13 +3512,15 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
GLfloat att[3] = {1.0f, 0.0f, 0.0f};
/*
* Minium valid point size for OpenGL is 1.0f. For Direct3D it is 0.0f.
* Minimum valid point size for OpenGL is 1.0f. For Direct3D it is 0.0f.
* This means that OpenGL will clamp really small point sizes to 1.0f.
* To correct for this we need to multiply by the scale factor when sizes
* are less than 1.0f. scale_factor = 1.0f / point_size.
*/
GLfloat pointSize = *((float*)&This->stateBlock->renderState[D3DRS_POINTSIZE]);
GLfloat pointSize = *((float*)&This->stateBlock->renderState[WINED3DRS_POINTSIZE]);
if(pointSize > 0.0f) {
GLfloat scaleFactor;
if(pointSize < 1.0f) {
scaleFactor = pointSize * pointSize;
} else {
......@@ -3533,6 +3535,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
att[2] = *((float*)&This->stateBlock->renderState[WINED3DRS_POINTSCALE_C]) /
(This->stateBlock->viewport.Height * This->stateBlock->viewport.Height * scaleFactor);
}
}
if(GL_SUPPORT(ARB_POINT_PARAMETERS)) {
GL_EXTCALL(glPointParameterfvARB)(GL_POINT_DISTANCE_ATTENUATION_ARB, att);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment