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

Pages: [1]
1
Window / DEVIL and SFML, ilutGLScreen()
« on: July 04, 2009, 02:12:08 am »
Quote from: "Laurent"
It works fine for me (Windows XP, Visual C++ 9, both SFML 1.5 and SFML 2.0). What is your configuration?

Winsows XP pro, eclipse\mingw (gcc v3.45) SFML v1.5

I call gcc with these libs : -lopengl32 -glu32 -lsfml-audio -lsfml-graphic -lsfml-window -lsfml-system

Quote from: "Laurent"

By the way, you're doing a few weird things:
Code: [Select]
_input = (sf::Input*) &(_app.GetInput());
You'd better declare a const sf::Input* rather than using this ugly cast.
Code: [Select]
delete _input;
Nobody told you to delete the window's input object ;) (it crashes)
Code: [Select]
sf::VideoMode::VideoMode(w, h, bpp)
You're calling a constructor rather than instanciating the class. Surprisingly it works, but anyway it should be written like this:
Code: [Select]
sf::VideoMode(w, h, bpp)

And don't include all these unnecessary headers, only SFML/Graphics.hpp is needed in your code. Including too many files can increase the compilation time a lot.


 :shock:

Thanks!

2
Window / DEVIL and SFML, ilutGLScreen()
« on: July 03, 2009, 06:14:35 pm »
Quote from: "Laurent"
Can you give a complete example so that I can compile and try it directly?


http://rapidshare.com/files/251494580/src.rar.html

3
Window / DEVIL and SFML, ilutGLScreen()
« on: July 01, 2009, 09:14:13 pm »
Quote from: "Laurent"
Is the application running fine, apart from this screenshot issue?
Do you call _app.GetEvent somewhere?


Yes, it run ok, and i handle the input..
The file is created, but is all white, or violet.

4
Window / DEVIL and SFML, ilutGLScreen()
« on: June 30, 2009, 11:14:53 pm »
Quote from: "Laurent"
Which version of SFML are you using? Can you show your main loop?

I'm using the last, 1.5.

Code: [Select]


#include <SFML/Window.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>

class OGLContext {
    private:
        sf::RenderWindow _app;
    public:
        void initialize (const char *title, int bpp = 32, int w = 800, int h = 600, bool resize = false, bool full = false)
}

void OGLContext::initialize (
                    const char *title, int bpp, int w, int h, bool resize, bool full)
{

    unsigned long style = sf::Style::Close;
    if (resize) style |= sf::Style::Resize;
    else if (full) style |= sf::Style::Fullscreen;

    _app.Create(sf::VideoMode::VideoMode(w, h, bpp), title, style, sf::WindowSettings::WindowSettings(24, 8, 2));

}


void RenderScene(){
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
     //......
     // call _app.Display()
     app->update();
}


int main(int argc, char *argv[] )
{

    app = new OGLContext("OpenGL with SFML", 1024, 768, 32);

   // loading other things

  // i'm newbie with opengl, i use this options
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);
    glDepthFunc(GL_LEQUAL);
    glClearDepth(1.0);
    glShadeModel(GL_SMOOTH);
    glDisable( GL_DITHER );

    glEnable(GL_COLOR_MATERIAL);
    glEnable( GL_MULTISAMPLE);
    glEnable(GL_POINT_SMOOTH);
    glEnable(GL_POLYGON_SMOOTH);
    glEnable(GL_LINE_SMOOTH);
    glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
    glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
    glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

    // more...

    while (app->isOpened()){

       // The _app.Display() is inside this render function
       RenderScene();

        if (app->isPressKey(sf::Key::Num0)){
             app->screenshot("screen_shot.png");
        }
    }
}


5
Window / DEVIL and SFML, ilutGLScreen()
« on: June 30, 2009, 09:04:26 pm »
Quote from: "Laurent"
When do you call it?

I call it in the main loop.

Quote from: "Laurent"
And why don't you use SFML to achieve this?

Do you want ignoring the problem with DevIL? :)
Wll, I tried now, with sf::RenderWindow instead of sf::Window.

I used:

Code: [Select]
sf::Image my = app.Capure();
my.SaveToFile("myfile.png");

The image saved is all white...

6
Window / DEVIL and SFML, ilutGLScreen()
« on: June 30, 2009, 12:18:56 am »
I'm using DEVIL to manage images on my program.
It seems i can't make a screenshot of my opengl window using DEVIL, while i can do it finely with SDL (instead of SFML)..

The image created with my function is all black, i can't see anything.
No error is returned.

What about ilutGLScreen() and SFML?

Code: [Select]
bool ImagesDevIL::screenshot(const char *c){
     ILuint temp, devilError;
     ilGenImages(1, &temp);
     ilBindImage(temp);

     if (!ilutGLScreen()) cerr << "error ilutGLScreen";

     ilSaveImage(c);
     devilError = ilGetError();
     if (devilError  != IL_NO_ERROR) {
          cerr  << "Devil Error: " << iluErrorString(devilError) << endl;
          return false;
     }

     ilDeleteImages(1, &temp);
     return true;
}

7
Audio / sounds not work in 3d
« on: June 20, 2009, 06:42:31 pm »
Quote from: "Laurent"
Make sure that your sound is mono, not stereo.

Oops.. Now it's ok.
Sorry :)

8
Audio / sounds not work in 3d
« on: June 19, 2009, 07:51:07 pm »
The sound has always the same volume...

Code: [Select]
    sf::SoundBuffer Buff;
     if (!Buff.LoadFromFile("footsteps.wav"))
         return EXIT_FAILURE;

     sf::Sound Buffer(Buff, true);
     Buffer.SetPosition(3.f, 2.f, 6.f);
     Buffer.SetMinDistance(2.f);
     Buffer.SetAttenuation(12.f);

     Buffer.Play();

     while (App.IsOpened()){
          sf::Event Event;
          while (App.GetEvent(Event)){
               if (Event.Type == sf::Event::Closed) App.Close();
               if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)) App.Close();
          }
          ax+=0.3;
          Buffer.SetPosition(ax, 1, 3);

          App.Display();
     }


Pages: [1]
anything