Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Hot answers tagged

15

Direct3D drivers on Windows are ridiculously optimized, sometimes for specific games, and developed by individual hardware vendors. Apple's OpenGL drivers are written and maintained (AFAIK) by Apple, and are intended for "general" OS use, compositing the UI and whatnot. There's no so much optimization for gaming and high-performance throughput. Basically, ...


12

While I won't discount the optimization that Microsoft may have put into Windows and/or DirectX, I strongly believe that most programs perform better on Windows simply because that's what the developers focus on (that's where the money is). They make design decisions with Windows in mind, and then later try to make it work in other OSs (Mac, Linux, etc.). ...


12

As others have mentioned, on OS X (and Linux), OpenGL is the only game in town for hardware-accelerated graphics. So the question really comes down to: why do developers use Direct3D instead of OpenGL on Windows? One possible reason, as suggested in the comments, is that they started out as a Windows-only project and later decided to add OS X / Linux ...


10

One of the most common ways to render into another application's GL or D3D rendering context is to hook the creation of the context or device objects in that application's process. This will let you gain access to the returned context or device pointer. You can then hook the actual rendering invocation methods (for example, Present() in D3D) and inject your ...


10

Sleep calls are an extremely bad way of controlling framerate. Use them to reduce CPU usage for sure, but don't use them to control framerate. usleep(1000 * 15), a 15-millisecond pause (~67 FPS, in theory) No, it's not. First of all, see the documentation for usleep: The actual time slept may be longer, due to system latencies and possible ...


8

A singleton for your main engine class is perfectly normal. It's even quite acceptable to have one singleton for each of your game's major systems, like graphics and input. I personally prefer a single Engine singleton with all systems as members of that object, but really there's very little difference. A singleton can just be a static global object, ...


7

Heres your problem notice I comment out the surface = SDL_Get... it was giving some weird results. Also you forgot to create the OpenGL context. Let me know if you have any other issues. SDLWindow::SDLWindow(int width, int height, double axisLen, const std::string &caption) :m_fov(axisLen) ,m_width(0) ,m_height(0) ,m_fps(0) ,m_idxSnapshot(0) ,m_camPos(...


7

Xcode can indeed be used to create games. You can do anything a Mac/iOS device is capable of by programming in Xcode. I think you should focus on what part of the project you want to focus on. As you state you are a brand new Objective-C programmer (welcome). In my opinion it would be quite a mouth full to try and just into Objective-C programming whilst ...


7

OpenGL Versions OpenGL Versions supported depends on two factors on OS X: OS Version (10.7, 10.6, 10.5 ...) GPUs or drivers But at least, you can use OpenGL 2.1 on every recent mac. Note: OpenGL is the desktop version, and OpenGL ES is the mobile one. Don't use ES on desktop platforms. Ps: if you have a GMA 950 Card (Intel chipset), you should have ...


7

Xbox 360 controllers do not conform to USB HID game controller standards. Even Windows computers require installation of a special, custom driver in order to use them. Mac computers do not ship with support for Xbox 360 controllers (though they do ship with native support for USB HID game controllers). To use one, you'll need to install a driver for it. ...


6

As a fellow Mac user, I'd like to offer an additional factor: the CPU scheduler in OS X is more "fair" than in Windows. This is sort of a complicated computer science topic, so here's a simple way to think of your CPU scheduler: your processor has to juggle many tasks at once (all your open programs, plus background system processes). It can only actually ...


6

If you'd like to learn Objective-C, I suggest you have a look at cocos2d. It's an open-source 2d engine (written in Objective-C) that allows you to write games for iOS or Mac OS using XCode. It's not as easy to create games with as with a package like Unity, but there are lots of tutorials (and even books) for cocos2d to be found. A good place to start ...


5

There are a few options available to you: Buy a Mac: This is the most full-proof, but probably the most expensive. If you can figure out what exactly you need (eg. Lion vs. Leopard), you can probably save some of the cost by buying something that's not latest-and-greatest, but "good enough" for development. Run a Mac VM: This is usually illegal (depending ...


5

Looking at the art assets in your github I think I know what the problem is. What you need is alpha blending. Save your sprites with an alpha channel (or convert the background to zero alpha when loading the textures). Set up blend function like this: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); That tells OpenGL to blend (mix) the pixel data that'...


5

The main problem with static and global objects in C++ is that they are created before the application's entry point (i.e. main), but their constructors are called in a completely unpredictable order. The same is true for their destructors, at the end of the application. This is clearly a problem because often we will have objects that depend on each other, ...


5

This is a general post about why static classes cause you more trouble than they are worth. And this includes singleton classes which are just a fancy way of doing the same thing that avoids construction order problems. No advice fits all cases, so take it as advice, not as an instruction that it is always better to do it this way. In general code shouldn't ...


5

Absolutely! XCode is the standard programming IDE for the Mac and iOS. So if your goal is making a game for iOS, you will probably be using XCode along with a few other helping technologies of your choice (e.g. OpenGL ES 2.0). But since you mentioned game engines I'd also recommend you to use one, since they'll save you a lot of time and effort: If you are ...


5

It is highly not recommended to make an iPad game without a device. The simulator is decent, but some things cannot be tested properly on it. For example, In App Purchases cannot be tested without a device. And believe me, you want to test those things. You also won't get much of an idea of its performance on the simulator since it may run much faster or ...


4

There are two supported GLSL editors for OS X. The first, known as Shader Builder, comes with the Graphics Tools available from the Apple developer website. The second is the open source Shader Maker. Neither of these tools are strictly for OpenGL ES 2.0, but the best workflow would probably be to get the look you want before you determine how to get the ...


4

For lighting to work, every vertex needs a normal. What seems to be the case right now is that all of your vertices have the same normal, which is why all the faces are getting the same amount of light. To calculate the normal for a triangle, take the cross-product using two of its sides and normalize it. However, this will produce hard edges, which are ...


4

Found it! The FBX Converter can be downloaded from the FBX Plug-Ins, Converter, and QuickTime Viewer Downloads page. One opened there's an "Add FBX Viewer" button which can display FBX contents and animations.


4

Using the latest SFML from github (2.1 should also work but I didn't test with it) you can listen for the sf::Event::JoystickConnected and sf::Event::JoystickDisconnected events as described in the SFML Events Tutorial. I've tested the events and they are both fired on Mac and Windows. A sample program to test this would look like: #include <SFML/...


4

This solution feels a bit hacky, but it works: using System; public static bool IsMac32() { #if (UNITY_STANDALONE_OSX) return IntPtr.Size == 4; #else return false; #endif }


4

While there's no built-in support for NuGet yet, this might change soon since a lot is happening in this regard. With Unity 2018.1, .NET Standard 2.0 finally got supported. This is a huge deal since it makes a lot of libraries accessible to Unity developers. Check out this Unity blog post for some information. Until then, the process is pretty much as you ...


3

According to this, the hardware supports OpenGL 4.0, but the Mac drivers/OSX only support 3.2. That should still get you GLSL 1.50 (you might not be able to get 1.30 or 1.40), but you need to use the core profile, as OSX doesn't support the compatibility profile. I think SDL defaults to the compatibility mode, so you probably need to explicitly request core ...


3

A friend of mine released his game with Xamarin. You just need to create your game in C#, then this software can compile the source to iOS and Android. (And of course, because of the C#, you can also release it on Windows Phone.) Really good stuff.


3

DirectX is written for OS Windows with own optimizations to platform, etc. There aren't any realizations of it for another platforms. OpenGL is an open alternative which started grow when mobile and tables become more powerful to render some hard scenes. Anyway, I'd give you and advise to write everything using OpenGL, but it's only my opinion. It's free, ...


3

Here is Apple's documentation on the subject. Essentially, you can either create an NSOpenGLContext (and in doing so, specify the original context you want to share using initWithFormat:shareContext: or use CGGLCreateContext's share parameter. I don't believe it is possible to share resources after initialization. This will allow you to create a second ...


3

I know this post is old, but I found it when having the same issue. I luckily found this option after: LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.useHDPI = true; Maybe this was not available at the time, but it did solve my problem! Now my textures look super sharp.


3

The exception messages are a bit misleading. In fact, Mono reports the same exception (Invalid Operation) with different messages for a variety of different situations. GetProcesses gets a list of all pids from the system and creates a new Process object for each one, but at this point it doesn't check if they're actually valid. When you call ProcessName ...


Only top voted, non community-wiki answers of a minimum length are eligible