views:

46

answers:

1

I want to add a few drawing functions to an iPhone project for drawing things. Something like drawTile(x,y,len,wid); which would call openGL to draw a box somewhere. I should just be able to write a procedural C file to do this but the openGL libraries are objective C and I'm getting weird errors. Do I have to make a class for all of my drawing commands and call class methods?

A: 

no, you should be able to define your own C functions and call them from Objective-C. Be sure that you are not defining them within @implementation or @interface blocks. Also, do you have your includes / imports set up properly?

darren
the include file is as simple as can be:#import <openGLES/EAGL.h>#import <openGLES/ES1/gl.h>#import <openGLES/ES1/glext.h>void drawTiles(arguments);the function definition is in a .m file that goes like:#import "GLDrawstuff.h"void drawTiles(arguments){ stuff}