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

Pages: 1 2 [3]
31
Graphics / Converting Image to GLuint (a texture)
« on: August 31, 2009, 03:47:59 pm »
The program crashes.

32
Graphics / Converting Image to GLuint (a texture)
« on: August 31, 2009, 04:10:38 am »
Code: [Select]

GLuint ScreenImage()
    {
    sf::Image img;
    img.CopyScreen(App,sf::IntRect(0,0,512,256));
    const sf::Uint8* ptr = img.GetPixelsPtr();
    GLuint tex;
    glGenTextures(1, &tex);
    glBindTexture(GL_TEXTURE_2D, tex);
    glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,512,256,0,GL_RGBA,GL_UNSIGNED_INT,ptr);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
    glBindTexture(GL_TEXTURE_2D, 0);
    return tex;
    }

what am I doing wrong?

33
General / Static Linking
« on: August 30, 2009, 07:06:13 pm »
Quote from: "Hiura"
yes but dynamic linking "boost" performance with Linux ( at least it doesn't decrease performances ) .


How would I do this, since there are no static libraries for linux. Would I just include the SFML source?

34
General / Static Linking
« on: August 30, 2009, 06:52:14 pm »
Is it possible to static link in Ubuntu 8.10?

35
Window / Window Non-Resizable
« on: August 29, 2009, 09:53:29 pm »
How do I make a window non-resizable?

36
Graphics / Can't load sf::Sprite from a function
« on: August 01, 2009, 05:30:13 pm »
Code: [Select]
#include <SFML/Graphics.hpp>
#include <string>
using namespace std;
sf::RenderWindow App;

sf::Sprite load_sprite(string path)
    {
    sf::Sprite test_sprite;
    sf::Image img;
    img.LoadFromFile(path);
    test_sprite.SetImage(img);
    return test_sprite;
    }

//#define fromFunction // Un-comment the #define to make the image load incorrectly.

#ifdef _WIN32
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
#else
int main()
#endif
    {
    App.Create(sf::VideoMode(640, 480, 32), "SFML Window");
    sf::Sprite spr;
    #ifdef fromFunction
        spr = load_sprite("image.bmp");
    #else
        sf::Image bobf;
        bobf.LoadFromFile("image.bmp");
        spr.SetImage(bobf);
    #endif
    spr.SetCenter(120,80);
    spr.SetScale(1,1);
    spr.SetColor(sf::Color(255,255,255));
    spr.SetX(320);
    spr.SetY(240);
    bool loopin = true;
    while(loopin)
        {
        sf::Event Event;
        while (App.GetEvent(Event))
            {
            if ((Event.Type == sf::Event::Closed) || ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)))
                {
                App.Close();
                loopin = false;
                break;
                }
            }
        App.Draw(spr);
        App.Display();
        sf::Clock clock;
        clock.Reset();
        while(clock.GetElapsedTime() < 1/60)
            {}
        }
return EXIT_SUCCESS;
    }

Output when fromFunction is defined

Output when fromFunction is NOT defined


edit:
fixed something. but the problem still occurs

Pages: 1 2 [3]