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 - kloffy

Pages: 1 [2]
16
General discussions / Re: SFML2 & OpenSceneGraph Examples
« on: March 08, 2013, 11:03:57 pm »
Thank you for your comments! Yes, you are absolutely right about the pragmas. I suppose I can just remove them in the next examples. Basically, I just wanted to make it explicit which libraries are being linked.

Thanks for the heads up about potential problems with framerate limit and vsync. I have opted to use only vsync for now. However, is clear really necessary? (OpenGL buffers are cleared by osgViewer.)

17
General discussions / Re: SFML2 & OpenSceneGraph Examples
« on: March 08, 2013, 10:39:26 pm »
Example 1: Setup Viewer

Setting up an osgViewer in a SFML window is very easy. Here is how I do it:

#if defined(_DEBUG)
#pragma comment(linker, "/SUBSYSTEM:\"console\"")
#else
#pragma comment(linker, "/SUBSYSTEM:\"windows\" /ENTRY:\"mainCRTStartup\"")
#endif

#if defined(_DEBUG)
#pragma comment(lib, "sfml-graphics-d.lib")
#pragma comment(lib, "sfml-window-d.lib")
#pragma comment(lib, "sfml-system-d.lib")
#else
#pragma comment(lib, "sfml-graphics.lib")
#pragma comment(lib, "sfml-window.lib")
#pragma comment(lib, "sfml-system.lib")
#endif

#if defined(_DEBUG)
#pragma comment(lib, "osgd.lib")
#pragma comment(lib, "osgViewerd.lib")
#else
#pragma comment(lib, "osg.lib")
#pragma comment(lib, "osgViewer.lib")
#endif

#include <SFML/Graphics.hpp>

#pragma warning(push)
#pragma warning(disable: 4250)

#include <osgViewer/Viewer>

#pragma warning(pop)

int main(int argc, char** argv)
{
        //osg::setNotifyLevel(osg::DEBUG_INFO);

        sf::RenderWindow window;
        window.setVerticalSyncEnabled(true);

        sf::VideoMode mode = sf::VideoMode::getDesktopMode();
        mode.width = 800;
        mode.height = 600;

        window.create(mode, "SFML+OSG Example");

        sf::Vector2u size = window.getSize();

        osgViewer::Viewer viewer;
        osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> gw = viewer.setUpViewerAsEmbeddedInWindow(0, 0, size.x, size.y);
        viewer.realize();

        while (window.isOpen())
        {
                sf::Event event;
                while (window.pollEvent(event))
                {
                        switch(event.type)
                        {
                        case sf::Event::Closed:
                                window.close();
                                break;
                        case sf::Event::KeyPressed:
                                if (event.key.code == sf::Keyboard::Escape)
                                {
                                        window.close();
                                }
                                break;
                        case sf::Event::Resized:
                                gw->resized(0, 0, event.size.width, event.size.height);
                                break;
                        }
                }

                window.setActive();
               
                viewer.frame();

                window.display();
        }

        return 0;
}

The only thing to keep in mind is letting the viewer know whenever the window changes size.

18
General discussions / SFML2 & OpenSceneGraph Examples
« on: March 08, 2013, 10:35:31 pm »
The old thread on this topic has not been updated in a while. Towards the end, it sounds like the original author had a couple of problems. Lately, I have decided to give this a try myself. So far, everything is working well, but there are a few things to look out for. I have decided to post a couple of examples that will hopefully make it easier for others to get started.

The examples are written and tested on Windows using Visual Studio 2012. However, the only platform specific feature are some of the preprocessor directives, which are used to conveniently configure project settings and link libraries.

There are no dependencies apart from SFML 2 and OpenSceneGraph 3.

19
General discussions / Project CAMP - open-source reflection library for C++
« on: February 15, 2011, 08:47:00 pm »
Quote from: "kaoD"
I suppose the automatic binding with scripting languages is still in development or will be a module to CAMP, right?

Well, since Laurent mentioned that the project is unmaintained I wouldn't hold my breath. But I really hope that the community can provide functionality like this. The great thing about CAMP is that only one user needs to write a module that can generate bindings based on CAMP reflection and everybody having classes exposed through CAMP could use it. So if someone writes a module for Lua and someone else writes one for Python - *bam* you already have two scripting languages supported. If the modules are tested and high enough quality, I'm sure there would be a chance of getting accepted into the CAMP codebase.

20
General discussions / Project CAMP - open-source reflection library for C++
« on: February 10, 2011, 10:12:36 pm »
Quote from: "Laurent"
Well, our company had to switch to other projects and nobody currently works on it. I'd like to maintain it on my free time, but I can't. However, anybody can contribute.

Sad to hear that it is currently unmaintained! I believe there is a lot of potential for such a project. C++ is definitely lagging behind other languages when it comes to reflection.
I guess the good news is that the project already looks pretty solid. Hopefully I will soon have some time to take a detailed look at it and try it out in a simple application.

21
General discussions / Project CAMP - open-source reflection library for C++
« on: February 10, 2011, 09:40:52 pm »
Oh, wow, this library looks awesome. Just what I was looking for! At last I wont have this bad feeling that I'm doing a bunch of redundant work when I need serialization and scripting in my application. Please don't tell me the project is dead (no updates since 6 months?).

Pages: 1 [2]
anything