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

Pages: [1] 2
1
Graphics / Framerate, rendering and optimisations
« on: February 24, 2012, 04:46:45 am »
Just a follow-up, I installed Bumblebee and it works great. My game runs at about 60-ish FPS compared to the 18-25 I was getting before. Thanks for your help in getting that set up :)

So all in all, everything's great :D

2
Graphics / Framerate, rendering and optimisations
« on: February 17, 2012, 08:07:26 am »
I'll do that sometime next week (I'm going to be really busy over the next few days & I can only download stuff in the morning thanks to internet limits.). Thanks heaps for your help; I really appreciate it.

Aye, it is a better question for a different forum, but when I started the topic, I thought my coding with SFML might have been the issue. Then it hit me that it might be my software setup. If I have any more problems, I'll start a new thread over at the ubuntu forums.

Thank you :)

3
Graphics / Framerate, rendering and optimisations
« on: February 16, 2012, 09:03:36 pm »
1) It looked alright when I was editing it. I agree it was a bit much after I posted it. The smiley faces are a bit bright. I didn't think anyone would care that much though or I would've edited it. I'm sorry if I hurt your eyes ;)

2) My source code goes pretty much like this:
Code: [Select]

while( running ) {
    // process events and call "step" on all objects
    for( int i=0; i<objects.size(); i++ ) {
        objects[i]->render( m_renderwindow );
    }
}

That is virtually all there is to it. In the render() function they just do window.Draw( sprite ). It's virtual, too, so that no doubt contributes, but so is the step() function. My actual source code is pretty messy (I'm going with the "lets just get this sh!t done" approach, because all the other times I've tried to "do things properly" I've spent hours coding stuff and ending up nowhere).

3) Yes, other OpenGL apps run slowly too. AssaultCube does, when it runs perfectly fine on windows (I dual boot). I get like 220 FPS on windows. Here's the output from glxinfo: http://codepad.org/wrSbMhzm

4) How come? Mine's pretty stuffed up - I can't play videos and it's just really messed up.

I am using a laptop, sorry, should've said that. Thanks heaps for that info; I'll follow that up. It ain't looking good for my card, is it? XD

I don't know what drivers I'm using. Every time I tried to install the propietary drivers, it wouldn't boot up, and I'd have to fall back to whatever the default is. I think it's the software renderer. How do I tell which drivers I'm using?

At least it's not my coding. That is something I'm happy about. I like to think that I'm a half-decent coder :wink:

And Tank, I don't know if you remember trying to teach me what a quadtree is (I'm the tennis-playing guy), but I finally managed to implement one.

4
Graphics / Framerate, rendering and optimisations
« on: February 15, 2012, 10:57:04 pm »
Hi! :)

So I'm coding this little game, just for fun, and when I add say more than twenty objects, it starts to go downhill. I have a recent computer with a graphics card (nvidia geforce GT 540m, it says) and a intel core i5 CPU. So it's not slow or anything.

Could it possibly be because I'm using linux, and I couldn't work out the drivers and I think I'm using the software renderer? AssaultCube runs really slowly on it. Is that the cause?

I commented out the line that initiates the rendering, and got an FPS of about 64-70. Which is good, because I set the renderWindow to have a max framerate of 64. But when the line is uncommented (that is, I allow it to render my objects, of which I only have about 40, 32x32 sprites) the FPS drops. A lot. I got it down to 18 once.

I was going to post a whole lot more info, but it just hit me that it's probably the software renderer, isn't it?

*groans* I'm going to have to reinstall linux :(

5
Graphics / yay :)
« on: January 02, 2011, 03:35:48 am »
thanks for the reply :)
You were right, I fed SetImage invalid data. I could have sworn my ImageManager was working, but there you go. Epic failure by myself :)

Thanks for spending your time to help me out :)

Take care :)

[edit] Case closed!

6
Graphics / :(
« on: January 01, 2011, 11:22:54 pm »
As far as I'm aware, those are the only two options available to you :(

But you never know, someone smarter than me might come along and find a fix :)

Could you possibly smooth your graphics before even loading them into your game? ie. do it in the image editor?

7
SFML website / How about sending an email when a new topic is posted?
« on: January 01, 2011, 11:31:46 am »
Quote from: "Laurent"
It will probably be available with the next forum.

Cool :)
Thanks for SFML, it really is awesome :)

Take care :)

8
SFML website / How about sending an email when a new topic is posted?
« on: January 01, 2011, 01:33:38 am »
On these forums, it would be nice if there was a "Watch forum" button, or something, so I could "watch" the Graphics forum, and every time a new topic is posted, it sends me an email with the topic (not for every post though, only topics). You could even do a "daily digest" of posts (posts, not topics) each day.

Forgive me if it's already implemented ;)
I can't find it anywhere, is all.

Justification: I don't have enough time to browse these forums (and even if I did I would forget), but I do like helping people, so when I see a topic I can help with, I'd be able to jump right in.

Anyway, there's my twenty cents :)

9
Graphics / [solved] sf::Image* problem ;)
« on: January 01, 2011, 01:22:21 am »
Hi there! I'm trying to make a class that handles animation (and before you ask, I checked out the wiki, what was there didn't fit my needs), and am having some problems ;)

Basically, my class takes a pointer to a sprite and changes that sprites image based on what frame it should be at (the frames are pointers to images). Here's the code, which'll hopefully speak for itself :)

Animation.hpp
Code: [Select]
#ifndef Animation_hpp
#define Animation_hpp

#include <string>
#include <vector>
#include <SFML/Graphics.hpp>

class Animation {
public:
Animation();
void SetSprite(sf::Sprite*);
void AddFrame(const std::string& path);
void SetSpeed(unsigned int speed);
void AdvanceFrame();
//private:
std::vector< sf::Image* > mFrames;
sf::Sprite* mSpr;
unsigned int mSpeed;
unsigned int mCurrentFrame;
unsigned int mCount;
};

#endif

Animation.cpp
Code: [Select]
#include "Animation.hpp"
#include "Main.hpp"
//imagemanager.hpp is just my images manager, surpisingly
#include "ImageManager.hpp"

#include <iostream>

Animation::Animation() {
mCount = 0;
mSpeed = 10;
mCurrentFrame = 0;
}
void Animation::SetSprite(sf::Sprite* spr) {
mSpr = spr;
}
void Animation::AddFrame(const std::string& path) {
        //ImageManager.LoadImage() just returns a pointer to an image.
sf::Image* timg = ImageManager.LoadImage(path);
mFrames.push_back(timg);
}
void Animation::SetSpeed(unsigned int speed) {
mSpeed = speed;
}
void Animation::AdvanceFrame() {
if (mFrames.size() > 0) {
mCount += mSpeed;
if (mCount >= 100) {
mCount = 0;
mCurrentFrame++;
if (mCurrentFrame == mFrames.size()-1) {
mCurrentFrame = 0;
}
//std::cout << mFrames.size()-1 << " : " << mCurrentFrame << std::endl;
mSpr->SetImage( *( mFrames[mCurrentFrame] ) );
}
}
}

So now you hopefully know what I'm getting at.
Here's the code I'm using to use this class:
Code: [Select]
     mAnim.SetSprite(&mSpr);
mAnim.AddFrame("images/trail-b_u.png");
mAnim.AddFrame("images/trail-b_r.png");
mAnim.AddFrame("images/trail-b_d.png");
mAnim.AddFrame("images/trail-b_l.png");

and in the main loop I call mAnim.AdvanceFrame();

 I did a bit of testing, and replaced
Code: [Select]
void Animation::AddFrame(const std::string& path) {
        //ImageManager.LoadImage() just returns a pointer to an image.
sf::Image* timg = ImageManager.LoadImage(path);
mFrames.push_back(timg);
}

with
Code: [Select]

void Animation::AddFrame(const std::string& path) {
sf::Image* timg = ImageManager.LoadImage(path);
mFrames.push_back(timg);
sf::Image* img;
std::cout << "a" << std::endl;
img = (mFrames[0]);
std::cout << "b" << std::endl;
mSpr->SetImage(*img);
std::cout << "c" << std::endl;
}

and my output is
Code: [Select]
a
b
c
a
b
c
a
b
Segmentation fault

Isn't this fun? So I seem to be getting the error when I do "mSpr->SetImage(*img);". Quite frankly, I have no idea why. It might be my imagemanager's fault, but I doubt it.

Thanks for reading that through and even if you've just got an idea of what's wrong, I'd love to hear it  :)

I just thought I'd put my twenty-cents in and say I reckon SFML would do nicely with an animation class of it's own :)

If I forgot anything don't hesitate to remind me :)
Thanks :)
Stewart

[EDIT] Sorry if this is in the wrong section, or has nothing to do with SFML. I just didn't know where to put it :(

10
Feature requests / Copy a Sprite onto an Image
« on: November 25, 2010, 08:46:01 pm »
There we go then :). You've already done it! I actually did have a look at the SFML 2 doc before I posted, but I only looked in the sf::Image class.

Well, thanks for such an awesome library and thanks for responding to my post :)

11
Feature requests / Copy a Sprite onto an Image
« on: November 25, 2010, 10:22:18 am »
You know how you can copy a sf::Image onto another sf::Image? This is a handy feature I'm using quite a bit in the game I'm making. However, I feel being able to copy an sf::Sprite onto a sf::Image would be extremely useful. When you copy a sf::Image you don't get the rotation, scale factors or anything. Because of this, instead of just using Rotate(), I'm going to have to use about 5 different images in my game. I think this would be a useful addition.

So basically, I would like to copy a sf::Sprite onto a sf::Image. It's just a suggestion :)

Awesome library, really simple, keep it up!

12
General / Having trouble with DLLs, threads AND RenderWindows
« on: October 12, 2010, 11:40:56 am »
Quote
Your app looks like a regular desktop app rather than a real-time multimedia thing, so why don't you use a library such as Qt? Or I am missing something? What's the relation between the utilities that you describe and 2D rendering?

hehe, well, err..  ummm.... well... Nothing, I suppose, I just thought since I knew a little SFML I just thought I'd use it  :oops:

Yeah, ok, I'll try a library. Thanks so much for your help, and at least I got the DLL part right :)

-- Stewart
 8)

13
General / Aww shucks
« on: October 12, 2010, 10:49:52 am »
Aww shucks
I thought that'd be the case :(

Hmm... Okay, I'll tell you more about it :). I'm going to have this "core" program I'm coding that loads so-called modules and will make a tab for each module. When the tab is clicked on, the module will show whatever it wants in that tab, and the modules will be able to display things anywhere else, as well.

The modules are mostly going to be utilities that I'm probably going to code (hopefully some other people will code some too!) that do useful things. They will be programs that are hardly useful, like one might be for text-storing (ever had a snippet of code that you need to store for a second?), and instead of having 50 different programs that do useless things, you can just have one.

I'm calling it Companion, because it's going to sit unnoticed on the side of the screen, not visible. When you move your mouse to the corner, it'll appear with all these useful things to do (hey, a todo list. Not a bad idea!)

I was recommended by a friend to use threads and DLLs and I choose SFML myself (I love it :)). I suppose I could do things differently (I suppose I don't really have a choice).

What if I created a couple of functions in the DLL, say start, step and end? Each function could then be called when the appropriate thing happens. And all the variables that the DLL uses could just be global? Would that work, do you think? (I'm rather new to C++, and haven't spent much time with DLLs either).

-- Stewart

14
General / Having trouble with DLLs, threads AND RenderWindows
« on: October 12, 2010, 10:24:39 am »
I'll take that as a no?

I need them to draw on the same window because... well... it's kinda hard to explain.

I'm creating a program that will contain heaps of other little programs, and I was going to load them from DLLs and each one would have it's own thread, for simplicity. The DLLs would obviously need to draw on the window, otherwise how could the user interact with them?

Is there any way around this, or do I need to re-design my code?

Thanks again for helping me :)

15
General / :(
« on: October 12, 2010, 10:17:01 am »
So if I did that, I could only ever have one thread drawing on the window at a time?
 :cry:
This is not good.
 
Thankyou for the quick response :).

-- Stewart

Pages: [1] 2