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

Pages: [1] 2
1
Window / OpenGL context resource sharing
« on: September 02, 2013, 06:07:19 pm »
Assuming I have some secondary threads and one main thread that runs the window.

Is it enough to just create the window in the main thread, and instantiate sf::Context once per secondary thread in the respective thread? Will the active context of the main thread have access to OpenGL resources created by secondary threads (i.e. if I create a texture in thread 2 and receive the name "42" for it from OpenGL, will the other threads be able to access it via glBindTexture(..., 42)?).

2
Window / Xbox 360 Controller button/stick mapping
« on: August 30, 2013, 08:42:01 pm »
Does anyone happen to have a list of which buttons and sticks on the 360 controller correspond to which buttons/axes in SFML?

3
General / Stack corruption bug with sf::Shape
« on: November 18, 2012, 10:30:45 pm »
I posted this in General since it might be a VS2012 bug.

Basically, in any function that looks like this:

void func()
{
   sf::RectangleShape foo; //can be any kind of shape
}

The code will crash upon exiting the func() function, because foo creates a stack corruption. This is with Visual Studio 2012, standard compiler, SFML2 RC (downloaded like a week ago).

It should be noted that the same happens when I used a dynamically allocated shape that I delete at the end of the function. But instead of a stack corruption, it will be a heap corruption, of course.

Any idea what could be the cause of this?

When debugging, it seems like the shape isn't initialized correctly. The vectors inside the attributes of sf::Shape have weird sizes (e.g. 6 and 12) and the values of their elements seem like "undefined behavior' kind of values.

4
Graphics / Changing the BlendEquation
« on: April 12, 2012, 11:10:20 am »
If I want to draw something drawable onto the screen/a RenderTexture and want to temporarily set the blending equation of OpenGL to something different, how would I go about doing it in SFML2?

5
Graphics / sf::Image needs huge amounts of memory. Why?
« on: August 17, 2011, 07:53:27 pm »
The following code:

Code: [Select]

#include <sfml/graphics.hpp>
#include <iostream>
int main()
{
   sf::Image i;
   int a;
   std::cin>>a;
   return 0;
}



Lets my application jump from 600 kilobyte memory usage to 13 megabytes (13,000 kb) after the line "sf::Image i". Adding a second image let's it jump only marginally (a few bytes).

Why is that? Is there a memory leak in there somewhere (maybe one of the sub libs you're using to do the loading?)?

I'm running in Release mode, with release libs of sfml. I'm using MSVC2010 and have compiler optimizations on (/O2).

Hardware: Intel i5 2500k, Radeon HD 6870, 4GB (don't remember exact type) Ram.

By the way, I still use sf::Image because I haven;t update to the latest revision yet (I assume it's unnecessary work because all it does is change a couple of names in my code - unless of course sf::Texture has some sick performance improvements which I doubt). [/code]

6
Graphics / Maximum amount of RenderImages?
« on: July 17, 2011, 01:25:10 pm »
Is there a maximum amount of RenderImages that a graphics card can support? I'm currently programming mostly on my laptop, which only has an integrated graphics chip, and I'm running into seemingly unrelated problems of flickering screens when working with RenderImages.

And what happens when I create more than the maximum amount? Will different RenderImages start to target the same data?

7
Graphics / Shader not working on "newer" machines
« on: June 26, 2011, 09:37:57 pm »
Hey, I have this shader in my program:

Code: [Select]


uniform sampler2D texture;
uniform vec2 target_size;
uniform float scale;

vec4 bloom(vec4 original)
{
   return original*scale;
}

void main()
{
   vec4 color = texture2D(texture,gl_TexCoord[0].xy);
   vec2 step = scale/target_size;
   //right and left
   color *= texture2D(texture,gl_TexCoord[0].xy + vec2(step.x,0.0));
   color *= texture2D(texture,gl_TexCoord[0].xy + vec2(-step.x,0.0));
   //up and down
   color *= texture2D(texture,gl_TexCoord[0].xy + vec2(0.0,step.y));
   color *= texture2D(texture,gl_TexCoord[0].xy + vec2(0.0,-step.y));
   gl_FragColor = bloom(color);
}


It's a simple blur+bloom shader (I think it's gaussian blur, although I'm not sure about the terminology), which blurs the image according to a factor (bigger factor = bigger blur) and blooms it, also depending on the factor.

This shader runs on my really crappy old laptop, with Intel Integrated Graphics set (which uses software 2D rendering), but not on the PCs of two other people who tested the application. Both have ATI graphics cards (one of them has got a HD 5770, the other one a pretty new mobile graphics card).

A more simple shader, like this:

Code: [Select]

void main()
{
     gl_FragColor = vec4(0.0,1.0,0.0,1.0);
}


however, works perfectly fine with them and simply draws a green rectangle to every sprite that it is applied to.

What could this be? Could it be that "newer" graphics cards( HD 5770 isn't exactly new though, afaik OpenGL 3.0 ? ) don't support gl_TexCoord etc. anymore?

8
Graphics / Quick question regarding copying of sprites.
« on: February 16, 2011, 11:05:02 pm »
When I copy a sprite

( spritea  = spriteb or my_sprite = new sf::Sprite(someothersprite))

does it create a hardcopy of the image or does it just copy pointers to the copied image.

9
When I compile a project that uses SFML on a 64 bit system (obviously using libs and dll's that were compiled on the 64 bit system too), can I distribute the program together with the 64 bit dll's and it will run on 32 bit system? Or do I have to distribute it together with the 32 bit dlls? Or do I have to compile the entire project on a 32 bit system and distribute 2 different versions of the program?

10
Graphics / Program crashes upon exiting int main(); [sfml 2]
« on: November 25, 2010, 03:27:27 pm »
When I try to debug it, Visual Studio shows "no source", but says the call stack location is  "atioglxx.dll" so I'm assuming it has something to do with graphics.

What could this be? I've checked the code again and again. I'm deleting all pointers probably, I'm closing all streams and windows probably.  

I have two configurations for both debug and release, both with the respective sfml2 libraries.

I remember that this problem randomly occured for me with sfml 1.x too, but here it just happens every time.

Could this be an ATI-driver related issue? I've updated it just a few weeks ago when I installed fallout new vegas.

edit: oh and I should probably say: This happens exactly when I'm exiting int main();

before the return 0; I can set a breakpoint just fine and it doesn't crash before that. the window also closes etc.

11
Graphics / Shaders: Accessing pixels around _in
« on: March 14, 2010, 05:33:04 am »
Hi.

I've got an 2-dimensional (float) array that I need to pass on to my shader.

More specifically: The 2D-Array is a heightmap that I need for calculations inside the shader. Each point (x,y) contains the height of that location.

I know that 2D-Arrays are only supported by geometry shaders, so how would I do that? I guess the best way would be to create a heightmap-texture using my heightmap-array, but how can I do that using sf::Image?

12
Window / [COMPLICATED:] Dynamic Input Manager
« on: June 28, 2009, 12:32:16 am »
Hi.

I'm writing a class that enables me to let the user decide what buttons he wants to press to access a certain function (basically something that enables the user to configure his keymapping for my games himself).

For obvious reasons, I need to save the configuration to and read it from a file (in my case i'm using xml files + tinyxml).

anyways, the keymapping in my class is saved like this:

Code: [Select]

std::vector<std::pair<std::string,sf::Key::Code>> m_actionlist;


a vector that is full of all the "action" configurations that are read from the config file. for example: one element of that vector could have the name "move player up" as the first member of that pair and sf::Key::Up as the second member (or whatever i write in that config file).

the problem now is, that there is no such thing as pure "numbers" in c++; when I read the corresponding for some action from the config file (for example, sf::Key::Up is something like 297 i think), I can  only read ints or doubles from the file.

now, I don't know how to dynamically assign these "numbers" to my vectors pair second member. something like this will obviously not compile

Code: [Select]

m_actionlist[current_iteration].second = myxmlfile.GetValue("Up")


because the returned value will be double, or int if I static_cast<int> it and the compiler can't convert int or double to sf::Key::Code.

Now, what am I supposed to do now, to avoid having to do something like this for any Code that is in sf::Key::Code and sf::Joy

Code: [Select]

if(myxmlfile.GetValue() == 297)
     m_actionlist[whatever].second = sf::Key::Up
else if(myxmlfile.GetValue() == 298)
     m_actionlist[whatever].second = sf::Key::Right
//And so on


I'm kinda lost here.

By the way to make it easier for anyone that seriously wants to help me (laurent maybe?) i'm posting the current state of the class on pastebin.net: [i'm adding descriptions of my XMLFile and XMLElement classes to the bottom of the paste, to make it easier for you]

http://pastebin.com/m6d494ef3

i'd really appreciate your help.

greetings,
travis

edit: A typical config file would look like this:
Code: [Select]

<action ID=297>Up</action>


This will assign the sf::Key::Up key to the name "Up".

13
Graphics / sf::Sprite::SetSubRect has no effect
« on: June 23, 2009, 02:21:01 am »
following code still displays the whole sprite:

Code: [Select]

spr.SetSubRect(sf::IntRect(0,0,80,80);
window->Draw(spr);


why?

14
Graphics / window::SetBackgroundColor -> where is it?
« on: June 23, 2009, 01:13:12 am »
in 1.3 its in, why is it gone, how can i change the "flushing" color of the window now?

15
General / SFML Input not working when PS3 controller plugged in.
« on: June 23, 2009, 01:06:35 am »
I didn't put this in the "sfml input" section, as it didn't seem to be a problem with sfml, but a problem with the ps3 controller.

When trying out the gamepad support of SFML today, I noticed something very weird.

As soon as I connected the PS3 Controller to my PC (using a standard USB to mini USB adapter, so no blue tooth), the sfml input system seemed to stop working.

I'm polling GetEvent() of the sf::Window i'm using within the "game-loop" of my gamestate management class:

the relevant code looks like this:

Code: [Select]

void Game::Run()
{
sf::Event e;
while(m_running)
{
while(Application::inst().GetWindow()->GetEvent(e))
{
m_current_gamestate->Input(e);
}
m_current_gamestate->Update();
m_current_gamestate->Render();
}

m_gamestates.clear();
Application::inst().GetWindow()->Close();
}


so it seems that the ps3 controller seems to be sending random events to windows, which results in my game loop getting "stuck" in the polling, as Application::inst().GetWindow()->GetEvent(e) constantly returns true.

furthermore, those random events from the ps3 seem to be blocking my standard keyboard input, as the application will no longer react to inputs from my keyboard while the ps3 controller is plugged in (this only counts for sfml-using applications, in other games its no problem using both at the same time).

does anyone know where the problem is here?

Pages: [1] 2
anything