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

Pages: [1]
1
Graphics / Optimizing sf::Text
« on: December 31, 2016, 08:41:02 pm »
Hello! I have been poking around with sf::Text recently and discovered that rendering sf::Text objects can be a little slow. Rendering 150 sf::Text object is taking about 200IS from what I can see. The UI I'm planning will end up being a bit text intensive so I am looking at optimizing sf::Text some.

From what I can tell sf::Text uses a sf::VertexArray for rendering normal text and an extra sf::VertexArray for outlined text. What I am thinking of attempting is potentially condensing these sf::VertexArrays into a single one since the sf::Text will not be changing outlined thickness much.

Another possible change I was thinking is making some sort of overlord sf::VertexArray that could be shared between many sf::Text objects. If the geometry does not need to be recalculated much (static text) then this would obviously save a great deal on the drawing.

This is all theoretical right now and I haven't made a real plan yet. Before doing that I wanted to see if anyone here had any thoughts or suggestions on how to go about this. Thanks!

2
General discussions / [PAID] Looking for C++ developer
« on: July 11, 2016, 07:36:40 pm »
Hello! I am looking to hire a C++ developer to work with me on continuing development of Crea (http://store.steampowered.com/app/280520), which is a 2D RPG Sandbox game that just released on Steam. Full details are provided in this Google Document. This includes full pay and some rev share. I am currently only looking to work with someone locally so you must be willing to relocate to Portland, OR.

If you have simple questions then you are free to ask them here but be sure to email me your application.

3
Graphics / Shader crash on some Intel GPUs
« on: January 15, 2016, 09:26:24 pm »
Hello! Several players for my game using intel GPUs are running into a crash inside sf::Shader. I have looked around for similar issues and to see if something like this has been fixed but I have not seen anything. I am using SFML 2.2~ with a few things pulled into it from 2.3. I do check if sf::Shader::isAvailable() and it is on these systems.

Here is what one of the stacktraces looks like:
Code: [Select]
ig7icd33
ig7icd32
ig7icd32
ig7icd32
crea!sf::Shader::bind
crea!sf::RenderTarget::draw
crea!sf::Sprite::draw
crea!sf::RenderTarget::draw

Another one:
Code: [Select]
ig7icd32
ig7icd32
ig7icd32
ig7icd32
crea!sf::Shader::setParameter

Unfortunately I do not have line numbers to go with these. To start with I was just curious if this been seen before or perhaps even fixed. If I can get one of these players to work with me I'll try coming up with a minimal code repro if that would be helpful here. Cheers!

4
Graphics / Completely Resetting GL States
« on: December 30, 2015, 05:33:01 am »
Hello! I am currently working on upgrading my UI library (Coherent GT) and am running into a problem with rendering SFML stuff after calling the UI rendering function. I am passing a SFML created texture to the UI library, it renders to the texture and then I use that texture with a sf::Sprite. At least that is how it should work.

Right now it doesn't render anything after calling the UI paint function; however, I have verified that it correctly rendering to the texture (saved it to file). This has lead me to believe that there is something wrong with the GL state after the paint func. I am calling resetGLStates() after the paint func but it seems to be missing something. One really interesting thing about all of this is that sfml rendering works with the next frame.

The UI documentation is pretty good and they list out which GL states are changing but I'm not sure which ones SFML truly cares about. I was hoping I may get some guidance here. If not that is ok. I appreciate the help regardless. Thanks!

Coherent GT Rendering Documentation

5
Graphics / Optimizing Rendering
« on: July 16, 2015, 01:27:35 am »
Hello! I was wanting to see if anyone had any idea on how I can go about optimizing my rendering. I've been profiling my code and have found that a great deal of time is spent with GlContext::setActivate(). I am using several RenderTexture that I render to, display() and then pass to a shader. Because of this the program is constantly switching what it's rendering to which, from what I understand, is what calls setActivate().

Some possibilities might be:
  • an amazing optimization that makes switching the context not so expensive (I can dream, right?)
  • Rework my shaders so they don't need this. Although I'm not sure that is possible...
  • I'm being stupid
  • Something else?

One thing I have done so far is to try to minimize the switching by grouping the use of a RenderTexture together.

I can post code here however it is quite spread out. I'm mostly looking for ideas at the moment and/or seeing if I'm just doing something completely wrong. Thanks!

(Oh, and I'm on either SFML 2.1 or 2.2. I can't remember but it is fairly recent. I think from Sept. 2014.)

6
General / SFML 2.3 OSX Dependency Linking Issue
« on: June 12, 2015, 06:50:55 pm »
Hello, hopefully this is a quick one to resolve. I just forked SFML 2.3 and made a few edits (https://github.com/jmcmorris/SFML) and then proceeded to compile without any issues. I was also able to compile my game but once it got to the linking stage it ran into a snag that I just cant seem to resolve.

ld: file not found: /Users/m/Prog/Projects/SFML/build_deps/libogg-1.3.2/build/1.3.2//i386/root/lib/libogg.0.dylib for architecture i386

Here is the full output (minus the plethora of .o files):
make: Circular standalone <- standalone dependency dropped.
c++ -O3 -arch i386 -headerpad_max_install_names -mmacosx-version-min=10.6 -stdlib=libstdc++ externals/frameworks/libboost_system.a externals/frameworks/libboost_filesystem.a externals/frameworks/libboost_python.a externals/frameworks/libboost_regex.a externals/frameworks/libboost_thread.a externals/frameworks/libboost_signals.a externals/frameworks/libRakNetLibStatic.a externals/frameworks/libfreetype.dylib externals/frameworks/liblog4cplus.dylib externals/frameworks/libCoherentUI.dylib externals/frameworks/libsteam_api.dylib -Fexternals/frameworks/ -Fexternals/frameworks/ -framework Python -framework Foundation -framework AppKit -framework IOKit -framework Carbon -framework OpenGL -framework ogg -framework FLAC -framework vorbis -framework vorbisenc -framework vorbisfile -framework OpenAL -framework sfml-audio -framework sfml-graphics -framework sfml-network -framework sfml-system -framework sfml-window -dynamiclib -undefined suppress -flat_namespace <all of the .o files>
ld: file not found: /Users/m/Prog/Projects/SFML/build_deps/libogg-1.3.2/build/1.3.2//i386/root/lib/libogg.0.dylib for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [siege.so] Error 1

Any help is appreciated. Thanks!

7
Graphics / Shader Unavailable when it should be
« on: May 02, 2015, 03:44:04 pm »
Hello, I have a player who is currently running into an issue with Shaders not working at all and am hoping to get some help figuring out why that is.

The information I have collected so:

OS: Mageia 4 x64
"OpenGL version string: 4.4.0 NVIDIA 331.113"
VGA compatible controller: NVIDIA Corporation GF104 [GeForce GTX 460] (rev a1)

He says he has played many games on this system such as Borderlands 2. From what I can tell he should be able to use shaders but he is definitely running into this error.

"Failed to bind or unbind shader: your system doesn't support shaders (you should test Shader::isAvailable() before trying to use the Shader class)"

Am I wrong in thinking that he should be able to use shaders? Any other information I should ask for or something for him to try? Regardless, thanks for reading this and any help.

8
After messing with this for many hours I've managed to track down what is happening. First off, this only seems to be happening on Mac OSX (I'm on 10.9). My windows build seems to be fine. I did not test on linux yet.

Symptom: When using a RenderTexture for multiple clear/draw/display cycles within a single frame it only appears to render the final clear/draw/display but uses this texture in all of the places that the sprite using the RenderTexture.getTexture() was drawn to. This is what it looks like when trees and characters share a RenderTexture and the character is rendered last. https://twitter.com/SiegeGames/status/486307979512123392

Code: I managed to boil this down into a very simple program and reproduced the issue. Even though this should draw a red, green and blue rectangle it will instead draw 3 blue ones. One interesting thing to note that I noticed is that if you do not clear the RenderTexture then you will see were the first drawn rectangle will have the red, green and blue rectangle all overlapping. The second rectangle will only be green and blue and then the final rectangle is just blue.

void drawShape(sf::RenderWindow& window, sf::RenderTexture& texture, sf::Vector2f size, sf::Color color, sf::Vector2f position) {
    texture.clear(sf::Color(0, 0, 0, 0));
    sf::RectangleShape shape(size);
    shape.setFillColor(color);
    texture.draw(shape);
    texture.display();
    sf::Sprite sprite(texture.getTexture());
    sprite.setPosition(position);
    sprite.setTextureRect(sf::IntRect(0, 0, size.x, size.y));
    window.draw(sprite);
}

int main(int argc, char** argv) {
    // create the window
    sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
    sf::RenderTexture texture;
    texture.create(32, 32);

    // run the program as long as the window is open
    while (window.isOpen())
    {
        // check all the window's events that were triggered since the last iteration of the loop
        sf::Event event;
        while (window.pollEvent(event))
        {
            // "close requested" event: we close the window
            if (event.type == sf::Event::Closed)
                window.close();
        }

        // clear the window with black color
        window.clear(sf::Color::Black);

        // draw everything here...
        drawShape(window, texture, sf::Vector2f(16, 16), sf::Color(255, 0, 0), sf::Vector2f(32, 32));
        drawShape(window, texture, sf::Vector2f(12, 24), sf::Color(0, 255, 0), sf::Vector2f(32, 64));
        drawShape(window, texture, sf::Vector2f(24, 12), sf::Color(0, 0, 255), sf::Vector2f(32, 96));

        // end the current frame
        window.display();
    }

    return 0;
}

9
Window / Game crash with fullscreen on intel gpu
« on: June 12, 2014, 09:30:06 pm »
I have several players reporting that the game is crashing when they either switch to fullscreen or windowed fullscreen (Style::None). I have investigated this a decent amount along with a debug stacktrace.

I'm guessing the RenderWindow creation fails but does not log anything. Later when attempting to clear the RenderWindow it crashes in RenderTarget::clear(). I can see in the stacktrace that it is deep in ig4icd32.dll (intel library). Here is a screenshot of the stacktrace and where it is at: http://grab.by/xI7s.

I know intel gpus have had issues in the past with SFML RenderTexture but I couldn't find anything mentioning this. Anyone have any ideas? I can dig into the RenderWindow in the debugger and see the state of things but I'm not sure what to look for and even if anything is useful in this case.

Some more supplemental information:
  • Works fine in windowed mode even at fullscreen resolution
  • Works fine in fullscreen mode when running on another gpu on same computer that has intel gpu
  • The window always starts in window mode and is recreated to be fullscreen when player changes settings.
  • For anyone interested, here is the original issue thread.
Let me know if there is any other information I can provide. Thank you very much for your help!

10
Graphics / Application Crash With RenderWindow Instantiation
« on: September 08, 2013, 07:19:12 pm »
Hello, I am currently trying to debug an issue where instantiating a new sf::RenderWindow() results in a crash.

Quote
The thread tried to read from or write to a virtual address for which it does not have the appropriate access.

I have several hundred testers and only one person is running into this issue. This tester has a ATI mobility radeon HD 5870 graphics card, which has OpenGL 3.1 compatibility. Here is the stacktrace I got with a debug build.

Quote
atioglxx.dll!6903b212()
[Frames below may be incorrect and/or missing, no symbols loaded for atioglxx.dll]
atioglxx.dll!6903a73c()
opengl32.dll!_wglCbGetDdHandle@4()
opengl32.dll!_wglCbGetDdHandle@4()
opengl32.dll!_pgldrvGetPrimaryDriver@4()
opengl32.dll!___DescribePrimaryPixelFormat@16()
opengl32.dll!_wglNumHardwareFormats@20()
opengl32.dll!_wglDescribePixelFormat@16()
opengl32.dll!_wglChoosePixelFormat@8()
gdi32.dll!_ChoosePixelFormat@8()
crea.exe!sf::priv::WglContext::createContext(class sf::priv::WglContext *,unsigned int,struct sf::ContextSettings const &)
crea.exe!sf::priv::WglContext::WglContext(class sf::priv::WglContext *)
crea.exe!sf::priv::GlContext::globalInit(void)
crea.exe!sf::GlResource::GlResource(void)
crea.exe!sf::Window::Window(void)
crea.exe!sf::RenderWindow::RenderWindow(void)
crea.exe!boost::make_shared<sf::RenderWindow>() Line 134
crea.exe!sg::RenderSystem::RenderSystem(const bool createWindow) Line 36
crea.exe!boost::make_shared<sg::RenderSystem,bool>(bool && a1) Line 214
crea.exe!sg::GameManager::initialize() Line 109
crea.exe!main(int argc, char * * argv) Line 101
crea.exe!_WinMain@16()
crea.exe!__tmainCRTStartup() Line 547
kernel32.dll!@BaseThreadInitThunk@12()
ntdll.dll!___RtlUserThreadStart@8()
ntdll.dll!__RtlUserThreadStart@8()

Another thing to note is that sfml has not written anything to sf::err().

Any help would be greatly appreciated. I'm uncertain what the next step would be to try to resolve this.

11
Graphics / intel_mipmap_tree assertion
« on: September 08, 2013, 01:14:29 am »
Hello, a tester for my game is running into this assertion on linux Mint 15.

Quote
Crea: intel_mipmap_tree.c:835: intel_miptree_attach_map: Assertion `mt->level[level].slice[slice].map == ((void *)0)' failed.

I imagine that since 99% of the graphics code is done through SFML that this is likely happening through SFML. I was wondering/hoping someone here would be able to provide some insight into what is going on and some suggestions on what I can try.

The tester said he has this graphics driver.
Quote
00:02.0 VGA compatible controller: Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller (rev 03)

Thank you for any help!

12
Graphics / Lighting with Layers
« on: December 22, 2012, 04:45:59 am »
Recently I began to implement a day and night system into my game and realized that the way I am doing my lighting will not work with the night time.

My current method is that I have many layers that drawn in order of their priority such as backgrounds, tile layers, entity layers, and top most is the GUI. My lighting layer is just under the GUI.

For the lighting I use a RenderTexture at first. I start by covering the entire texture with black and then drawing over it with the lots of small quads with glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA). The more light that passes through the higher the alpha. Finally, I render this lighting texture onto the RenderWindow and continue rendering I use glBlendFunc(GL_DST_COLOR, GL_ZERO) for this.

This is what it looks like during the day.

and this is what it looks like at night.


As you can see, the night time lighting is off. This is because the background is being affected by the light and consequently removes the depth. What is desired is for it to look like this with the background unaffected by the light. (This is a mockup.)


I am trying to come up with a way to do this and I was hoping for some guidance. My current thought is that I draw all of my closer layers to a texture, the layers I want to be affected by the lighting. Then I apply the lighting. After that I would then draw the background layers onto the RenderWindow and then this layer texture. I think this is the correct approach but I know I need to do something special with the blending and that is where I get stuck. Any suggestions?

I'd be happy to provide any source code needed. I am also open to other solutions - this is just the one I thought of that could work. Thanks in advance for the help!

13
Graphics / Sprite Artifacts
« on: December 04, 2012, 07:28:15 pm »
Hello, I am running into some odd graphical issue with rendering sprites. I am willing to make a minimal code to reproduce but before I do I was curious if anyone knows of a solution for this issue offhand.

The issue itself looks like the image is having its left or right side moved to the opposite side. Here is one example with the shield's left side being moved to the right side. The right image is the original shield.


For those familiar with Moonman (using SFML as well), you can reproduce this issue in it as well. Eigen (of Pioneers) noted it in a reply to the Moonman devlog. Eigen says that he fixed this issue by padding all of his images with empty pixels. This makes sense but it is really just a work around. One I'm not too fond of this since it would require changing 100+ images.

Does anyone know what the problem is here? I appreciate the help and let me know if a minimal code to repro is needed.

14
Graphics / Problem rendering tiles (tearing?)
« on: January 03, 2012, 01:20:54 am »
Hello, I was hoping someone could help me out with a problem.

I have a map made up of a tile grid. Rendering consists of using a single sprite and drawing it once for each tile. The sprite's position is changed for every tile and its subrect is adjusted according to the tile. Here is a code snippet of it.

Code: [Select]
for (Int16 y = startY; y < startY + height; ++y) {
    for (Int16 x = startX; x < startX + width; ++x) {
        Int16 tileId = tiles[y][x];

        //Continue to the next tile since this one is empty
        if (tileId == 0) {
            continue;
        }
        m_sprite->SetPosition(x * m_tilemapData->tileWidth + m_offset.x, y * m_tilemapData->tileHeight + m_offset.y);

        //Update the sub-rectangle of the sprite if this is a different tile from the previous one
        if (tileId != previousTileId) {
            Vector2i position = m_tilemapData->getTilePosition(tileId);
            tileRect.Left = position.x;
            tileRect.Top = position.y;
            m_sprite->SetSubRect(tileRect);
            previousTileId = tileId;
        }

        //Draw the tile!
        renderTarget->Draw(*m_sprite.get());
    }
}


The problem is that occasionally all of the tiles will tear? at the bottom or right side (never both). This only happens when I'm moving the views around.

I have SetFramerate to 60 and have texture::SetSmooth(false) for the tilemap texture. I tried using vsync instead of SetFramerate but the problem persisted. I managed to get a screenshot of the problem and along with it is how the tiles are suppose to look.


Good Tiles


Bad Tiles


I'm going to start working on a small code sample that can reproduce the problem. In the meantime, let me know if you have any ideas and thanks in advance!

Pages: [1]
anything