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 - Joshua Flynn

Pages: 1 ... 7 8 [9]
121
Network / Help with making a POST request
« on: July 18, 2011, 12:06:36 pm »
I am unfamiliar with the processes behind making a POST request to a website. I get that you need to use SetField, but I am unsure how to particularly use it.

I want to be able to use it with this site here:
http://jobseekers.direct.gov.uk/

To submit a request to search for particular jobs in a particular area [the two fields at the top] (if it's possible to set the other options too I'd love to know how).

Presently, the program I've built will automatically parse the website, grab the re-direct, change the HTML code into characters, and connect to the re-direct but presently I can't get my program to send a POST request to begin the search. So any help on how would be greatly appreciated.

Thank you.

122
Network / Help with downloading a text file off a website [Solved]
« on: July 16, 2011, 07:01:02 pm »
Sorry, I solved my own problem.

For future reference:

In SetHost - you want to set the main website host name.
In URI - you want to set the subdirectory.

So if you had www.testsite.com/testpage

You will want:
SetHost("www.testasite.com");
SetURI("/testpage");

Sorry for my ignorance!

123
Network / Help with downloading a text file off a website [Solved]
« on: July 16, 2011, 06:48:29 pm »
Hello.

I am trying to use either the HTTP or FTP examples (but I don't really understand them), but a valid webpage is returning 1001 (Connection Failed).

The page I want to access is here:
http://www.swpc.noaa.gov/ftpdir/lists/ace//20110715_ace_mag_1m.txt

But it's being reported as a 1001. I know if I can access it successfully, all I would merely have to do is merely copy from .Body into a file, which is simple enough.

What modifications do I need to make (note, I tried modifying the website address but only got 1001) to the HTTP (or FTP?) example to get it to successfully obtain the text file?

Thank you.

124
Graphics / Sprite scaling/resize relativity issue
« on: May 23, 2011, 02:19:08 pm »
Alright. Resize for some reason, acted relative. I'll try SetScale.

Thank you!

125
Graphics / Sprite scaling/resize relativity issue
« on: May 23, 2011, 02:06:28 pm »
Quote from: "Nexus"
One hour is certainly too early to push your post, especially at this time :roll:


Well, let's try 1pm then. I am a programmer after all.

126
Graphics / Sprite scaling/resize relativity issue
« on: May 23, 2011, 01:23:40 am »
Any offers of help?

127
Graphics / Sprite scaling/resize relativity issue
« on: May 23, 2011, 12:18:10 am »
Hello,

I've got a window of a specific size (512 x 512), and any images whose height is lower than this (256) or greater than this (1024, 2048), have their sprite rescaled to match the 512 requirement.

The problem is, I find the scale/resize system relative rather than absolute, so, for example:

If I load an image that is 256 to sprite, and resize/scale sprite to fit 512, and then I reload another image (also 256), and then resize/rescale sprite - instead of sprite still being 512, sprite becomes 1024, 2048 etc etc.

How do I make it so the scaling of sprite is reset to normal?

Thank you.

128
Graphics / If Image.Create can only work in powers of two, why...
« on: April 26, 2011, 03:26:58 pm »
Quote from: "Laurent"

With the piece of code above, or another one?


With the code above, although I'd presume the same for the code (the other code hasn't yet got rendering whilst I'm testing out any assumptions to avoid bugs).

How would I find out maximum dimensions? What is the smallest dimension a machine could have?

129
Graphics / If Image.Create can only work in powers of two, why...
« on: April 26, 2011, 03:21:13 pm »
Quote from: "Laurent"
You didn't understand me. Please calm down and forget about this power-of-two thing.

Your only problem is that the size of your image (2400) is too high for your graphics card. It's probably limited to 2048 or 1024.

Call "Test.Create(713, 317)", it will work.


So logically it's possible for a non power of two so long as it doesn't exceed size?

Okay, that's good. Thank you for the help so far!

One last question:

Why does the image rendering only display white for the image but no colour/details?

And you've done great work with SFML by the way - very useful.

130
Graphics / If Image.Create can only work in powers of two, why...
« on: April 26, 2011, 02:59:26 pm »
Look! The bypass even works!

I can edit and save a non-power of two image. Why can I not 'create' one?

Code: [Select]
#include <iostream>
#include <SFML/Graphics.hpp>

using namespace std;

int main()
{
    sf::Image Test;
    //Test.Create(2400,500,sf::Color(0,0,0));
    Test.LoadFromFile("Test.jpg");

    sf::Sprite Sprite;

    Sprite.SetImage(Test);
    Sprite.SetPosition(0,0);

    int X = 0;
    while(X < Test.GetWidth())
    {
        Test.SetPixel(X,0,sf::Color());
        X++;
    }

    sf::RenderWindow App(sf::VideoMode(800,400,32),"Graphics");

    while(App.IsOpened())
    {
        sf::Event Event;
        while(App.GetEvent(Event))
        {
            if(Event.Type == sf::Event::Closed)
            {
                App.Close();
            }
        }
        App.Clear();


        App.Draw(Sprite);
        App.Display();
    }

    Test.SaveToFile("NonPowerOfTwo.jpg");
    return 0;
}

131
Graphics / If Image.Create can only work in powers of two, why...
« on: April 26, 2011, 02:56:34 pm »
Quote from: "Laurent"
It's not a power-of-two problem. Like the message says, the size is too high for your graphics card. You see power of two numbers because SFML internally adjusts the dimensions when the graphics cards requires them to be power of two.


But that is why I said was able to set the render window to non-powers of two like 755 by 3 and load images (and render them) of 173 by 371.

It makes no sense my graphics card can't render powers of two, when it clearly, and quite obviously, does!

I could technically bypass (the unnecessary power of two lock) by simply loading up an image with a non-power of two, then setting pixels on it, and saving it.

132
Graphics / If Image.Create can only work in powers of two, why...
« on: April 26, 2011, 02:35:41 pm »
Quote from: "Laurent"
SFML handles non-power-of-two dimensions automatically, so you shouldn't have any problem.

Show me your code and I'll try to find out why you fail to create a NPOT image.


I had tried to develop a work around to use powers of two, but unfortunately, it's really inefficient for disk sectors (files are smaller than the smallest sector and waste space - there could be thousands of them if I use the power of two method - and I don't have the memory to spare).

Here's a basic test version:
Code: [Select]
#include <iostream>
#include <SFML/Graphics.hpp>

using namespace std;

int main()
{
    sf::Image Test;
    Test.Create(2400,500,sf::Color(0,0,0));
    //Test.LoadFromFile("Test.jpg");

    sf::Sprite Sprite;

    Sprite.SetImage(Test);
    Sprite.SetPosition(0,0);

    sf::RenderWindow App(sf::VideoMode(800,400,32),"Graphics");

    while(App.IsOpened())
    {
        sf::Event Event;
        while(App.GetEvent(Event))
        {
            if(Event.Type == sf::Event::Closed)
            {
                App.Close();
            }
        }
        App.Clear();


        App.Draw(Sprite);
        App.Display();
    }

    return 0;
}


Error output is:
"Failed to create image, its internal image size is too high (4096x512) "

The thing is, I don't want a power of two, I want to be able to create the precise dimension in the same way I can load and render an image with the precise dimensions. [Test.jpg is a non-power of two image that loads without issues.]

133
Graphics / If Image.Create can only work in powers of two, why...
« on: April 26, 2011, 02:09:46 pm »
...Can I set a render window size to 755 by 3, and load an image that is 173 by 371?

I don't understand why creating has to conform to the powers of two, but already created images that are loaded and render windows, don't?

Either the graphics card can render non-powers of two, or it can't. But it cannot logically be both or neither.

I really need to be able to create images that are a non-power of two to be able to properly render a graph.

So my help question is thus:

What part of the SFML code do I alter and recompile to disable the power of two lock that appears to be completely unnecessary?

Or, alternately;

How do I create a non-power of two image.

Pages: 1 ... 7 8 [9]