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

Pages: [1]
Window / Cannot draw 2D elements with modern OpenGL
« on: June 04, 2015, 09:50:46 pm »

I'm trying to draw some 2D elements mixed with some 3D elements using OpenGL 3.3, but 2D elements never appears in the screen.

I prepared a full example to test this issue:

Some info:
- SFML: I tried it with version 2.1 and 2.3 with the same result.
- OS: Win7 64b (but game is compiled in x86).

Can anybody help me to make this works?


Graphics / sf::Texture and std::vector error
« on: January 12, 2013, 07:51:54 pm »
Hi! I'm newbie in STL use and I'm doing some tests with a vector of my own class. The code:
class Animation{
        sf::Texture m_texture;
        sf::Sprite m_image;
        // Other stuff
        // Constructors
        Animation (std::string file){
                m_image = sf::Sprite(m_texture);
                // ...
        Animation (const Animation& anim){ // Copy constructor
                m_texture = sf::Texture(anim.m_texture);
                m_image = sf::Sprite(anim.m_image);
                // ...
        // get the sprite to draw      
        sf::Sprite& getSprite(){
                return m_image;

class Game{
        std::vector <Animation> m_player;
        // ...
        void run(sf::RenderWindow *m_window){
                loadLevel(); // Load players and so on...
                // Load players, method 2 (with this game works fine)
                /*Animation a("001.png"), b("002.png");

                while (m_window->isOpen()){
                        sf::Event event;
                                if(event.type == sf::Event::Closed || (event.type == sf::Event::KeyReleased && event.key.code == sf::Keyboard::Escape)){
                        for (std::vector<Animation>::iterator i = m_player.begin(); i < m_player.end(); i++){ // Draw the animations
                                m_window->draw((*i).getSprite()); // Here I get the error
        void loadLevel(){
                Animation a("001.png");
                Animation b("002.png");
        void unloadLevel(){

int main(int argc, char **argv){
        sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
        Game game;
        return 0;

The problem is that, when I use "loadLevel()" to load my animations, I get an error when I try to show them, or get an empty texture (the shape of the image filled in blank), but when I use the "method 2" instead of "loadLevel()" it works fine...

Any idea?

I'm using SFML 2.0 with CodeLite 5570 (Win7 x64).

Thank you.

PS: You can download the project from HERE

Graphics / [SOLVED] Sprite resize error
« on: October 28, 2011, 02:30:38 pm »
I load an image with:
Code: [Select]
sf::Image img;
sf::Sprite sprite;

img.LoadFromFile("myimage.png"); // An image of 480x530 px

sprite.SetPosition(0, 0);
sprite.Resize(480, 530);

and when I show it with App.Draw (sprite); there's no problem. But then I change the image with:
Code: [Select]
img.LoadFromFile("biggerimage.png"); // An image of 500x500 px
sprite.Resize(480, 530);

then the image looks 500x500 size but cutted to 480x530, so it looks ugly.

How can I change an sprite image into a bigger image and resize it correctly?

Window / [SOLVED] App chash when minimize
« on: October 24, 2011, 12:38:21 pm »

I have write a code to keep aspect ratio in my app, but when I minimize the window, my app crash.

The code is:
Code: [Select]
// sys.panoramica is 1 if resolution screen is panoramic
// sys.proporcional set if we will keep the aspect ratio

sf::Event Event;
while (App.GetEvent(Event)){

        // keep aspect
if (Event.Type == sf::Event::Resized){
if (sys.panoramica ){
if (sys.proporcional && ( (App.GetHeight()*100 / App.GetWidth() != 56) && (App.GetHeight()*100 / App.GetWidth() != 60) ) ){
App.SetSize(App.GetWidth(), ( App.GetWidth() * 60 / 100) );
if (sys.proporcional && (App.GetHeight()*100 / App.GetWidth() != 75)){
App.SetSize(App.GetWidth(), ( App.GetWidth() * 75 / 100) );

Some idea?  :?

I'm using Win7-32, CodeLitte and SFML 1.6

Window / [SOLVED] Window Size problem
« on: May 27, 2011, 03:08:23 am »
Hi! I have some problems with my window size. I mean, I do that:

Code: [Select]
// 1280x800x32 is my desktop configuration
sys.width = 1280;
sys.height = 800;
sys.bpp = 32;

*  *  *

sf::RenderWindow App;
char title[100] = "";
sprintf (title, "Storm Alarm %d.%d.%d", sys.version, sys.revision, sys.beta);
App.Create(sf::VideoMode(sys.width, sys.height, sys.bpp), title);
App.SetIcon(39, 38,  Icon.GetPixelsPtr() );
printf ("Width: %d  Height: %d\n", App.GetWidth(), App.GetHeight());

But in DOS console I get:
Code: [Select]
Width:1280  Height: 778

And my window background is incompleted, as the titlebar was eatting up the image, but if I try with 1280x720 or minor I have no problem.

There is a screenshot with the window maximized:

I'm using SFML 1.6, Windows 7 and CodeLite with g++.

Some idea?

PS: Sorry about my English -.-U

Pages: [1]