LWJGLException: Pixel format no accelerated - lwjgl

I'm developing my own game with eclipse and I tried to export it and test it on an other computer. On my own computer the exported game worked fine but not on the other one. I started the jar from the commandline, so I can see the error and it is the error, mentioned in the headline, "Pixel format not accelerated" in this function (in line "Display.create(...)"):
public static void createDisplay() {
System.out.println("test1");
ContextAttribs attribs = new ContextAttribs(3, 2).withForwardCompatible(true).withProfileCore(true);
try {
System.out.println("test2");
Display.setDisplayMode(new DisplayMode(WIDTH,HEIGHT));
Display.create(new PixelFormat().withDepthBits(24), attribs);
Display.setTitle("Our First Display!");
System.out.println("test3");
GL11.glEnable(GL13.GL_MULTISAMPLE);
} catch (LWJGLException e) {
e.printStackTrace();
}
GL11.glViewport(0,0, WIDTH, HEIGHT);
lastFrameTime = getCurrentTime();
}
Now my question is, how I can get rid of this exception, so I can play the game on the other computer as well...
Thanks for you help :)

Related

BluetoothLeScanner could not find callback wrapper

Because of I had problems with Bluetooth on Android Lollipop, I have tried to change the scanner method.
So I have tried to use the new package.
In the previous version, I called startScan(mLeScanCallback) and everything works but now, when I call startScan(mScanCallback) I have the error: "D/BluetoothLeScanner: could not find callback wrapper".
No devices are found and the ListAdapter, I use to show the devices, is empty.
The comment lines are the previous code (and it worked!).
This my code:
public class Selection extends ListActivity implements ServiceConnection {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mHandler = new Handler();
// Initializes a Bluetooth adapter through BluetoothManager.
final BluetoothManager bluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
mBluetoothAdapter = bluetoothManager.getAdapter();
getApplicationContext().bindService(new Intent(this, MetaWearBleService.class), this, Context.BIND_AUTO_CREATE);
}
private void scanLeDevice(final boolean enable) {
final BluetoothLeScanner bluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner();
if (enable) {
mHandler.postDelayed(new Runnable() {
#Override
public void run() {
//mBluetoothAdapter.stopLeScan(mLeScanCallback);
bluetoothLeScanner.stopScan(mScanCallback);
setListAdapter(listAdapter);
}
}, SCAN_PERIOD);
//mBluetoothAdapter.startLeScan(mLeScanCallback);
bluetoothLeScanner.startScan(mScanCallback);
} else {
//mBluetoothAdapter.stopLeScan(mLeScanCallback);
bluetoothLeScanner.stopScan(mScanCallback);
setListAdapter(listAdapter);
}
}
private ScanCallback mScanCallback =
new ScanCallback() {
public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) {
runOnUiThread(new Runnable() {
#Override
public void run() {
listAdapter.addDevice(device);
}
});
}
};
Instead the ListAdapter extends BaseAdapter and use a ViewHolder. If it necessary, I post it.
So what does it mean "D/BluetoothLeScanner: could not find callback wrapper"? What is it wrong?
Otherwise how I can't resolve the problem of scanning with the Android Lollipop?
In Lollipop I have often errors about BluetoothGatt. I don't know to minized it (or solve it).
Thanks
The log message D/BluetoothLeScanner: could not find callback wrapper appears whenever Android's bluetooth scanning APIs are told top stop scanning for an app when they think scanning has not started. You can see this by looking at the source code of Android's BluetoothLeScanner here.
This is usually safe to ignore as there are lot of reasons that scanning my not have actually started (it was already stopped, bluetooth is off, permissions have not been granted, etc.) Client software that does scanning often stops scanning on a timer regardless of whether it has been successfully started, or whether it was manually stopped before the timer goes off. Android's example code (and the code shown above) does exactly this, often causing these log messages to show up.
If you really want to minimize these messages, you need to keep track of whether scanning actually started and only stop scanning if it actually did. Unfortunately, you don't get a return code if scanning starts successfully, and you only get an asynchronous callback to onScanFailed(errorCode) if you cannot start successfully. So one approach would be to set scanStartCount++; when you call start scan, and set scanStartCount--; when you get a callback to onScanFailed(errorCode). Then when your timer goes off to stop the scan, only actually stop it if the scanStartCount > 0.
Keep in mind that you can only minimize these messages coming from your application. Other applications on the phone doing bluetooth scanning may be causing these messages to be emitted as well.
for the same problem
I had just add permissions :
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.
Manifest.permission.
Manifest.permission.BLUETOOTH_PRIVILEGED,
in your activity call this methods :
checkPermissions(MainActivity.this, this);
public static void checkPermissions(Activity activity, Context context){
int PERMISSION_ALL = 1;
String[] PERMISSIONS = {
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.BLUETOOTH,
Manifest.permission.BLUETOOTH_ADMIN,
Manifest.permission.BLUETOOTH_PRIVILEGED,
};
if(!hasPermissions(context, PERMISSIONS)){
ActivityCompat.requestPermissions( activity, PERMISSIONS, PERMISSION_ALL);
}
}
public static boolean hasPermissions(Context context, String... permissions) {
if (context != null && permissions != null) {
for (String permission : permissions) {
if (ActivityCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {
return false;
}
}
}
return true;
}
hope it's help
I had the same problem with android m.It was due to lack of permissions.Make sure you go to settings and grant location permission to your app
for location permission, only ACCESS_FINE_LOCATION worked. ACCESS_COARSE_LOCATION had the same problem.

How to save video when recording is interrupted by sending the application to background on windows phone 8

I am expermenting with video recording on Windows Phone 8. I want to handle the situation when user is putting my app to background, while it is recording a video. I would like to save the already recorded video before quitting.
I am handling this situation using the code from this example:
https://msdn.microsoft.com/en-us/library/windows/apps/mt243896.aspx
private async Task StopRecordingAsync()
{
try
{
Debug.WriteLine("Stopping recording...");
_isRecording = false;
await _mediaCapture.StopRecordAsync();
Debug.WriteLine("Stopped recording!");
}
catch (Exception ex)
{
Debug.WriteLine("Exception when stopping video recording: {0}", ex.ToString());
}
}
I am calling this method from the:
protected async override void OnNavigatingFrom(NavigatingCancelEventArgs e)
But the video is not being saved. In the debug console I get only the first message: "Stopping recording...", but there is no "Stopped recording!" message logged. It seems like the resources are being destroyed before I can handle them.
When your app is moved to the background you only have a short amount of time to run code.
Instead of having saving be triggered when you navigate from the page, instead look at the Application.Suspending event which allows you to use a deferral to try and run your code for a bit longer so you can finish tidying up before your app loses it's resource allocation.
Something like:
async protected void OnSuspending(object sender, SuspendingEventArgs args)
{
SuspendingDeferral deferral = args.SuspendingOperation.GetDeferral();
await StopRecordingAsync();
deferral.Complete();
}

streaming radio windows phone from chunks of audio

I'm is someone able to point me in the right direction for playing multiple streams/AAC media either with a MediaElement or MediaPlayer. I have 3 streams that get returned from a server and this gets updated every 10 seconds so I add the new streams to the collection.
Problem is when I change the source of the MediaElement in the Media_Ended event and call Play() again it has a slight gap in the audio. What I'm wondering is if I should be creating a playlist, and if so how is this done?
I've also tried this sample: http://phonesm.codeplex.com/
but same thing when changing the source - there is a slight delay in playing the next stream/AAC link. Here's my source:
<mmppf:MediaPlayer x:Name="MediaPlayerPlayer"
Source=".AACLinkHere"
MediaEnded="MediaEndedChangeSource"
MediaEndedBehavior="Reset"
IsLive="True">
and the code behind:
private void MediaEndedChangeSource(object sender, Microsoft.PlayerFramework.MediaPlayerActionEventArgs e)
{
try
{
MediaPlayerPlayer.SetSource(new FileStream());
MediaPlayerPlayer.Source = new Uri(".NextAACLinkHere", UriKind.RelativeOrAbsolute);
Debug.WriteLine("*********************************************************test...adfadfadf");
}
catch (Exception exception)
{
Debug.WriteLine(exception.Message);
}
}
if anyone has any ideas that would be appreciated. Sample code would be even better! Cheers.

Windows Phone 8 Connection Handler / Internet Availability

My team is working on a team project aplication. At the moment, we need an event handler to check the connection status (if it's on/off).
I had big hopes in the System.Net.NetworkInformation Namespace, but unfortunately most important things aren't supported in wp8.
Can anyone help me with it a bit?
Edit 1#
It seems, I didn't specifed my problem well.
I'm using Mvvm light expresion, and it does not support that namespace or at least I can't add it.
I'm a newbie in using VS and c# atm, mayby I'm doing someting wrong, but simply when im trying to add the refernce to my project it does not list.
I haven't tried the System.Net.NetworkInformation namespace on WP8. But the new WP8 Windows.Networking.Connectivity Windows Phone Runtime namespace works just fine.
Use Windows.Networking.Connectivity.NetworkInformation.NetworkStatusChanged to know when network conditions change and use Microsoft.Phone.Net.NetworkInformation.NetworkInterface properties or Windows.Networking.Connectivity.NetworkInformation properties to see what's up.
private async void MainPage_Loaded(object sender, RoutedEventArgs e)
{
PrintNetworkStatus();
NetworkInformation.NetworkStatusChanged += NetworkInformation_NetworkStatusChanged;
}
void NetworkInformation_NetworkStatusChanged(object sender)
{
PrintNetworkStatus();
}
private void PrintNetworkStatus()
{
Dispatcher.BeginInvoke(() =>
MessageBox.Show(NetworkInterface.NetworkInterfaceType +
Environment.NewLine +
NetworkInterface.GetIsNetworkAvailable()));
}
When I test this code snippet on my WP8 Lumia 920 it works as expected. On startup when my phone is on WiFi only I see the following MessageBox:
And once I shutdown my WiFI router and the WiFi connection on the phone is lost I see the following MessageBox:
Try this:
bool isNetwork=NetworkInterface.GetIsNetworkAvailable();
if(!isNetwork)
{
//proceed with your code
}
In App.xaml.cs, create a property like below
/// <summary>
/// check if network is available
/// </summary>
public bool IsNetworkAvailable
{
get
{
return NetworkInterface.NetworkInterfaceType != NetworkInterfaceType.None;
}
}
And you can use this property anywhere in your project as in below code
if (((App) Application.Current).IsNetworkAvailable)
{
//Lines of Code
}
else
{
MessageBox.Show("Not Connected to Network!", "Checking Connection!",
MessageBoxButton.OK);
}

Stage3D Error #3694: The object was disposed by an earlier call of dispose() on it

Using Flare3D, i run into error #3694 when the player (when compiling within flash) is resized, or when i run it in a browserpage and then lock wy (windows) machine and unlock it again.
The error is: "The object was disposed by an earlier call of dispose() on it."
I did some searching and found some suggestions to check on context3D.driverInfo and skip rendering if that string equals 'Disposed', but this doesnt seem to work. In my case, that string is either 'Software (embedded)' (when running in flash ide) or 'DirectX9 (Direct blitting)' when running in a standalone player.
Does anyone know what the error is and how to avoid it?
I had the same problem, googled, found your question... and it helped me figure out the answer :)
You probably have a resize handler that is called when the anything resizes the stage. And it tries to change the size of the stage3D back buffer.
While the stage is being resized the context3D.driverInfo == "Disposed". When you finish resizing it goes back to normal.
So instead of something like this:
context3D.configureBackBuffer(stageW(), stageH(), 0, false);
Try:
public function onResizeStage(event:Event) {
if (stage3D == null) {
return;
}
if (context3D == null) {
return;
}
if (context3D.driverInfo == "Disposed") {
return;
}
context3D.configureBackBuffer(stageW(), stageH(), 0, false);
}