couple of grapic questions

Started by
8 comments, last by Oni Sephiroth 18 years, 1 month ago
Hi, im fairly new to java programming, and on this forum, a lot of times i have seen many people mention using 3rd party API libraries, such as OpenGL and GLUT for their graphics. Why is this? When does a games graphics get so complex that you need to do this? What do they do that is too hard to do by yourself? Can you write your own graphics engine? Do you need special APIs to make 3d games, and when making the models, do you use a 3D graphics program or do you (somehow) program the whole 3d model? Sorry for the barrage of the questions, but i've been wondering about these for a very long time.
Advertisement
Quote:Why is this?

These APIs (OpenGL/DirectX) allow you to communicate indirectly with the graphics card and render 2D/3D objects to the screen. You can not do this directly, so the API acts as a medium between the application and the graphics hardware.

Quote:When does a games graphics get so complex that you need to do this?

You may/will need to begin using libraries/APIs once you move onto something that isn't included with ANSI C++. Things such as networking (excluding winsocks - we're talking higher level stuff such as Raknet), audio (FMOD), graphics (OpenGL/DirectX) and many more areas. These libraries/APIs make it much simpler to do much more interesting and advanced things.

Quote:What do they do that is too hard to do by yourself?

As stated above, depending on the library/API you use they do different things. There are so many libraries/APIs out there though that you could find one for almost anything! The APIs handle very low-level programming for you and act as a medium between the application and the hardware. For example, OpenGL communicates with the graphics hardware. It does this based on what the programmer/application tells it to do. If you were to program at a very low-level it would be much more difficult - you may even have to code in binary :-O!

Quote:Can you write your own graphics engine?

Of course you can, but in my opinion it's pointless. Direct3D and OpenGL are both excellent APIs and if you're applying for a professional position within the gaming industry then in 99% of cases you will be using APIs such as DirectX and OpenGL.

Quote:Do you need special APIs to make 3d games, and when making the models, do you use a 3D graphics program or do you (somehow) program the whole 3d model?

You don't need the APIs but they help out immensely and it would be foolish to not use them. 3D modelling tools were developed as without them then models would have to be rendered by code which is very tedious if you have over 15,000 polygons per object and over 100 objects per scene.

I hope I've helped and cleared a few things up for you :-). Best of luck with Java!
Thank you very much for the detailed explanation :). I have 3 more questions.

Can't you already use the java API to render 2D images on screen?

And what are some good free and not free 3D modeling programs?

Finally, is it a lot harder to program a 3D game than a 2D game?
Quote:Original post by DeskGlue
Thank you very much for the detailed explanation :). I have 3 more questions.

Can't you already use the java API to render 2D images on screen?

I think java can do this, so yes.

Quote:
And what are some good free and not free 3D modeling programs?

Umm... I've heard of blender... I'm sorry I answered this question so awfully, I really don't know of any good modeling programs.

Quote:
Finally, is it a lot harder to program a 3D game than a 2D game?

IMO (in my opinion) yes. You need to load models, take into account the z axis, do other things... While in 2d there is just the coords (mainly from 0 to width and 0 to hieght) and image loading/blitting. (And ofcourse some other image things you can do.)
3DMAX is sort of the industry standard, but it's quite expensive. Maya is probably used the second-most by big game makers (again, expensive). Some of Morrowind was done in Maya (I think).

Blender is open source (i.e. free and good); it's what I'll be looking into once I'm ready for 3d programming.

Oh yeah, there's GMax too. I think that's what Dungeon Siege 1 was done with. It's free as well.

[Edited by - Schnozzinkobenstein on March 16, 2006 9:39:28 PM]
--------------------Configuration: error maker - Win32 Debug--------------------Compiling...error maker.cppLinking...error maker.exe - 1 error(s), 0 warning(s)
The Java2D API's pretty easy to learn if confusing at first. HERE is a link. Have a browse.
Thanks for all the help, everyone. One final question.

Does OpenGL support many 3D graphic types including those of free programs such as Blender?
Quote:Original post by DeskGlue
Thanks for all the help, everyone. One final question.

Does OpenGL support many 3D graphic types including those of free programs such as Blender?


Opengl doesn't load the models itself... all the the programs save in a specific file format the model you made.

Now YOU have to know how to use that format and implement the loading process, or, if the format is famous (.x is one), there may be already a made loader for it.

So, as long as you know how to load the format Opengl will do anything.

Basicly, the models are just many triangles/quads that when come together appear as a big model... You have to know how to load those triangles/quads from the format you're using and pass them to Opengl... I'm not too familiar with the process as I am just getting started with 3d.
Quote:Original post by Undeadlnsanity
As stated above, depending on the library/API you use they do different things. There are so many libraries/APIs out there though that you could find one for almost anything! The APIs handle very low-level programming for you and act as a medium between the application and the hardware. For example, OpenGL communicates with the graphics hardware. It does this based on what the programmer/application tells it to do. If you were to program at a very low-level it would be much more difficult - you may even have to code in binary :-O!


well not quite, OpenGL and Direct3D are interfaces used to talk to the driver, the driver deals with the hardware, modern operating systems don't generally allow programs to access the hardware directly.
currently OpenGL and D3D are the only APIs that are generally supported by graphics drivers. if we didn't have OpenGL and D3D we would be forced to deal with each graphics card in its own unique way.
in the old pre VESA days there was a few games made that had separate codepaths for different graphics cards ,Dungeons of the unforgiven is one example it supports around 10 or so different graphics chipset and ofcourse VGA.
on newer cards its impossible to use anything better than VGA in that game though.

so basically you have to use either D3D or OpenGL for 3d graphics, or use an engine/library that in turn uses D3D or OpenGL. (you can access hardware directly by writing your own driver though, but doing so is pretty pointless since the hardware manufacturer generally knows more about their hardware than you do) you never have to code anything in binary, asm always works fine, and for drivers you can generally use c or c++ and whatever tools your OS provides for driver creation.
for your 3d modelling program question, 3ds max, maya, blender, and milkshape 3D I hear are all good. Hell, Maya was used to make Advent Children.

This topic is closed to new replies.

Advertisement