Hot answers tagged

37

It's not just about speed of execution, but also about simplicity. Although the software rendering used in this example would be a lot slower than using hardware acceleration (i.e. a GPU), drawing a few bitmaps on screen is such a trivial task that you would not notice the performance drop. However, low-level activity like triangle rasterisation, depth sort ...


24

My question is: why even bother using something like open gl, sfml, sdl when all you have to do is simply allocate some buffer, pass a bitmap and draw it to the screen? Short: Because its fast (OpenGL, DirectX). Long: You may think you can do this all yourself. Draw pixels to a screen. You might write a small library to draw shapes, like quads or ...


11

What he does is called software rendering, what OpenGL does is called GPU rendering What's the difference between them? Speed and memory. Rasterization (filling out triangles on screen) takes some time. If you do it on the CPU, you essentially take that time away from game logic, especially if it's not optimized well. And doesn't matter, how small the ...


6

While the answers from others are more correct than any answer I could give, I want to point out the fundamental misunderstanding about how software development works that I think underlies your question. While it's always possible to do things "by yourself" without a framework, and there's often great educational benefit from doing so, the reality is that's ...


3

Engines do much more that just draw a picture to the screen. They handle lighting, shadows, input , collision detection. Even just the rendering part is way more complex than just pushing a buffer onto the screen. For 3d scenes especially you need to do a lot of calculations on far more complex data than a bitmap. Let me give you a analogy with a car: What ...


2

Unity can be used for your simple text based game, which you should not have any difficulty making with its new UI features. Though the people who have mentioned that the a feature rich engine such as unity is not required to make a simple game like that. I would say that there is no harm in using it. It also makes deployment to platforms relatively easier ...


2

You can do something like this. It looks monumentally stupid (Unity has an awesome editor, why not use it?), but just in case you do have a good reason: You can't create scenes programmatically, but you can have an empty scene and add whatever you need programmatically. Using prefabs is probably not the best idea: prefabs are usually loaded only when ...


2

What user1118321 says is true -- all the textures need to be the same size. But that doesn't mean you need to USE all the space. For a small set of standalone textures, it's not a big deal to waste some space. You can simply store the U/V coordinates of where a smaller texture ends and use that. When creating the array, just set a max size and make ...


2

Since you're referring to s 2D sprite based game, I would use sprite segments to create the tentacle. Each section inherits the rotation angle from the parent and adds a bit of angle of it's own. Each section n is calculated as section[n].position.X=section[n-1].position.X+cos(section[n-1].angle)*sectionlength; ...


2

The above answers are excellent, but none really goes over the most important reason as to why OpenGL and such are preferred. The main reason is to make use of dedicated hardware designed especially to work with things like rendering millions of pixels on a screen, the GPU. With software rendering, using the CPU, the renderer will be looping, one by one, ...


1

I need somehow to delay an initialization of other level's entities Why not add an init() and a terminate() methods to your Level class that does just that? init() populates your level when you're ready to play it, and terminate() cleans everything up when you're done with it. You might want to consider changing your architecture to have Level created ...


1

I'm not sure what you mean by "so I only make one glBindTexture call throughout a scene." What advantage does that get you? 2D texture arrays require the textures to be the same size. I don't know of any way around that. One other option you have is to use a texture atlas. You can make a single texture that contains all of your assets and simply pass the ...



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