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.


Messages - atomen

Pages: 1 [2]
16
General discussions / SFML & OpenGL (3D Models)
« on: July 22, 2010, 02:15:03 pm »
Hi!

I wanted a straight answer to this question since the other answers were a bit imprecise. So I'll make
it plain; is it possible to use SFML with 3d models if you use openGL calls?

The reason for this is because I will probably need a huge amount of animations and if these are going to
be 2d I'll have a pretty busy life ahead of me painting :(

17
DotNet / WindowsForms | Rendering Class
« on: July 16, 2010, 05:10:39 pm »
Hi!

I've recently started using SFML for the .NET platform and everything has gone smooth so far. Since the reason for
me using SFML with C# instead of C++ is because C# offers (IMO) better support and ease when creating window applications.

As you might all know; to be able to draw in a Windows Form with SFML you have to connect a SFML
device (RenderWindow in this case) with a Window Control. I wanted to do this in a structured way so I chose to make
a class controlling the drawing. So far it looks like this:

Code: [Select]

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

using SFML;
using SFML.Graphics;
using SFML.Window;

namespace X_C_Sharp
{
    class SFMLPanel : Panel
    {
        RenderWindow _renderWindow;
        //SFML.Graphics.View _renderView;

        public SFMLPanel() : base()
        {
            this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);
            _renderWindow = new RenderWindow(this.Handle);
            //_renderWindow.CurrentView.SetFromRect(new FloatRect(0, 0, this.Width, this.Height));
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            _renderWindow.Clear(new Color(255, 255, 255));
            base.OnPaint(e);
            _renderWindow.Display();

            //this.Invalidate();
        }

        // To be implemented...
        protected override void OnResize(EventArgs eventargs)
        {
            base.OnResize(eventargs);
        }

        public void Draw(Drawable objectToDraw)
        {
            _renderWindow.Draw(objectToDraw);
        }

        public void Draw(PostFx postFX)
        {
            _renderWindow.Draw(postFX);
        }

    }
}

As of now I think this class provides the required functions which I need though there are a few drawbacks which I haven't been able
to solve (the reason for me posting this thread). You can think of this new panel (replacing System.Windows.Forms.Panel) as 2 objects; a layout
and a drawing area (this is where SFML comes into the picture). The problem is that the SFML area i stretched to fit the layout (Panel area).

For example; when I increase the panel size I do not want the SFML area (its size) to stretch but instead increase its size (bigger drawing area).
Currently all pictures and shapes which are drawn is stretched and none of them has the specified size (the size which I specify in pixels).

What I though could be a solution was altering the RenderWindow view (commented out) but all my attempts altering the view has been in vain.
The size of the view seems to be constant (though I just assume since I haven't been working much at all with SFML).

Pages: 1 [2]