#2 Members - Reputation: 1670
Posted 02 July 2012 - 12:46 PM
My guess is you want to use the floating-point coordinates to blit at interpolated locations? Usually blitting just puts pre-rendered objects (to include fully-rendered back buffers) onto the screen at screen-contextual coordinates.
#3 Members - Reputation: 305
Posted 02 July 2012 - 03:31 PM
If your coordinates are (0.5, 0.25), simply multiply them by the maximum absolute integer coordinates and convert to integer.
Or: ((int)(0.5 * 1024), (int)(0.25 * 768)).
If you want something more precise, you'll have to supply more information.
#4 Members - Reputation: 126
Posted 02 July 2012 - 06:28 PM
#5 Members - Reputation: 787
Posted 02 July 2012 - 07:20 PM
#6 Members - Reputation: 1947
Posted 03 July 2012 - 03:19 AM
However, blitting is only the second best thing you can do anyway. Draw a textured quad (or two triangles) instead. Using OpenGL through SDL is well supported.
Not only does this solve your coordinate issue, but it is also fully accelerated in hardware on every card sold during almost two decades.
#7 Members - Reputation: 200
Posted 03 July 2012 - 06:25 AM
Also note that SDL 1.3 (now known as 2) renders with OpenGL, so it's probably better to use it, unless you have a special case which needs manual optimizations (like getting millions of sprites on the screen, which you will never really need).
#8 Members - Reputation: 1947
Posted 03 July 2012 - 07:43 AM
1. No, it doesn't. It's a completely different thing.The graphics card (driver?) does the same exact thing.
Also note that SDL 1.3 (now known as 2) renders with OpenGL
2. Yes, but as I am trying to point out, there is a huge difference between e.g. glDrawPixels and glDrawElements.
One is deprecated OpenGL 1.2 functionality, which is an entirely different pipeline (with kernels, color matrix and whatnot, see imaging subset) that has always been kind of of half-heartedly supported.
The other is the fully accelerated, native way of drawing textured geometry (such as a quad) using dedicated hardware.
Which, on my system, makes a difference of roughly 1 to 10. Your mileage may vary.
Edited by samoth, 03 July 2012 - 07:44 AM.
#9 Crossbones+ - Reputation: 3518
Posted 03 July 2012 - 07:55 AM
There is a way to reach subpixel level, it's called multisampling, but you don't need it now. It's notably used to "smooth out" the edges in games (anti-aliasing), but can be used to simulate the effect of a displacement of, say, half a pixel. For instance, if you were to displace a black pixel, half a pixel to the left, you would end up (theoretically) with two adjacent, gray, pixels. If you were simulating a displacement of a quarter of a pixel, you would end up with one light gray pixel, and another darker pixel. Get the idea?
But you don't need it now. Just do your logic in floating-point and render as integers, that's how it's usually done when drawing directly into pixels.
#10 Moderators - Reputation: 4635
Posted 03 July 2012 - 07:59 AM
Neither is deprecared, and with GPU-side pixel buffers I can imagine that drawing pixel rectangles are much more efficient than before. I have not looked into pixel drawing in the modern era though, so I would like to know how modern use of pixel rectangles actually perform.2. Yes, but as I am trying to point out, there is a huge difference between e.g. glDrawPixels and glDrawElements.
One is deprecated OpenGL 1.2 functionality, which is an entirely different pipeline (with kernels, color matrix and whatnot, see imaging subset) that has always been kind of of half-heartedly supported.
The other is the fully accelerated, native way of drawing textured geometry (such as a quad) using dedicated hardware.
Which, on my system, makes a difference of roughly 1 to 10. Your mileage may vary.
edit: Actually, I take part of the above back: glDrawPixels itself is in fact deprecated. I realized that shortly after posting. There is, however, glBlitFramebuffer for somewhat the same functionality instead.
Edited by Brother Bob, 03 July 2012 - 08:09 AM.






