I generated an obj file using blender, now I want to convert the object file to header file. I installed Perl and opj2opengl.pl but I don't know which command line I should use and what are the commands I should write. Some sites are suggesting to write "opj2opengl.pl abc.obj" but this is not working with me. I appreciate your help.
-
I have no experience with that particular program but have you made sure you are executing the code from the correct directory? Try absolute paths to both the .pl program and the .obj file. – Anthony Clark Mar 20 '13 at 13:51
-
ok, I'll try This. However, I don't know yet which command line I should use?! – Ðina YŏŜri Mar 20 '13 at 13:54
-
1I can't tell you because I have no idea which OS you are on, but this doesn't really seem like a programming question? – Anthony Clark Mar 20 '13 at 14:14
-
2It is **obj2opengl.pl**, not opj2opengl.pl. Did you mistype it in your command line as well? – Mar 20 '13 at 15:07
2 Answers
If you are using windows try installing Active Perl and then drop to your console and run: make sure the perl executable is in your path variable in environment settings:
c:\ perl opj2opengl.pl yourobjfile.obj
If you are using perl on a linux box, usually perl comes pre-installed, you may have to upgrade your perl installation first though, most times you dont need to.
On a linux box, say ubuntu.. cd to the directory containing the perl script (opj2opengl.pl) and then run from bash:
user@localhost> perl opj2opengl.pl yourobjfile.obj
yourobjfile => the obj file you exported from your 3D tool e.g photoshop , blender etc
If done correctly you should get the following output from obj2opengl.h script:
Input file: ./yourobjfile.obj Output file: yourobjfile.h object name: yourobjfile center:
scale by: xxxxx
vertices: numvertices Faces: numfaces Texture Coords: numtexcoords Normals : numNormals

- 2,010
- 24
- 31
You should add myFile.obj to the folder where your script(obj2opengl.pl) is. After that you should start terminal in the current window, and type something like that: ./obj2opengl.pl myFile.obj. You can find myFile.h in current folder. This is my case:

- 436
- 4
- 8
-
when i run the command for example (C:\Perl64\bin>obj2opengl.pl logo.obj) its open then obj2opengl.pl file in notepad ? can you please help me regarding this? – Muhammad Imran Jul 24 '19 at 21:54