Possibility to CreateTextureFromSurface without copying for SoftwareRendering

Hello, is it possible or someone already have realization of CreateTextureFromSurface for Software Rendering without copying.

Those seem to be two different things from what I can tell. Textures are all hardware accelerated. If you’re using software rendering, just use surfaces and you should be good.

Difference between surface and texture (SDL / general)

Problem is fillRect for Surface is not the same with fillRect for Rendering, it doesn’t support alpha blending now. But this is not the primary problem, I need to support several platforms and only one doesn’t have hardware acceleration.

SDL_SetSurfaceBlendMode
SDL_SetRenderDrawBlendMode

Both of those set the draw mode and have this:

SDL_BLENDMODE_BLEND

alpha blending

dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))

dstA = srcA + (dstA * (1-srcA))

Do those not work for you? Where do you see that it isn’t supported right now?

/**

  • Performs a fast fill of the given rectangle with \c color.
  • If \c rect is NULL, the whole surface will be filled with \c color.
  • The color should be a pixel of the format used by the surface, and
  • can be generated by the SDL_MapRGB() function.
  • \return 0 on success, or -1 on error.
    */
    extern DECLSPEC int SDLCALL SDL_FillRect
    (SDL_Surface * dst, const SDL_Rect * rect, Uint32 color);

this method doesn’t support alpha blend and blend mode, only fill RGB color, also Surface doesn’t have a drawPoint, drawLine etc methods.

Ohhhh, derp. The fillRect functions do a simple fill of the current drawing color. Sorry, been a long week for me building a shed out in 100+ weather.

I looked into the code, and I see that they are supposed to use blend modes. You have to use the two functions I posted earlier to set the blend modes before calling the fillRect functions.

As for the line and point drawing, that I can’t help with at this time. Sorry again.

No. It doesn’t support alphablend.

You should look into SDL_GFX lib, pretty sure you can draw lines and rects that fill with an alpha value using surface.