LRFLEW | 16 Oct 04:24 2014
Picon

An obnoxious bug in SDL 1.2 and the workaround I found

There's an odd bug in SDL 1.2(.x) that affects a small number of users. If you are using a mac (on Mac OS X) that has dynamic graphic card switching on, then fullscreen windows will not present properly. While I had trouble finding an official bug report for SDL, I did find a few bug reports on specific games related to this bug such as this one. I could not find the source of this bug until I found this forum page that suggested disabling dynamic graphic card switching. After testing it, I was able to confirm that it did prevent the bug from appearing. From what I can tell, the bug occurs because SDL 1.2 is setting some part of the video mode before the dedicated GPU kicks in. This means that it tries to display using the integrated GPU and bugs out when the OS switches graphics cards.

While I still don't know where the bug actually occurs (so I can't actually fix it), I do know a workaround that is effective. While testing the bug, I noticed that calling SDL_SetVideoMode twice with the same arguments causes it to work fine. This makes sense, as the first call changes the graphics card and the second call actually sets up the display. With that knowledge, I devised the strangest patch. In the source for SDL_SetVideoMode, right before the last return statement (about line 920), I added the following two lines:








Code:
if ( (flags & SDL_FULLSCREEN) && !(strcmp(video->name, "Quartz")) && !(flags & 0x00080000) )
        return SDL_SetVideoMode(width, height, bpp, flags | 0x00080000);


Yes, it's not the most elegant solution, but it *does* work. Maybe if someone with more experience with Quartz and Macs worked on this, we could have an actual fix. In the meantime, this at least fixes the games that were affected by this.
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
JohnB | 17 Oct 21:01 2014
Picon

Anyone got SDL2 working with GPG-CPP-SDK?

My native method isn't being found by the Java end

My subclass of Activity has:








Code:
package com.dumbdumber.myproject;

public class SubActivity extends SDLActivity {//which extends Activity

    private static native void nativeInitGPGS(SubActivity act);

    <at> Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        instance = this;
        nativeInitGPGS(this);
    }


While main.cpp begins, after first preprocessing directives:








Code:
extern "C"
{
JNIEXPORT void
Java_com_dumbdumber_myproject_SubActivity_nativeInitGPGS(JNIEnv* env, jobject thiz, jobject activity)
{


I get:

10-17 16:12:38.051: D/dalvikvm(4980): Trying to load lib /data/data/com.dumbdumber.myproject/lib/libmain.so 0x423849c8
10-17 16:12:38.055: D/dalvikvm(4980): Added shared lib /data/data/com.dumbdumber.myproject/lib/libmain.so 0x423849c8
10-17 16:12:38.060: V/SDL(4980): onCreate():null
10-17 16:12:38.087: W/dalvikvm(4980): No implementation found for native Lcom/dumbdumber/myproject/SubActivity;.nativeInitGPGS:(Lcom/dumbdumber/myproject/SubActivity;)V
10-17 16:12:38.108: D/AndroidRuntime(4980): Shutting down VM
10-17 16:12:38.108: W/dalvikvm(4980): threadid=1: thread exiting with uncaught exception (group=0x41b73908)
10-17 16:00:52.456: E/AndroidRuntime(4699): FATAL EXCEPTION: main
10-17 16:00:52.456: E/AndroidRuntime(4699): java.lang.UnsatisfiedLinkError: Native method not found: com.dumbdumber.myproject.SubActivity.nativeInitGPGS:(Lcom/dumbdumber/myproject/SubActivity;)V
10-17 16:00:52.456: E/AndroidRuntime(4699): at com.dumbdumber.myproject.SubActivity.nativeInitGPGS(Native Method)
10-17 16:00:52.456: E/AndroidRuntime(4699): at com.dumbdumber.myproject.SubActivity.onCreate(SubActivity)

I believe the native implementation can be placed anywhere and automagickly picked up. I've tried placing the C implementation in another cpp body, instead of main.cpp but nothing changes.

Here is my Android.mk








Code:
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := main

SDL_PATH := ../SDL

LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(SDL_PATH)/include

LOCAL_C_INCLUDES += $(LOCAL_PATH)/../include
LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.c \
                    main.cpp
#Other stuff removed for clarity

LOCAL_SHARED_LIBRARIES :=   SDL2_image \
                            SDL2    \
                            SDL2_ttf
LOCAL_WHOLE_STATIC_LIBRARIES += gpg_static

LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog -lz

include $(BUILD_SHARED_LIBRARY)

While I leave loading of the shared libraries to SDLActivity

static {
    System.loadLibrary("SDL2");
    System.loadLibrary("SDL2_image");
    System.loadLibrary("SDL2_ttf");
    System.loadLibrary("main");
}


I've remembered to run ndk-build (twice) in the jni directory and am attempting to run on my phone.

I've run my libmain.so through a hexeditor and can confirm it exists, also here's the first six lines output from nm from the NDK








Code:

        U IMG_Init 
        U IMG_Load 
        U IMG_Quit 

    00065454 T JNI_OnLoad
    0005c208 T Java_org_libsdl_app_SDLActivity_nativeInit
    0006851c T Java_com_dumbdumber_myproject_SubActivity_nativeInitGPGS
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Dw77 | 16 Oct 07:07 2014
Picon

Question about SDL Haptics and Windows

It has been a long time since I last used SDL, so imagine my surprise when I decide to see what's new and I Find SDL 2.0 complete with support for haptic feedback. Now I've had a USB HID Controller for a while now. However I came away disappointed when I tried to implement rumble with the controller after I used the Dpad Buttons and analog sticks. So onto my questions: Are the haptic capabilities unimplemented or only partially implemented? If it is only implemented through Xinput is there a timetable for DirectX Support?

If none of this is actually relevant then it sounds like it is something with my controller so I include some information on it below:
OS: Windows 7 home
Computer HP Pavillion g6
Controller: Power A Airflo controller for PS3
it has 2 different devie functions listed under properties:
HID-compliant game Controller
USB Input Device

Some Further Information under the controller function:

HID-Compliant game controller Properties:
Hardware IDs:
HID\VID_20D6&PID_571D&REV_0100
HID\VID_20D6&PID_571D
HID_DEVICE_SYSTEM_GAME
HID_DEVICE_UP:0001_U:0005
HID_DEVICE
Device Class GUID: {745a17a0-74d3-11d0-b6fe-00a0c90f57da}
Physical device object name: \Device\0000010e
Capabilities:
000000E0
CM_DEVCAP_SILENTINSTALL
CM_DEVCAP_RAWDEVICEOK
CM_DEVCAP_SURPRISEREMOVALOK
Power Data:
Current power state:
D0
Power capabilities:
0000005D
PDCAP_D0_SUPPORTED
PDCAP_D2_SUPPORTED
PDCAP_D3_SUPPORTED
PDCAP_WAKE_FROM_D0_SUPPORTED
PDCAP_WAKE_FROM_D2_SUPPORTED
Power state mappings:
S0 -> D0
S1 -> D2
S2 -> D2
S3 -> D2
S4 -> D2
S5 -> D3
Device instance path: HID\VID_20D6&PID_571D\7&29394B3F&1&0000
DevNode status:
0180200A
DN_DRIVER_LOADED
DN_STARTED
DN_DISABLEABLE
DN_NT_ENUMERATOR
DN_NT_DRIVER
Parent: USB\VID_20D6&PID_571D\6&16c176e9&0&1
Driver assembly version: 6.1.7601.18199

Thank you for any help
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
almightyj | 19 Oct 03:47 2014

Installing SDL2, getting "SDL_Texture does not name a type"

Have been racking my brain over the last week trying to get this to work. I am a noob so forgive any obvious things I missed.

First, I am using Ubuntu 12.04 LTS and couldn't find any packages I could install, so I downloaded the source and compiled the SDL2 library. When I check, it looks like the headers have been installed in the /usr/local/include directory and the .so files were installed in /usr/local/lib.

I am using Code::Blocks and added the following to the Project Build options:

Search Directories --> Compiler: /usr/local/include
Search Directories --> Linker: /usr/local/lib
Search Directories --> Resource Compiler: /usr/local/include and /usr/local/lib
Linker Settings --> Other linker options: -SDL2main -lSDL2

In my source code I have the following include statement:

#include

I'm pretty sure I'm at least pointing to the right place because if I change it, it gives me a "No such file or directory" error instead.

When it comes time to compile, it hits the first line I declare an SDL_Texture object, raising an error that "SDL_Texture does not name a type".

My understanding is that this error usually means that the referenced object is not defined elsewhere. I just migrated from using SDL 1.2 and switched all my SDL_Surfaces to SDL_Textures, but I thought that by including the SDL.h file, it included all the object definitions, so I'm at a loss.

Here is the excerpt from my header file raising the error: "SDL_Texture does not name a type"

#ifndef _CSURFACE_H_
#define _CSURFACE_H_

#include

class CSurface {
public:
CSurface();
int X;
int Y;

public:
//static SDL_Surface* OnLoad(char* File);
static SDL_Texture* OnLoad(char* file);
and here are the file listings where my compiled SDL2 files are.

/usr/local/include/SDL2:

SDL.h
SDL_assert.h
SDL_atomic.h
SDL_audio.h
SDL_bits.h
SDL_blendmode.h
SDL_clipboard.h
SDL_config.h
SDL_cpuinfo.h
SDL_endian.h
SDL_error.h
SDL_events.h
SDL_filesystem.h
SDL_gamecontroller.h
SDL_gesture.h
SDL_haptic.h
SDL_hints.h
SDL_joystick.h
SDL_keyboard.h
SDL_keycode.h
SDL_loadso.h
SDL_log.h
SDL_main.h
SDL_messagebox.h
SDL_mouse.h
SDL_mutex.h
SDL_name.h
SDL_opengl.h
SDL_opengles.h
SDL_opengles2.h
SDL_pixels.h
SDL_platform.h
SDL_power.h
SDL_quit.h
SDL_rect.h
SDL_render.h
SDL_revision.h
SDL_rwops.h
SDL_scancode.h
SDL_shape.h
SDL_stdinc.h
SDL_surface.h
SDL_system.h
SDL_syswm.h
SDL_test.h
SDL_test_assert.h
SDL_test_common.h
SDL_test_compare.h
SDL_test_crc32.h
SDL_test_font.h
SDL_test_fuzzer.h
SDL_test_harness.h
SDL_test_images.h
SDL_test_log.h
SDL_test_md5.h
SDL_test_random.h
SDL_thread.h
SDL_timer.h
SDL_touch.h
SDL_types.h
SDL_version.h
SDL_video.h
begin_code.h
close_code.h

/usr/local/lib:
libSDL2-2.0.so.0
libSDL2-2.0.so.0.2.1
libSDL2.a
libSDL2.la
libSDL2.so
libSDL2_test.a
libSDL2main.a
ocaml
pkgconfig
python2.7
site_ruby

Not sure if it didn't compile correctly, not sure if I have to manually include all the related SDL headers (I didn't have to do that on SDL 1.2), not sure if I'm missing something in my linker instructions.

Help!
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Alex Dănilă | 17 Oct 11:09 2014
Picon

SDL 2 - keyboard focus on Windows 8.1 PC

Hi,

Using SDL2-widgets together with SDL 2.0.4 I can't get any keyboard events.

Assuming this is a focus problem I tried constructing XAML controls as swapChainPanel children that stretched over its entire area, or the other way around, make the swapChainPanel a child. No matter what configuration, the application behaves exactly the same, and gets only mouse events.

What could be the problem and what could I have missed about using SDL2 on Windows 8.1?

Thanks
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
tsethcle | 16 Oct 15:34 2014
Picon

libSDL OpenGL ES 2.0 issue on Android

Hi folks,

I am looking at three development platforms:
1) Windows 8.1, libSDL 2.0.1, OpenGL instead of ES
2) Nexus 5, Android 4.4.4, OpenGL ES 2.0, libSDL 2.0.1 and libSDL 2.0.4 from today's source (3d2c0f659ad3)
3) simValley 421 smartwatch, 240x240 display, Android 4.2.2, OpenGL ES 2.0, libSDL 2.0.1 and libSDL 2.0.4 from today's source (3d2c0f659ad3). the GPU supports ES 2.0 and the NDK ES 2.0 sample works fine.

I am creating a window (SDL_CreateWindow) at 240x240 with the SDL_WINDOW_OPENGL and SDL_WINDOW_FULLSCREEN flags.

On Android I also do:







Code:
  SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
  SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
  SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);



Then I call SDL_GL_CreateContext(). I clean the buffers.







Code:
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
SDL_GL_SwapWindow();
glClear(GL_COLOR_BUFFER_BIT);



Platform 1: Everything works as I expect it.
Platform 2: The app opens. My text gets printed. But I see it 8 times and there are random colors around it. When I continue to render content, then later it will only update the left corner which seems like an okay behaviour for the 240x240 resolution. The rest gets black as I expect if from clearing the buffers. When I exit I sometimes see the random colors again for a frame before it quits.

Platform 3: The app opens, but everything stays black. it runs and reacts to some touches as I've seen in the debugger, but it will not display anything.

Questions:
* Why do I see my rendering in the beginning eight times?
* Why does it stop later and seems to work fine and is shown again in the last exit frame?
* Is it not able to clear the full buffer as it thinks it is only 240x240? Should I create a windows in full screen first, clear it, then destroy it and create my small 240x240 window?
* I've seen in SDL_Activity.java that usually there seems to be a default format of SDL_PIXELFORMAT_RGB565. Could that interfere?
* I've seen in src/video/android/SDL_androidwindow.c that some OpenGL ES surface is already created automatically through SDL_EGL_CreateSurface(). Could that conflict with mine at different resolution?
* In the Android Device Manager I see messages from SDL: surfaceCreated(), surfaceChanged(), pixel format RGB_565, Window size: 1794x1080 (which is the full phone res without soft buttons). Also getting I/Adreno-EGL(29084):


_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Justin Agrell | 16 Oct 05:14 2014
Picon

Re: SDL_Image unsupported format for all formats

Excellent, thanks for clearing that up for me. I was worried.

I'm also going to try my source on my Ubuntu machine. If i discover any
clues as to why SDL_image won't work I'll update everyone.

On 10/15/2014 08:51 AM, sdl-request <at> lists.libsdl.org wrote:

> 
> I don't have any suggestion about what the problem is, but I can clarify
> the alpha issue so that it doesn't worry you.
> 
> The "SDL 2.0 and PNG alpha" thread has nothing to do with SDL_image's alpha
> support.  SDL_image supports alpha channels perfectly.  The .tga format is
> great for that.
> 
> The problem in that thread was with a fake display surface (
> SDL_GetWindowSurface()) no longer (since SDL 2.0) supporting conversions to
> optimized formats with alpha since SDL_DisplayFormatAlpha() is not in SDL
> 2.  This is an understandable issue, but for some reason there is a
> performance penalty regardless.
> 
> Jonny D
Sylvain Becker | 15 Oct 22:57 2014
Picon

Two issues with SDL Android on Samsung devices

Hi,

I have two new issues reported by Samsung when they tested my applications.

Before someone asks:
- It works fine with most (all) other devices
- I don't know whether this is new or not. but Samsung never reported it before.
- I updated to SDL trunk like it was the October 1st.

1/ Problem with Screenshot:
With a Landscape application, they press HOLD + HOME key. The
application crashes.

2/ Screen distorted
With a Landscape application.
Going to background with Home Key, then foreground.
The screen is distorted.

It seems that the issues happen with a Galaxy Note 3 (issue #2), or
Galaxy Alpha (issue #1).
Maybe this would happen also with other devices.

All applications in Portrait mode passed the Samsung certification,
but those in Landscape got those issues.

If you have one of those devices, I would be glad if you could give a
try. Let me know.

Cheers,
Sylvain
Justin Agrell | 15 Oct 05:34 2014
Picon

SDL_Image unsupported format for all formats

Every time I try to load an image using SDL_image.h it just throws an error.

Well, to be honest I've only tested .bmp, .png, jpeg, and .tga.

bmp, png, jpeg: "unsupported image format"

tga: "Error writing to datastream"

I'm not sure what I need to do to get the library to work.

I'm on Slackware and I've used the Slackbuild.
I've also downloaded the latest source release along with one from the
Mercurial. All of the sources appear to compile configure/make/install
just fine. I even have the extra support for jpeg and png.

(Loading bitmaps from SDL2 was working just fine if that helps).

I'm also worried about the other posts in the mailing list stating that
SDL_image doesn't preserve alpha. I originally wanted to switch from bmp
to tga solely for the alpha channel. Before I was just converting bmp to
surface to opengl texture.

Any advice for the best way to get tga -> opengl texture and the
SDL_image library working would be much appreciated.
Tyzor | 13 Oct 10:35 2014
Picon

EXE file for SDL-based programs (VISUAL STUDIO 2013)

Was just wondering if anyone is familiar with Visual Studio 2013 and getting the exe file of the program. I'm just trying to show my mates my program so far. I looked around and read that people have suggested to build the program via release. When i release the program a whole list of errors concerning SDL dependencies occur. My main question is when i switch to release would i have to do all the setup again? Also, is this the best way to simply get an exe file that uses SDL (the exe file in Debug folder needs to find SDL.dll when i run it from there)?

Cheers,
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Sik the hedgehog | 13 Oct 20:58 2014
Picon

Posts not going to the mailing list

I'm noticing that some posts are not appearing in the mailing list.
More specifically, it seems to be posts from users that are registered
in the forum and not in the list. OK, I suppose that makes sense, but
it really makes it hard to keep track of the conversation when
messages are missing (especially when they happen to be from the
person asking for help).

Any ideas on how this could be fixed?

Gmane