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

Pages: 1 2 3 [4]
46
Quote
You make changes in the CPU RAM, then upload (tex.update()) it to the GPU RAM. That's why it's a heavy operation. But it's also not possible to get access to the texture on the GPU, unless you use shaders.

Wouldn't it be more efficient though to unlock access to the video memory and just write whatever pixels changed then return access back to the GFX card, than writing it to CPU memory, and then transferring everything (including pixels that didn't change and alpha pixels) to the GFX?

47
Quote
Yes it's because of RGBA and no you can't just use 3 uint8 with SFML.

I suppose thats okay since I won't be setting any alpha pixels (later) I won't need to send the entire thing, but only the changes I make to RGB - right?

By the way, when I make changes to the pixel array, am I making changes to the array in video memory directly, or do I just make changes to the array in RAM and then upload the entire thing to video memory before doing an update?

48
Quote
(an sf::Uint8 array of size width * height * 4)

Is '* 4' due to RGBA? Would it be faster/possible to do just '*3' and not have an alpha channel (since there's nothing behind the frame)?

Quote
I'm wondering what's worse between...
- loading an image with sf::Image, copying its data to a raw array, modifying the raw array and then uploading the data to a sf::Texture
and
- loading an image with sf::Image, using setPixel() and then loading the texture from the image

Sorry Ceylo I may have confused you as I modified my previous post before you replied.
I'm either going to be loading images from file or I'm going to be drawing images to memory. I don't think I will need to setPixel on images that were loaded from file.

49
Just one more thing, is it possible to create a blank canvas in memory where I can manipulate the pixel data, and then draw that canvas (without having to write/load from HDD)?

Could you recommend an efficient way to do this (efficient enough to cover an entire screen with pixels)?

Sincerely,
Tom

50
Hammer: "Hurry up and get in there - I have another 59 frames!"
Screw: "Hang on hang on! I need to slowly screw myself"

Something like that.

Here is an alternative way to look at the problem.


51
It's kinda funny in a way, that even today computers (as strong as they are) are not very good at playing decent quality (raw) videos at decent frame rates.

Thanks for your input Ceylo.

Either way, I still have to make this program as it is part of my job. I'll just have to put up with less than real-time until computers get faster/cheaper.

If you guys think of any other ideas that might help please feel free to let me know. :)

Tom.

52
Great, wow thanks. I'm glad I stumbled across SFML (I was planning on using DirectX before but it was really mind-numbing since I'm new).

I'm going to give your advice a shot and post here if I have any problems.

Thanks again :)

53
Thanks Laurent.

Could you recommend what method would be most efficient for displaying only a cropped portion of the image file?
e.g. If the image file is 3000x2000, only show a cropped portion from 0,0 to 1920,1080?

I could probably do this myself by only reading/storing the relevant pixel area from the bitmap (since bitmap data is stored predictably), but then once I have that pixel array in memory could I still use window.draw()? And if so, how?

PS: Is that script already dynamic and hardware accelerated? Looks almost too simple! :o (I was expecting a lot more coding)

Thanks,
Tom

54
@Laurent: Sorry I meant compared to (equivalent) lossless videos.

This program will not be run on a standard PC anyway, as this is for work purposes, it will be high end (high enough that it could play lossless video) - but still needs to be as fast/efficient as possible.

Since I'm new to C++/SFML, could you help point me towards what the fastest method for file loading is? (assuming there is a 'faster' way to do it), and what kind of texture loading functions will I need to use? Do I need to set them to 'dynamic'? Would this be 'hardware accelerated'?

Sincerely,
Tom

55
General / Re: Is it possible to make a video player with SFML?
« on: March 24, 2013, 01:37:12 am »
I'm not literally making a 'video player', rather, this program is needed for frame examination and manipulation purposes, and so I need to keep them as individual frames. But I may need to 'play' the frame sequence at real time (which may be 30-60 FPS depending on what I get)

What is the fastest way to store the pixel array from the image file and then display the array? This is important as I may just want to display a smaller portion of the frame on the screen, especially if the frame size is bigger than my monitor (and I can't have the frame scaled down as it must be 1:1 pixel/monitor ratio).

Quote
I doubt you'll ever succeed to read HD videos at 60 FPS from individual images...
Why? Videos are really just a container with all the individual frames in them and also get decoded , then displayed on the screen.

Isn't it the same thing?  :-\

56
General / Re: Multi-Language support in my game
« on: March 23, 2013, 12:25:09 pm »
I think the easiest way is to store all the strings in a separate text/ini file and name the file what ever language it is (eg. 'English.ini' etc.)

Have the user select which language they want, then get the strings from that file.

eg.

then when show a message, just do something like:
message("Hello")

the message function would look for a key in the ini called "Hello" and find the corresponding word (which in english will still be hello), and display the corresponding string.

The ini file would look like this for english:

Hello=Hello
What is your name=What is your name

the Italian ini file would look like:

Hello=Ciao
What is your name=Vive name el solo
----

Otherwise instead of constantly reading from the file, you could store all of the strings in memory, maybe use a struct, stored in an array?

string myString
string translatedString

And then when use message("Hello") function, the function will look through all of your structs for "Hello" in myString, and return what ever the translatedString is.

Sorry I'm still a novice at C++, so I don't know if my advice is any good.

57
Hi everyone,

I have sequences of images (BMP or PNG) on my HDD and need to 'play' them as if they were a video.

Does anyone know the fastest way to:

1) Read file data from the HDD and store contents into a pixel array
2) Display that pixel array on the screen
... so that I can get up to 60 FPS with frames that are 2000x1000 resolution?

Any ideas or advice?

Pages: 1 2 3 [4]