| Summary: | co-ordinate positioning incorrect with gl renderer | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Mark.Howson |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | ono |
| Version: | HG 2.0 | ||
| Hardware: | All | ||
| OS: | Windows (XP) | ||
| Attachments: | Due commit r4722 image slightly off down on testoverlay2 with white stripe above at MacOSX | ||
Thanks! This is fixed with revision 4722 Created attachment 378 [details]
Due commit r4722 image slightly off down on testoverlay2 with white stripe above at MacOSX
Regression!! ---------- Commit r4722 causes the image in testoverlay2 or drawlines2 to be shifted down and having a random junk strip above (see attached screenshot). This is very ugly hack and with most of OpenGL manuals you need to set: glOrtho(0.0, (GLdouble) window->w, (GLdouble) window->h, 0.0, 0.0, 1.0); to have pixel accuracy, so the code was OK before the change. -0.5 hack is IMHO unacceptable here. The bug author/originator probably uses glEnable(GL_LINE_SMOOTH) & glEnable(GL_POINT_SMOOTH) which causes described 2-pixel thick lines on some graphic drivers. GL_LINE_SMOOTH is known to be quite driver-dependent and sluggish. For the sake of exact coordinate mapping please rollback this fix. Lines are mapped exactly when GL_LINE_SMOOTH (default SDL behavior). Feedback ------- The bug author should first specify exactly the context of this bug, which OpenGL implementation he uses (OS?) and whether he uses custom OpenGL settings (via glParameter, glHint or glEnable). > For the sake of exact coordinate mapping please rollback this fix. Lines are
> mapped exactly when GL_LINE_SMOOTH (default SDL behavior).
I meant that lines are mapped OK with previous glOrtho code when GL_LINE_SMOOTH are OFF which is default SDL and OpenGL state, so -0.5 is just causing trouble here.
Okay, I left GL_LINE_SMOOTH off and reverted the -0.5 pixel offset. Can you retest this bug? I have the r4722 reverted in my SVN and I can confirm everything is fine then (no junky stripe above). |
Using the opengl renderer on SVN 1.3 r4683, I find that pixel positioning is slightly off for rendering primitives. For example, the top visible pixel here is (0,1) : SDL_RenderPoint(0, 0) is not visible. This also affects line primitives : SDL_RenderLine(30, 2, 40, 2) draws a line '2' pixels thick, rather than the 1 that might be expected. I think these is due to opengl pixel positioning. I'm not sure if this is the most 'correct' fix, but here I've changed: video/SDL_renderer_gl.c line 452-ish: data->glOrtho(0.0, (GLdouble) window->w, (GLdouble) window->h, 0.0, 0.0, 1.0); to: data->glOrtho(-0.5, (GLdouble) window->w-0.5, (GLdouble) window->h-0.5, -0.5, 0.0, 1.0); With this pixels on line 0 and window->h-1 appear correctly. Thanks for reading.