Elsewhere there are things that we all miss, yet it takes just one to notice...

Linux X11 full screen

Wow! Just how easy was it to have a full screen window in Linux?

In windows, you had to include a shed load of libraries and link to them. In Linux you just link to X11, one or two parameters, and that’s it.

All I required was a basic window that I could attach the VLC player to, similar to any 3D API requirements, so that I could bypass VLC switching from full screen to desktop all the time. And all in 20 lines of code, not obfuscated, and one instruction per line, with a while loop for a pause, I got it. Windows couldn’t do that. It would take, erm, lots of, erm, junk to do it. erm 😉

Again, not a lot of time tonight to do stuff, so by the time I came round to getting this done, I thought I might as well set a target for this step to be done by tomorrow night. Now it looks like tomorrow night I can attach VLC to play a playlist.

See what happens tomorrow if chaos don’t arise.

libVLC and fullscreen

Okay, so I was successful with getting libVLC to play a video in full screen in just a few lines of code. This was a great success. However, when using a play list, each item is shown in a window.

Tonight I haven’t the time to set up a full screen window and attach libVLC to it, so I will try that tomorrow. There’s tons of Linux windowing API’s I can use. Just a standard X11 window will be fine as there will be no user input at all.

It’s no use having a black background as a desktop as some videos will end with a different coloured background.

Ah well. Plod on tomorrow. Almost there.

If I fail then it will be a minimal build of ffmpeg or maybe just the OGV libraries and I will write a player myself which will take a tad longer than I wanted.

Sample C code on Linux:

#include <X11/X.h>
#include <X11/Xlib.h>
#include <strings.h>
#include <memory.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

extern "C" {
#include <vlc/vlc.h>
}

const char *files[] = {
	"/media/wlgfx/WLGfx/WLGfxMedia/2017July/WLGfxJul/wlgfx.ogv",
	"/media/wlgfx/WLGfx/WLGfxMedia/2017July/sample1/sample.ogv"
};
const int files_count = 2;

void play_media(libvlc_instance_t *inst, const char *uri, uint32_t win) {
	libvlc_media_t *m = libvlc_media_new_path(inst, uri);
	libvlc_media_player_t *mp = libvlc_media_player_new_from_media(m);
	libvlc_set_fullscreen(mp, 1);
	libvlc_media_player_set_xwindow(mp, win);
	libvlc_media_player_play(mp);
	sleep(1); // enough time to start
	while (libvlc_media_get_state(m) == libvlc_Playing) usleep(200);
	libvlc_media_release(m);
	libvlc_media_player_release(mp);
}

int main() {
	Display* dis = XOpenDisplay(NULL);
	Window win = XCreateSimpleWindow(dis, RootWindow(dis, 0), 0, 0, 10, 10,
			0, BlackPixel (dis, 0), BlackPixel(dis, 0));

	Screen *screen; // get screen size
	screen = ScreenOfDisplay(dis, 0);
	int dwid = screen->width;
	int dhgt = screen->height;

	Window root; // position mouse to bottom left (hide it)
	root = XRootWindow(dis, 0);
	XSelectInput(dis, root, KeyReleaseMask);
	XWarpPointer(dis, None, root, 0, 0, 0, 0, dwid, dhgt);
	XFlush(dis);

	XInitThreads();

	Atom wm_state = XInternAtom(dis, "_NET_WM_STATE", False);
	Atom fullscreen = XInternAtom(dis, "_NET_WM_STATE_FULLSCREEN", False);

	XEvent xev;
	memset(&xev, 0, sizeof(xev));
	xev.type = ClientMessage;
	xev.xclient.window = win;
	xev.xclient.message_type = wm_state;
	xev.xclient.format = 32;
	xev.xclient.data.l[0] = 1;
	xev.xclient.data.l[1] = fullscreen;
	xev.xclient.data.l[2] = 0;

	XMapWindow(dis, win);

	XSendEvent (dis, DefaultRootWindow(dis), False,
		SubstructureRedirectMask | SubstructureNotifyMask, &xev);

	XFlush(dis);

	printf("XWindow initialised with threading enabled\n");

	libvlc_instance_t *vlc_instance = libvlc_new(0, NULL);

	printf("Playing media files in vlc attached to window\n");

	uint32_t id = (uint32_t) win;

	play_media(vlc_instance, files[0], id);
	play_media(vlc_instance, files[1], id);
	play_media(vlc_instance, files[0], id);
	play_media(vlc_instance, files[1], id);

	libvlc_release(vlc_instance);

	printf("Hopefully all was successful\n");

	return 0;
}

Blender and Python and VLC

Since getting home on Friday after work, I had a plan.

  1. Figure out the animation and timeline in Blender. I’ve done this. I can now rotate, translate, scale and modify objects on the timeline. As well as texturing, particles and other things useful for animations. I’ve still yet to show video in a texture, but that looks a doddle.
  2. Play animations (for testing) from the ‘.blend’ file. This was a bit fiddly as I had to use the Blender Game Engine and all the animations I had done for each individual objects, I had to add in the ‘BGE’. The Blender player works fine with the ‘.blend’ files with many exceptions. There’s a lot that Blender can do that the player doesn’t handle. A simple one is the morphing of an object. Which rules out a hell of a lot of Blenders stuff.
  3. Blender rendering videos. Awesome this one. It will render videos to OGV format. All effects included, or at least I hope so. I’ve rendered a 15 second video many times on my laptop in the background (it is an i7) and I can still get on with other stuff. This will be much quicker on my PC, but my laptop is darn fast as is.
  4. Use Bash or another scripting language to play the videos because the Blender player, although fast and smooth, doesn’t do everything. I’ve been successful with Python and the VLC plugin for it, so I now know I can use the VLC library to play these files. I’m still beginning with Python, but it did show me how easy the VLC library is to use.

Although I’ve made sure I’ve put time out to get out this weekend just to keep myself in a good mood, this progress has been great.

It’s a long learning curve with Blender, but at the moment, I can make use of it to do 90% of what I need it for. 30 frames per second with a medium 3D scene was taking on my laptop 2.0 seconds per frame to render at 1920 x 1080. And 15 seconds of full quality is about 12Mb.

The framework around all of this will be a WIP from today and it is going to be so awesome even I can’t wait.

The next stage for me will be integrating custom engines to produce these animations better then the Blender player without the need to render video files.

Back to Blender… See y’all soon…

Parallax3D WebGL

This is proving to be easier than I thought.

The Eclipse GWT project was setup. The parallax3D jar library added. A test AnimatedScene class with some basic geometry tests done. Spin a few of them around.

That’s me done for tonight. Got work in the morning.

I’m hoping I can load in Blender models, or even .OBJ models. If not, I’ll figure something out. Also 3D text I need.

No screeny yet cos of screen tearing.

VPS and WebGL project

Tonight I had a full on plan to get my own VPS (Linux based) and setup a Tomcat server ready for my WebGL personal project showcase. I’m planning on porting some old school samples from years ago from both IrrLicht and Dark Basic Pro.

So far, I’ve not made a start as the missus passed her CBT today (Motorbike Compulsory Basic Training) and she is way over excited.

VPS and Tomcat are still in progress.

I also plan on studying this WebAsm too for much faster rendering.

To start with I will be using Parallax3D for GWT which I’ve played around with a few times before. I finally decided on Parallax3D after giving up on LibGDX (which is very good and easy), and CopperLicht (which I don’t like using Javascript).

If it chills out tonight, which is highly unlikely, then I’ll make a start.

WebGL 3D

After faffing about with CopperCube and CopperLicht, which is fun to play around with, I’ve found it quite restricting for the type of demonstrations that I want to do. So I’ve decided to head on back to Parallax3D, bypassing the urge to play with LibGDX again.

The reason for dumping CopperLicht is simple. I don’t like Javascript at all. With GWT, it is rare I need to use JSNI with it.

LibGDX is good but each LibGDX project has to be a complete GWT module in itself, which means copying over all the GWT stuff again. It probably is likely that I could integrate it into a GWT project and I might try it at some point.

However, Parallax3D just appears to have everything and is a simple Jar file which is added to a GWT project.

So… It’s finding out what mesh files (hopefully wavefront OBJ’s as well) and I’ll be up and running if the weather is bad this weekend.

I also need to FTP this site as my homes Sky router isn’t working with the DNS service.

Enough of this. Time to setup a project on my lappy.

 

Having a wind down for the holiday away.

It’s Monday evening now and on Wednesday, my loved one and I are jetting off to Morroco for a break away and much deserved to get away from reality.

However, I’ve already setup a laptop that I’m taking with me for when I get heat stroke, or something else like boredom, for not only keeping in touch with family and friends (when we’re not busy lazying it), with a small ssd. My accounts are not being stored on it just in case but I have installed some essential IDE’s that I use.

When I get back, and as I’ve already setup, I’ve got a test home server running which I can monitor and use while I’m away. A few final touches to it tomorrow evening. With the wifi at the hotel, I’m going to knock up a quick android app to test it out with.

Apart from that, I’m pretty grumpy at the moment. Home is a tip and needs a hand-grenade throwing at it. Worrying about the next week while we’re away. Argh!!!

Anyway… Noisy all of a sudden here…

Java programming

After just over 3 years of programming in Java, I still haven’t sussed out how to actually open up a basic IDE and start a simple UI project from scratch.

This I know from installing Netbeans. Which I’ve used before to create a dedicated server so that client devices can receive images created using Java AWT libraries. That was easy, create a TCP listening thread, accept connections, return renderings of bitmaps in compressed PNG format. Easy.

I’ve also created (which was a UI app) a program that sniffs the UDP broadcast of the IPTV/Digital Signage server (which I wrote), and opens up a custom web interface from the server without knowing the IP address. That was easy with the help of a couple of references from the web. It turned out to be quite a small program in the end and hardly any effort in it.

Even after Android development, writing games and even using FFMpeg to write a media player using the NDK.

I simply just wanted to write (using the accumulated knowledge of Java) a simple multi window/dialog application on my laptop. Wow… It still amazes me how I got through all the previous software developing. Maybe on an evening, I’m just not that focused. But I’m not giving in.

Java may not have the power of C, but it does have a lot that can be used as I’ve mentioned above. I’m finding it simple to handle threading and AWT bitmaps, etc. All I need now is to be able to setup up a display in a window (GL or raster, whichever is the quickest to begin with) and I’ll be happy.

Qt is simple enough for both openGL and normal UI stuff. So now I want to do the same with Java. So far without the UI stuff, I can run anything, ie server side from Java, but UI stuff I’ll just have to persevere with.

I’ll get there. Nighttime coding was something I always used to do. Going to bed when I realised the sun was poking its head up in the morning.

If I can keep this up (future plans)

Many years ago I started building my online profile and populated my old website with lots of content. Unfortunately, all that has gone despite trying to get in touch with the hosting company. It was free hosting.

Now my hosting is paid for so that gives me something if times get dark and finances get short.

The boiler-plate code for a 3D online demo is almost complete but am I hell staying up past 11pm when I have to be up at 6am in the morning.

I have all next week off, so when I am not out on my motorbike getting lost around the country, which I can’t do much anyway until I get paid next, I’ll be at home building up some showcase examples. These I will plan on hosting using webGL. I’ve got a lot of ideas and I plan on getting a good few of them done next week.

My future depends on it now, because I haven’t got the pennies to fill up my tank.

Dev updates for May 2017

There’s actually a shed load of updates, but I doubt I’ll get them all done tonight.

  1. I now have a Java server running which provides Java specific rendering using AWT and other java standard features.
  2. DVB-S is easy.
  3. Using FFMpeg as a general media player for both IPTV/UDP and file/network based streams, including pause and seek.
  4. Finally got round to installing 4 OS’s on my main laptop. Windows 10 and 3 other Linux OS’s.
  5. Manually re-installed a HP tablet with Android OS from scratch.
  6. Erm… Blank…

Stuff to do:

  1. Loads… I’ll remember them probably tomorrow.
  2. Add more code to this website.

 

Posts navigation

1 2 3 6 7 8 9 10 11 12 13
Scroll to top