开发者

iPhone - Using OpenGL to create apps - What is a good wrapper or low-level engine to use?

I'm working on a couple apps which require the use of OpenGLes 2.0. I made a prototype of one starting from a simple sample project. However, I wasn't very happy with the clutter that all of the OpenGL code caused. I think that all the clutter would cause issues if I kept extending the code.

So- Is there a good solution to workin开发者_JS百科g with OpenGL on a slightly higher level? I don't really need all the complexity and overhead of a game engine. I just am slightly frustrated I can't deal with OpenGL like this:

ShaderProgram shader(fragmentCode, vertexCode);

RenderBuffer renderBuffer(xResolution, yResolution);


You'll have to pardon the shameless self-promotion, but I've been working on just such a framework due to the exact frustrations you've been having. I grew so tired of the nonsense of having to properly initialize resources and then clean them up. Here is a sample from my XPG framework.

XPG::Texture2D tex("texture.jpg"); // automatically cleaned up
tex.bind(); // ready for use

I have built similar objects for things like vertex buffer objects (VBO). I am still working on it, but the OpenGL tools will certainly benefit you greatly. I have yet to see another framework make things this simple. If anyone knows of one, I would love to hear about it. The one I've been working on even works in Android. It should work in iOS, but I haven't tested it there yet. It does work on OSX though. :)

To see a high level demonstration, see the test module source code: interface and implementation.


I don't think the position somewhere between raw OpenGL and a complete engine would be effective. Suppose you have the ability to manage OpenGL objects like shaders, buffers, textures and others.

  1. You will still need a loading logic to get the input data from somewhere. Engine has it.
  2. You'll need tools to compose shaders in and test the scenes. Engine should have it.
  3. You'll face hidden errors about incompatible vertex attributes - shaders - uniform parameters. Engine has to check the consistency and link those instances smoothly for you.

Hence my conclusion is: once you've decided to move forward from the raw GL, you'll eventually end up in an engine. Either in a long term if you do it yourself, or in a short term if you take an existent one.

More than that, I think the engine should provide you with an ability to create shader programs and render buffers in the way you want. And I wouldn't expect much overhead from these operations.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜