From Sythical:
Hello, I've created a simple SDL2 application which draws a texture on the screen. The problem I'm having is that if I launch another program which loads the UAC popup or if I lock my PC and then login again, the application stops drawing the texture. I tried adding SDL_Delay(10000) after SDL_RenderPresent(renderer). This made the texture stay on the screen for a little bit but the texture wasn't drawn again after the delay. Here's my code:
#include "SDL.h"
int main(int argc, char *argv[])
{
SDL_Renderer *renderer;
SDL_Window *window;
SDL_Surface *surface;
SDL_Texture *rect_texture;
SDL_Event main_event;
SDL_Rect rect_data;
int enable_vsync = 1;
if(SDL_Init(SDL_INIT_VIDEO) < 0) return 1;
window = SDL_CreateWindow("SDL2 Application", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 600, 600, SDL_WINDOW_RESIZABLE);
renderer = SDL_CreateRenderer(window, -1, enable_vsync ? SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC : SDL_RENDERER_ACCELERATED);
SDL_SetRenderDrawColor(renderer, 20, 20, 30, 255);
surface = SDL_LoadBMP("icon.bmp");
rect_texture = SDL_CreateTextureFromSurface(renderer, surface);
rect_data.w = 32; rect_data.h = 32;
rect_data.x = 300; rect_data.y = 300;
while(main_event.type != SDL_QUIT)
{
SDL_PollEvent(&main_event);
SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, rect_texture, NULL, &rect_data);
SDL_RenderPresent(renderer);
}
SDL_DestroyTexture(rect_texture);
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
Anisotropic filtering is meant to be used for textures at a stark
angle, not perpendicular to the camera.
--HG--
extra : rebase_source : e01c4da3bae7f1628de7c049f31f1208dbbbb24c
Bithika Mookherjee
SDL_RenderSetClipRect() calls into renderer->UpdateClipRect(renderer).
I am not sure if UpdateClipRect() can point to a number of clip rect update functions, but on my platform it calls D3D_UpdateClipRect().
In that function, the rect to pass to IDirect3DDevice9_SetScissorRect() has it's right field set as:
r.right = rect->w + rect->w;
But actually, this should be:
r.right = rect->x + rect->w;
This lets us change things like this...
if (Failed) {
SDL_SetError("We failed");
return -1;
}
...into this...
if (Failed) {
return SDL_SetError("We failed");
}
Fixes Bugzilla #1778.
kmx
I have investigated the warning "Failed loading D3DX9_*.dll" and come up with the enclosed patch (please forward it to relevant SDL2 mailing list/bugtracker).
Evgeny
static void
D3D_DestroyRenderer(SDL_Renderer * renderer)
has a critical problem. It may try to release IDirect3DSurface9 surface pointed
by NULL pointer. That leads to really wierd consequences on my system.
It happens when the previous call to IDirect3D9_CreateDevice() fails leaving
D3D_RenderData::defaultRenderTarget uninitialized.
Spinduluz
RenderTarget has to be released before a device reset is done. It's a
D3DPOOL_DEFAULT surface (resides in video memory and have to be recreated).
- Added new SDL_HINT_ALLOW_TOPMOST hint, when set to "0" then never set the topmost bit on a window. Useful when debugging fullscreen issues.
- fixed crash in windows joystick scanning if we failed to load the xinput dll
- added support for SDL_WINDOW_FULLSCREEN_DESKTOP under windows
- synthesize relative mouse movements if directinput fails to send relative moves, happens under virtual box.
Jonas Thiem 2011-11-29 12:28:02 PST
Direct3D renderer should set D3DCREATE_FPU_PRESERVE for not behaving vastly
different to OpenGL/software rendering on doubles and break some libraries
really badly.
Most notable affected example: Lua, which does the most unpredictable things
which are really almost impossible to debug/find out for beginners who never
heard this culprit exists.
Since I believe all renderers should behave the same on that doubles simply
work as expected in a program, this should really be changed! (also this wasted
a few days of my life wondering why everything in my program was so broken)
The render viewport is automatically re-centered when the window changes size, so applications that don't care will not have to handle recalculating their rendering coordinates.
Fixed API for drawing and filling multiple rectangles - the parameter should be an array of rects, not an array of pointers to rects.
Fixed API for updating window rects for consistency with other APIs - the order is pointer to array followed by count in array.