sdl

SDL2: Generate fully transparent texture

◇◆丶佛笑我妖孽 提交于 2019-12-04 08:38:34
问题 How using SDL_CreateTexture create transparent texture? By default I'm creating texure with such code: SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888,SDL_TEXTUREACCESS_TARGET, x, y); And then I'm paining on this texture with redirecting output to this texture. However at the end what I want to render this on screen any (nonupdated) pixel is black. I have tried different ways with using of: SDL_RenderClear(_Renderer); or even with drawing and on created texture with painting transparent

Current state and solutions for OpenGL over Windows Remote

为君一笑 提交于 2019-12-04 08:05:48
OpenGL and Windows Remote don't play along nicely. Solutions for this are dependent on the use case and answers are fragmented across the vast depths of the net. This is a write-up I wish existed when I started researching this, both for coders and non-coders. Problem: A RDP session of Windows does not expose the graphics card, at least not directly. For instance you cannot change the desktop resolution and GraphicsCard drivers usually just disable their setting menus. Starting a OpenGL context higher than v1.1 fails because of this. The, especially in support IRCs, often suggested "Don't use

Porting SDL App to iOS

拜拜、爱过 提交于 2019-12-04 07:20:46
I have created a small game in C++ using only SDL (no OpenGL), and want to port it to iOS 6. I have no intention of releasing it publicly, It's just for personal use. The app uses only the barebones SDL library itself, no ttf or image. So, what would be the best hassle-free way of porting the game to iOS 6? The game's SDL version is 1.2, however it would be possible to port it to 2.0. A tutorial or something similar would be of tremendous help! Thanks Port to 2.0, then just follow the SDL 2.0 iOS HOWTO . SDL 2.0 has native iOS support. 来源: https://stackoverflow.com/questions/23063659/porting

How to avoid tearing with pygame on Linux/X11

故事扮演 提交于 2019-12-04 06:24:33
I've been playing with pygame (on Debian/Lenny). It seems to work nicely, except for annoying tearing of blits (fullscreen or windowed mode). I'm using the default SDL X11 driver. Googling suggests that it's a known issue with SDL that X11 provides no vsync facility (even with a display created with FULLSCREEN|DOUBLEBUF|HWSURFACE flags), and I should use the "dga" driver instead. However, running SDL_VIDEODRIVER=dga ./mygame.py throws in pygame initialisation with pygame.error: No available video device (despite xdpyinfo showing an XFree86-DGA extension present). So: what's the trick to

How to convert an OpenCV IplImage to an SDL_Surface?

只谈情不闲聊 提交于 2019-12-04 05:35:35
I'm trying to write a program which takes an SDL_Surface , converts it to an IplImage , uses the cvBlobsLib to find blobs, paints the blobs as spots back over the image, then converts the output IplImage back to an SDL_Surface . I'm almost done: only converting the IplImage back to an SDL_Surface hasn't been done yet. This IplImage has 3 image channels and is 8 bits per pixel. I think I have two calls I can use: SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); SDL_Surface *SDL_CreateRGBSurfaceFrom(void

Inputs in SDL (on key pressed)

杀马特。学长 韩版系。学妹 提交于 2019-12-04 05:18:42
I would like to know how can I detect the press of a key or release of a key in a while loop in SDL. Now, I know you can get the events with SDL like OnKeyPressed, OnKeyReleased, OnKeyHit, etc, but I want to know how to build functions like 'KeyPressed' that returns a boolean, instead of being an event. Example: while not KeyHit( KEY_ESC ) { //Code here } I know you have already selected an answer.. but here is some actual code of how I typically do it with one array. :) first define this somewhere. bool KEYS[322]; // 322 is the number of SDLK_DOWN events for(int i = 0; i < 322; i++) { // init

Maximize SDL window

为君一笑 提交于 2019-12-04 03:54:51
How should I tell SDL to maximize the application window? I'm creating the window with these flags: SDL_OPENGL | SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_RESIZABLE. Judge Maygarden This functionality is controlled by the window manager when you use the SDL_RESIZABLE flag. To simulate the maximizing a window with SDL you would need to first determine the size the window would occupy when maximized. Then you would call SDL_SetVideoMode with this size after placing the window with the SDL_VIDEO_WINDOW_POS environment variable . If you truly need the window to be maximized as if you had clicked on the

How to disable vsync on macOS

别等时光非礼了梦想. 提交于 2019-12-03 23:45:30
With all my SDL/OpenGL programs, the framerate is stuck at 60fps, so looks like the vsync is enable, but not by me, nor in my code or my settings. so i would like to now if there is a way to disable it, maybe in some deep macOS settings? This enabled me to get around ~700 frames per second on my MacBook Pro. Download Graphics Tools for Xcode - Late August 2014 Install or just mount Graphic Tools Open Quartz Debug Go to Tools -> Show Beam Sync Tools Select Disable Beam Synchronization It is not permanent either, perfect for testing/benchmarking. Source Brett Hale Welcome to SO. I outlined an

What is a Blit in SDL?

别来无恙 提交于 2019-12-03 22:32:34
In the SDL wiki it says Use this function to perform a fast blit from the source surface to the destination surface. However that doesn't help me much. What does the term surface blitting mean in this context? Radomir Dopieralski Basically it means copying the image from one surface to another -- possibly cropped and shifted. Blitting means bit-boundary block transfer as defined by Wikipedia or Block Information Transfer , well known among the Pygame developers. Assume you have a Surface(your screen). And you would like to draw a circle on the screen. So what you want to do is, draw the circle

Compiling SDL on a MAC

元气小坏坏 提交于 2019-12-03 22:13:57
问题 #include "ffmpeg/libavcodec/avcodec.h" #include "ffmpeg/libavformat/avformat.h" #include "ffmpeg/libswscale/swscale.h" #include "ffmpeg/libswscale/rgb2rgb.h" #include "ffmpeg/libswscale/swscale_internal.h" #include <stdio.h> #ifdef __MINGW32__ #undef main /* Prevents SDL from overriding main() */ #endif #include "SDL.framework/Headers/SDL.h" #include "SDL.framework/Headers/SDL_thread.h" Is Compiled with this command: gcc -o t1 tutorial01.c -lswscale -lavutil -lavformat -lavcodec -lz -lavutil