The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
video context layout for SDL window
pheonix


Joined: 01 Apr 2015
Posts: 1
Having a problem trying to attach a 4bit indexed buffer to a SDL_window. Currently the only method I've been able to devise is convert my video buffer to a 24bit bmp buffer, write buffer to bmp file, open file with SDL, blit to surface, update window. I am using a 320x200 window, setting window mode seems to have no effect, seems window tied to entire video port, not just the windows viewport. I am trying to write 64k*4 buffer to the window. Buffer has 2 pages, 8 pixels per byte, 4 bit planes. A pixel read is 4 planes, at say address 0 with mask of 0x80, to determine a indexed color, bit plane 0 holds in one byte, 8 pixels of blue (on or off), etc. As I mentioned I currently convert the video buffer to 24 bit, 3 bytes per pixel bmp file. If I could find the layout of how SDL has its renderer, surface, or some object, I am sure I can convert. Then surface->pixels is flipping address an update window. I tried renderer, texture, surface combinations, but haven't hit correct match up. Any ideas other than file write buffer, file read buffer? This was fine for now, since in debugging stage. Is there a way to attach a context I described to a window? And how is the layout, continuous stream of blue index, followed by red, green, intensity, or a byte of blue, byte of red, byte of green, byte of alpha, or blue for row width, red for... etc.
Thanx
And if why asked, converting 30 year old code, getting mechanics down, then maybe convert to modern draw APIs. But for now old draw routines to "graphics card".