Daniel Nothing ready-to-use, but this page shows you how to draw polygons in general. It should be easy to modify the code so that it draws a line.
mataneil I've created a replacement. I'm an openGL newbie though, is there any way I can submit it for review and release it as an extension? Maybe others will find it useful..
membersheep You can easily do it by yourself as explained in this page: http://wiki.sparrow-framework.org/extensions/creating_an_extension and maybe I could use your extension in my current project 😃 If you're not sure about what you've done you can post it here so maybe some opengl expert can check it 🙂 thanks
mataneil Here's the implementation: https://gist.github.com/mataneil/4745f7b707f0659b9fc6 Notice that this is a primary version, I didn't finalize it yet (e.g no dealloc method). If you have any comments I would be happy to hear them. 🙂
Biggerplay Is this finalized? has anyone tested it yet? I need a line drawing class, wondering if this will do the job!
Biggerplay I created JTLine files, copied the code into them and got these errors http://biggerplay.com/images/JTLineErrors.jpg Any ideas?
Shilo Try adding the following lines: #include <OpenGLES/ES2/gl.h> #include <OpenGLES/ES2/glext.h> You will also need to link "OpenGLES.framework" to your project via "Projects > Build Phases > Link Binary With Libraries".
Biggerplay Thanks, I think that fixed that issue, but then it gave me this issue http://biggerplay.com/images/MissingFile.jpg *Edit* Got the above working, and I've not got the line function drawing as well. What was meant though by the author when the said, it's not finalised? I thought ARC took care of all the memory stuff?
Shilo ARC only takes care of Objective-C memory management. It will not take care of C level memory management.
Shilo The class is an Objective-C class, but C can be mixed with Objective-C. JTLine leverages OpenGL ES, which is strictly C. The .mm extension you are refering to, is for C++, which is also not handled by ARC.
Biggerplay *sigh* I only vaguely know the memory/reference counting stuff as I've been using ARC from the start, what do I need to do to that class to make it so it handles it's memory properly?
Shilo Possibly need to delete the buffers, but not sure if its necessary: - (void)dealloc { [self destroyBuffers]; }
mataneil I've created an extension: http://wiki.sparrow-framework.org/extensions/jtline Added the dealloc method, and made some minor changes. Please tell me if you have any issues with it.
Biggerplay Thanks for this, very useful. If I remove it from the stage, does that dealloc everything properly? or do I have to call a method or something to completely remove it?
Shilo He added the dealloc method, which will destroy the buffers (again, not sure if that's necessary). So releasing all references to the JTLine will dealloc it and call that method. You can always call NSLog() inside the dealloc method to make sure it is getting properly deallocated. No explicit deallocing is necessary.