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

Pages: [1] 2
1
Graphics / Re: Access Violation in when creating sf::Window
« on: August 28, 2012, 10:59:23 pm »
Fixed it.  It was because the default setttings for the library were Mta while my binaries were compiled for MDd.  Turns out cplex has binaries for all 4 code generation settings and I just had to change what lib files i was linking.

2
Graphics / Re: Access Violation in when creating sf::Window
« on: August 28, 2012, 09:02:36 pm »
Yeah, I compiled my own 64 bit binaries and got it working with another program that was only using sfml.

This IBM ILOG Cplex requires some funky settings so I got it working before adding the sfml part.  Which seems to be messing it up.  I need 64 bit because the optimization part requires more than 4 GB of memory.

3
Graphics / Access Violation in when creating sf::Window
« on: August 28, 2012, 08:51:57 pm »
I am using VS2010 with sfml 2.0 rc and I am getting an access violation when creating a window.  I was able to make other sfml programs work fine, but my project file seems to be messing this one up.  This is the line of code the program fails at in WindowImplWin32.cpp.

 int count = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, title.c_str(), static_cast<int>(title.size()), wTitle, sizeof(wTitle) / sizeof(*wTitle));
 

I thought it was a unicode problem so I changed Project->Properties->General->Character Set to Use Multi-Byte Character Set but that didn't work.

I don't want to make a project from stract because I am using IBM cplex and all the settings are working for it but seem to conflict with sfml settings.  I attached my project file.



[attachment deleted by admin]

4
General / Using sfml with IBM's cplex optimizer
« on: July 26, 2012, 11:07:25 pm »
I am using IBM's cplex optimizer alongside with sfml to do some visualization of the results.  I can get it compiling and running fine but for some reason the sfml header files are recognized so Visual Studio is always red-under-lining anything in the sf namespace.  I also don't get any of the auto-completion of sf functions or classes.  This makes it more much more difficult to program because I don't have the library memorized.  Here is my project file with the settings required to run cplex.

I am using cplex v12.4 and the sfml-2.0 release candidate.



[attachment deleted by admin]

5
General / Re: Problem Running OpenGL example with VS2010 sfml2.0-rc
« on: May 21, 2012, 01:31:21 am »
I seem to have figured it out.  Not sure what was wrong, just started from scratch.

6
General / Problem Running OpenGL example with VS2010 sfml2.0-rc
« on: May 20, 2012, 10:16:38 pm »
I am trying to run the opengl example on the github page.  I got it to compile but when I run it it crashes and makes a strange beeping noise.  When I run the debugger it says it crashes on this when loading the background.jpg.

Code: [Select]
if (!backgroundTexture.loadFromFile("resources/background.jpg"))

Am I missing the jpg library or something?  I can't figure out what is going wrong.

7
General / Re: Problem Building the SFML 2.0 Release Candidate
« on: May 18, 2012, 01:37:20 am »
Thank's that fixed it.  Sorry for being so careless.

8
General / Re: Problem Building the SFML 2.0 Release Candidate
« on: May 17, 2012, 07:43:38 pm »
My directories may be different than yours my sfml folder is in c:\sfml\SFML-2.0-rc\

Thanks for your help.

[attachment deleted by admin]

9
General / Re: Problem Building the SFML 2.0 Release Candidate
« on: May 17, 2012, 07:23:19 pm »
I cleaned and rebuilt.  I am using static, and I included the SFML_STATIC define.

10
General / Problem Building the SFML 2.0 Release Candidate
« on: May 17, 2012, 05:25:58 am »
I had sfml 2.0 running from the compiled source. I noticed that the sfml 2.0 release candidate was posted so I thought I would update and I am having trouble compiling a simple example, which I assume is a problem linking.

This is the error I get
main.obj : error LNK2001: unresolved external symbol "public: static class sf::RenderStates const sf::RenderStates::Default" (?Default@RenderStates@sf@@2V12@B)
1>C:\Users\Nolan\documents\visual studio 2010\Projects\mapmaker\Debug\mapmaker.exe : fatal error LNK1120: 1 unresolved externals

and this is all the code I am using

#include <iostream>
#include <SFML/Graphics.hpp>

using std::cout;
using std::endl;

int main()
{
        sf::RenderWindow window(sf::VideoMode(300, 200), "SFML works!");
        sf::Text text("Hello SFML");

        while(window.isOpen())
        {
                sf::Event event;
                while(window.pollEvent(event))
                {
                        if(event.type == sf::Event::Closed)
                        {
                                window.close();
                        }
                }
                window.clear();
                window.draw( text );
                window.display();
        }

        return 0;
}
 

Everything compiles except the ' window.draw( text ); ' line so there is something wrong there but I am unsure what it is.  The new release came with precompiled .dll's so I didn't compile anything with cmake or Nmake.  Also I deleted all old sfml related stuff so there shouldn't be a problem with that.  This is visual studio  2010.

11
Graphics / Questions About Textures in SFML
« on: February 20, 2012, 01:51:38 am »
Thanks, appreciate your feedback.

12
Graphics / Questions About Textures in SFML
« on: February 20, 2012, 01:32:40 am »
I have some questions regarding texture size and performance.

    Should textures width and heights always be powers of 2?  ie 128, 256, 512 etc I know it is important in other libraries but does sfml account for it?

    How do large images (100kb) affect performance?

    Whet is the best file format to use for the images? png, jpg... etc


Thanks

13
Graphics / Animation doesn't loop
« on: February 19, 2012, 11:23:56 am »
Where is frameTime changed?  I'm assuming this relates to the iterator frame?  Is it updated when the frame iterator is incremented?

14
Graphics / Scrolling Text Issue
« on: February 04, 2012, 03:52:18 am »
Well i fixed it, I think my program has a memory leak, because i restarted and that seemed to fix the low framerate problem.  But I also changed the code. I remembered that streamstream separated by spaces so I changed it to this.

Code: [Select]

Time += float(Window.GetFrameTime())/1000.f;
      int charstoshow = int(Time*CHARSPERSECOND);
      for(unsigned int i=0;i<TextLines.size();++i)
      {
         // More or equal to the amount of chars in this line
         if(charstoshow >= TextLines[i].size())
         {
            TextToDisplay[i].SetString(TextLines[i]);
            Window.Draw(TextToDisplay[i]);
            charstoshow -= TextLines[i].size();
         }
         // this line will run out of characters
         else
         {
            string str;
            for(unsigned int j=0;j<charstoshow;++j)
            {
               str += TextLines[i][j];
            }
            TextToDisplay[i].SetString(str);
            Window.Draw(TextToDisplay[i]);
            break;
         }
      }

15
Graphics / Scrolling Text Issue
« on: February 04, 2012, 03:36:50 am »
Hello, I want text to scroll onto the screen.  Ie. display more and more characters every time step of some given string.  I also have it divided up into lines.  I got the code working up the method I am using seems to be very inefficient because I am getting very low framerates. I bet it is because I am using sf::Text::SetString a lot but I am unable to think of a better solution.  This is in SFML 2.0.

Here is the snippet of code I am using:

Code: [Select]

Time += float(Window.GetFrameTime())/1000.f;
      int charstoshow = int(Time*CHARSPERSECOND);
      for(unsigned int i=0;i<TextLines.size();++i)
      {
         // More or equal to the amount of chars in this line
         if(charstoshow >= TextLines[i].size())
         {
            TextToDisplay[i].SetString(TextLines[i]);
            Window.Draw(TextToDisplay[i]);
            charstoshow -= TextLines[i].size();
         }
         // this line will run out of characters
         else
         {
            std::stringstream ss;
            for(unsigned int j=0;j<charstoshow;++j)
            {
               ss << TextLines[i][j];
            }
            string temp;
            ss >> temp;
            TextToDisplay[i].SetString(temp);
            Window.Draw(TextToDisplay[i]);
            break;
         }
      }



Time is a timer i use to keep track of when the text should start scrolling and how far i am along.  Then i cast it to an int to find how many characters i should show.  TextLines is a stl vector holding strings for each line of text. Then text to display is a stl vector holding sf::Text for each line.  I set the strings then display them, when I run out of characters I break.  This is done each time step.  Any help on a better implementation would be appreciated.  Thanks.

Pages: [1] 2