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 - Evan Bowman

Pages: [1] 2 3 ... 5
1
General / Re: Executable bundled into mac app package crashes
« on: March 01, 2017, 05:57:32 pm »
It is intentionally not portable because it cannot be. (Well, the definition is not portable but the declaration is.)

Sorry to revive an old thread, but I just realized that there is a pure C++ solution for this, although it's hacky and still non-portable:


#ifdef APPLE
// -framework Cocoa
#include <CoreFoundation/CoreFoundation.h>
#include <objc/objc.h>
#include <objc/objc-runtime.h>

std::string ResourcePath() {
    id pool = reinterpret_cast<id>(objc_getClass("NSAutoreleasePool"));
    std::string rpath;
    if (!pool) {
        return rpath;
    }
    pool = objc_msgSend(pool, sel_registerName("alloc"));
    if (!pool) {
        return rpath;
    }
    pool = objc_msgSend(pool, sel_registerName("init"));
    id bundle =
        objc_msgSend(reinterpret_cast<id>(objc_getClass("NSBundle")),
                     sel_registerName("mainBundle"));
    if (bundle) {
        id path = objc_msgSend(bundle, sel_registerName("resourcePath"));
        rpath =
            reinterpret_cast<const char *>(objc_msgSend(path, sel_registerName("UTF8String"))) +
            std::string("/");
    }
    objc_msgSend(pool, sel_registerName("drain"));
    return rpath;
}
#elseif WIN32
// ...
#endif
 

 It simplifies things for me anyway though, because I don't have to link with the objective c runtime or conditionally add source files to the executable target in my CMake script depending on platform (just link the Cocoa framework).

2
SFML projects / Re: FLIGHT
« on: February 13, 2017, 04:54:48 am »

3
SFML projects / Re: FLIGHT
« on: February 12, 2017, 06:03:09 am »
It looks very nice!

Here's an idea:

Thanks! I don't know exactly what it's going to be yet so I'm open to ideas :)

Was able to compile it. Great code. Did you read any SFML books for this ? Its all very well structured code and good for anyone to learn from it...   

I didn't read any books on SFML specifically, mostly just the documentation on the SFML homepage. Glad you appreciate the organization of the code, because I try my best to keep my work clean and readable (although it's isn't by any means a software engineering masterpiece :))).

4
SFML projects / Re: FLIGHT
« on: February 08, 2017, 02:50:53 pm »
I was going through the code and found that the eye vector is 3X3.. but getting a vec4. It errors during compiling. I changed to Vec 4 but then it errors out at ---   m_terrainManager.UpdateChunkLOD(eyePos, m_camera.GetViewDir());


glm::vec3 eyePos = invView * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);

Interesting, I don't get this error, could we be using different versions of glm? I installed glm just last week so we could have different versions. If you change the eye position vector to a vec4 that should fail to compile because TerrainManager::UpdateChunkLOD() expects a const reference to a vec3 as the first parameter.

What if you made this change:
glm::vec3 eyePos = glm::vec3(invView * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f));

By the way, what compiler are you using? Right now I only have the cmake script configured for macOS so that's another problem you may run into. I mean the linker flags will not be set of you're on a different platform.

Also libnoise in the deps folder will need to be built too because my code will try to statically link with it after you succeed in compiling all the sources.

As a sidenote, if you start up the game and get a blank blue/white screen, just give it a second, it's loading but there's no screen to tell you that yet.

I just started the project so I haven't worked a lot of this stuff out yet, especially the build steps.

5
SFML projects / Re: FLIGHT
« on: February 08, 2017, 02:02:08 am »
This looks quite neat! :)

Thanks!

What will be the general goal of the game?

I'm not completely sure yet, but I think maybe an action game where where swarms of enemies appear and you survive as long as you can. One thing that I am sure of is that I want it to have a multiplayer mode. It's all very conceptual right now :)


6
SFML projects / Re: FLIGHT
« on: February 07, 2017, 08:29:44 pm »

7
SFML projects / FLIGHT
« on: February 06, 2017, 09:40:37 pm »
About a week ago I started a project that uses SFML, it's in its early stages but it going to involve flying planes.

I'm using SFML window, audio, network, and also the graphics module for text rendering. Most of the visuals are OpenGL. The terrain is procedurally generated with ridged fractal noise.

Video:
http://www.youtube.com/watch?v=-DnYnjPSRlw

Code:
https://github.com/evanbowman/planes

8
Window / Re: Framebuffer crash
« on: February 03, 2017, 03:19:54 pm »
Running 10.11.6 here, all security patches installed (which is the way to get drivers updates), and a recent master version of SFML, but no kernel panic nor crash with the initial code posted.

I appreciate you taking the time to look into this. This seems like it may be some localized problem that I'm having, I'll try doing that security patch. It's reassuring to hear that the sample code I posted is working for you, because I had looked over it so many times and it was driving me crazy that I couldn't find a problem with it. Thanks for your help, both of you!

9
Window / Re: Framebuffer crash
« on: February 03, 2017, 07:29:48 am »
Ok so this is bizarre, but I've found that adding these lines:

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_window.display();
 

at least once (e.g. in the constructor for my application), before attempting to render to an offscreen gl framebuffer object prevents the kernel panics. This is weird behavior to me, could it be a bug with SFML?

Also I just realized that if I'm going to do this, I also need to run one pass through the SFML Event loop first or I could get segfaults.

10
Window / Re: Framebuffer crash
« on: February 03, 2017, 06:52:36 am »
Ok so this is bizarre, but I've found that adding these lines:

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_window.display();
 

at least once (e.g. in the constructor for my application), before attempting to render to an offscreen gl framebuffer object prevents the kernel panics. This is weird behavior to me, could it be a bug with SFML?

11
Window / Re: Framebuffer crash
« on: February 03, 2017, 03:57:18 am »
Maybe it's related to this issue? What's your SFML version?

I use the latest stable release, and the latest version of macOS. I can create and draw to render textures just fine, but maybe it's related. After doing some digging in the filesystem I've found my kernel panic report and power usage info. The top of the call stack lists my graphics driver as a dependency, but I'm not sure whether that points to an issue with the driver itself or a problem with how my executable is using the driver. I'm going to try reinstalling it.

EDIT:
The graphics driver is only packaged with the operating system so I can't easily replace it. I'm going to run an update and see if it helps.

(click to show/hide)

12
Window / Re: Framebuffer crash
« on: February 03, 2017, 02:47:21 am »
So how does "my OS dies" look like? Does macOS have graphics drivers that need to be installed?

I mean I get the dreaded multilingual kernel panic screen  :-\. In macOS drivers are supposed to be pre-installed, but that's a thing to check.

I have no problem using most OpenGL functionality in an SFML window, it's only when I render to an offscreen framebuffer and then switch back that I get this problem.

One thing that I am thinking of trying is to write up an analogous program in glfw/sdl and see if that crashes, it would help determine whether or not this is an SFML issue. I just wanted to see if anyone had any other ideas before I went to the trouble of doing that.

13
Window / Framebuffer crash
« on: February 02, 2017, 04:46:22 pm »
Hi,

I started doing a project that uses OpenGL for graphics, and the SFML Window module to create a gl context for rendering.

I got to a point in the project where I want to do some shadow mapping, which generally involves encoding fragment depth info in a framebuffer object, and then using that data for occlusion.

I'm having an issue though where when I bind a framebuffer for depth rendering and then switch back to the default framebuffer and call glClear(...), macOS goes into a kernel panic.

I've included a minimal example below that reproduces the problem, it's about 60 lines of code, and when compiled and run in isolation my OS dies.  I've annotated the line where the crash happens, somewhere within the call to the glClear library function. Most of what I'm doing feels pretty harmless, so I'm not sure whether I've made a huge mistake somewhere or if this is some SFML bug.

Code:
(click to show/hide)

14
General / Re: Building SFML project in Windows with CMake
« on: November 12, 2016, 09:45:42 pm »
Thanks for both of your responses!

I'm still getting used to working without a centralized lib folder, I guess I've been spoiled by apt/rpm/homebrew :)

15
General / Building SFML project in Windows with CMake
« on: November 08, 2016, 10:09:07 pm »
I have a project that uses CMake, builds fine in macOS and Linux, but I'm having trouble getting it set up in windows (minGW)
The error  I'm getting is this:
Code: [Select]
CMake Error at cmake_modules/FindSFML.cmake:355 (message):
  SFML found but some of its dependencies are missing ( FreeType libjpeg
  OpenAL Ogg Vorbis VorbisFile VorbisEnc FLAC)
Call Stack (most recent call first):
  CMakeLists.txt:35 (find_package)

But I can see the dependencies alongside the sfml static libs:
Code: [Select]
$ ls /c/Program\ Files\ \(x86\)/SFML/lib/
libFLAC.a      libsfml-audio.a      libsfml-graphics-d.a    libsfml-network.a      libsfml-system-d.a    libsfml-window-s.a
libfreetype.a  libsfml-audio-d.a    libsfml-graphics-s.a    libsfml-network-d.a    libsfml-system-s.a    libsfml-window-s-d.a
libjpeg.a      libsfml-audio-s.a    libsfml-graphics-s-d.a  libsfml-network-s.a    libsfml-system-s-d.a  libvorbis.a
libogg.a       libsfml-audio-s-d.a  libsfml-main.a          libsfml-network-s-d.a  libsfml-window.a      libvorbisenc.a
libopenal32.a  libsfml-graphics.a   libsfml-main-d.a        libsfml-system.a       libsfml-window-d.a    libvorbisfile.a

From reading other forum posts, it looks like SFML needs to be linked statically in Windows, I am doing that:
Code: [Select]
set(SFML_STATIC_LIBRARIES ON)
find_package(SFML 2.4 REQUIRED graphics window network audio system)

For reference, here's the complete CMakeLists file that I'm using: https://github.com/evanbowman/blind-jump/blob/development/build/CMakeLists.txt

Pages: [1] 2 3 ... 5