Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - metx

Pages: [1]
1
DotNet / SFML on PictureBox with no render loop and GDI+
« on: November 01, 2013, 11:22:33 am »
Hi Guys,

First, congrats to the authors for a great library from a new user! I've been looking for a long time for a replacement for the GDI/GDI+ drawing routines I use in my application until I found your site. Keep up the great job you are doing.

I have a couple of questions so let's start from the top. In my WinForm application I have a System.Windows.Forms.PictureBox that is hosting a SFML RenderWindow. Since my app is not a game I have no need for high framerates or continuous redrawing via a render loop. The graphics (entire window) are redrawn only if some information changes or the form/PictureBox is resized. So the framerate could be said to be "on demand". I have been playing around with this a few days and while it seems to work without glitches I still have to ask before proceeding with more complex implementations; should I expect any problems using this kind of logic with SFML.Net?

Question two concerns mixing SFML drawing with GDI+ in a PictureBox: I am able to mix the two by creating a new System.Windows.Bitmap, drawing on it, returning it as a MemoryStream to SFML.Image and from there create a Texture and then Sprite before finally drawing it on the RenderWindow along the other SFML graphics. Everything looks great concerning transparency and so on. However, I initially tried the reverse, i.e. finalize the SFML graphics, then create a System.Drawing.Graphics object using the RenderWindow handle and draw the GDI+ stuff on that. This also worked to a degree, the problem is that transparency is not preserved using this method. For example, drawing a GDI+ circle would cause the background under it to have some solid color (probably the parent Form's background color) and effectively overdraw everything underneath. This was not the outcome I expected but perhaps I am missing something here. Could it be related to the underlying bitmap format? I need the GDI+ drawing for some overlay information and the latter method would probably be more efficient since it does not involve creating a MemoryStream, Image, Texture and Sprite. But if not possible I'll just stick with what works or eventually switch over to full SFML drawing.

If needed I'd be happy to provide sample code or screenshots demonstrating the above problem.

Pages: [1]