Advertisement

Blender3D, General Idea to OpenGL Drawing?

Started by February 06, 2005 03:31 PM
4 comments, last by wendigo23 19 years, 7 months ago
Ok.. Basically i am at a total lack of knowlage, even at the concept level of how using a modeler (such as Blender3D) to make an OpenGL mesh and junk for animation. I'm not looking for anything complicated, first itll just be a square, then a circle, then an eye, ect. And i am aware OpenGL can draw squares, i am looking on getting the concept of using a modeler to eventually use it to make more complicated figures such as an animation of a humanoid, ect. But my question is... what is the concept of this? lol. You should be seeing by now i have no knowlage pertaining to the use of modelers. So, First question: 1.) Am i correct by saying that i would use a modeling program such as Blender3D to make a figure, it would then give me a text output to use somehow, such as cordinates to be used in OpenGLs draw functions? 2.) If you know Blender3D at all, is this a program that will achieve this? It seems to have a lot of independant functions to create animation on its own, lighting, ect. But i am just wanting to use it for the aspect of drawing then converting my stuff to OpenGL, as OGL is what i am trying to learn. 3.) If #1 is correct, can you give me anything pertaining on how to achieve this in Blender3D? Not step by step, but a word of what its called would be nice so i could google it or find it in helpfiles lol. Is this making any sense? Its been a while since i'v been learning ogl (long while) so i forget some of the common syntax lol (glBegin i believe is the drawing one), but i am just trying to get the concept of the process to using a modeling program for advanced opengl animation/coding. And wow.. if your able to help me i'll be amazed, cuz atm i feel helpless lol. I think the superbowl shut down my brain, and the salse smells so good.. wow im hungry. Anyway thanks, again, im just looking for a few simple answers, no need to give complex answers. I just need something to go off of. Because at the moment i dont even know what to look/search for. Happy Super Bowl Sunday!
Rank: OpenGL & Glut "Nub", C++ Freshman.
Blender is good for this. You can export to one of the file formats Blender supports - I believe obj is simple and popular. Another route is to write an exporter, which is how I do it. This way you have complete control over the format of your data file. It's pretty easy to do using Blender's python scripting.
Advertisement
Ok, can you give me an area to look into? Something by which i can figure out what i am doing? The general process ect..?

Like possibly a tutorial to make a simple cube or something in Blender then bring it to my OGL program?

Because i am still clueless as to the process of said blender->ogl.
Rank: OpenGL & Glut "Nub", C++ Freshman.
Check out this thread:

http://www.gamedev.net/community/forums/topic.asp?topic_id=290348&PageSize=25&WhichPage=6

Look for the crash course in model loading. Currently we have implemented a set of model loading classes and an exporter plugin for Milkshape3d, which is similar to blender (all source code included). We are also discussing/implementing a few other useful things like 3d sound, and image loading using OpenIL.

Cheers,
-llvllatrix
Ok, i think i am starting to "grasp" the concept of this all. I made some simplethings in blender and relized the exporting of it is much dif than i thought. And.. i think is more like what i originally thought modeling was going to be like.


Basically you create an image, and the modeling program outputs text in various formats which is all point to point modeling correct?
Various formats could be like Triangles i heard is one, in various grouping ways, ect.

Do i have this correct? Because i exported a project from Blender (simple box, prebuilt monkey, ect..) and it looked overall like a bunch of cords.

So, my question is to someone willing to help me more specifically. Answering anyone of these would help a bunch!

1.) Can someone show me an example of their format they export (through the python scripting, what it looks like and whatnot)? If possible, explain a bit about it and why you format it like that.

2.) An example of the code, or implementation of how you import the data from this format, organization, ect. That obviously ties into #1 and the explanation of why you format it like that.

3.) Lastly, an example of your python code, or implementation of it. And a small explanation of what it does fully.

In short, any answers you give will help, only answer what you wish to (obviously, i cant force you lol). I'm just saying i'll take any answer to anypart of the questions you are willing to give, thanks!

And also, with the code parts, i say "Code or Implenetation" because i dont want someones code if they are not willing to give it out, so if they'd rather explain the processby which they go through it, no prob.

And lastly, thanks to any replies!

Note: At the moment i am focusing on learning OpenGL still, so i am only using Blender to build the models. Just food for thought as i believe you can even bring in lighting and more stuff i dont need atm.
Rank: OpenGL & Glut "Nub", C++ Freshman.
I'm at work, and all my stuff is at home, so this is all off the top of my head...

First, you need to know how to open a text window in Blender. At the bottom left of your 3d window is a little button, click on it and it will expand to icons that represent different window types, choose the one that looks like a text file. Then use the new menu near that button to choose 'new'. Now you can type in here. Press alt-p to run whatever you type as a python script.

Here's some script to get you started looking at things. There is some documentation on Blender's website.

#give us access to the blender apiimport Blender#give us a list of all objects in blenderobjects = Blender.Object.Get()for obj in objects:    type = obj.getType()    if type == "Mesh":        #do something with a mesh        print "I found a mesh!"        #get the actual mesh data        mesh = obj.getData()        #get the matrix        matrix = obj.getMatrix()#you can explore the functions available to you by using dir() and __doc__print dir(Blender)print dir(Blender.Object)print objects[0].getMatrix.__doc__


Hope it helps a bit.

This topic is closed to new replies.

Advertisement