Where can I get example opengl composite objects? - c

I am trying to build my understanding of OpenGL and see how the 'pros' do things. I am looking for examples of these objects (preferably in C) - I've learned through examples so I think it would help others to see it as well :)
I'm very much a nubie at openGL so this may be a stupid question - I'm just looking for objects I can mess around with to get more familiar with openGL. I have found that it's easier for me to pick things up by tweaking an example until it breaks, then fix it :)
#Nicol Bolas - When I say composite objects I mean objects that when linked together create something 'larger.' An example would be a car. It has a body and tires. Maybe I'm not using the correct term here?

You might be interested in this list of OpenGL based games and applications, particularly the Open Source games.
Also, Ogre 3D is a well-known Open Source graphics engine with an OpenGL renderer.

Related

2D game development basics

I would like to write some simple Mario-like game from scratch using language C. But honestly I have no idea how to do so, and I canĀ“t find any good tutorial for this, which is for free.
But to the actuall question, I have only written WinAPI programs so far, so all event handling and user input was handled by OS, with minimum work, But to develope game, with for example menus with non-rectangular buttons, animations, and so, I guess, there is no such thing in WinAPI taht could help me with this more than just some basic routines mouse pointer location and keypresses.
So, is the right way to write your game to write entire draw part of game engine by manipulating objects for player, enemies, and even background yourself, and than just use directdraw for output to screen?
EDIT:
I actually want to learn how to write games from scratch, becouse it must be great programming experience, and if you consider games like Commander Keen on DOS, created with no framework or libraries, but still so great.
A good approach to this would be to have a look at the SDL library. I'm not saying it's necessarily the best library for 2D games, but it's easy to get started with and the web is flooded with tutorials and open source code samples for simple homebrew 2D games written using SDL.
I do recommand the SDL too, but you should definitely have a look on lazyfoo tutorial, which is just great.
When I started programming I started doing it with Allegro, back in the good old DOS days. It was the first usable library which worked with SVGA libraries, and had a good sprite support. Then version3 came and they added support for windows (using GDI and Directy X, you could choose at runtime which engine to use). The linux port came to life, and all is good.
It's a very basic 2D library, and it will teach you the very basics of graphics and animations. Now it even contains audio support which is a very needed addition (well, I still remember V 2.9X...). They are in betas for version 5, and I think this is an interesting project for you to look into.
http://www.talula.demon.co.uk/allegro/
What are you guys talking about, the WinAPI has low level drawing routines.
Although using an established library like SDL is probably a better idea you could create your own abstractions to the WinAPI drawing routines without too much difficulty.
Then it's just a matter of creating the while loop that has all the drawing instructions and interpreting input. For 2D games this isn't too difficult.
I also used SDL, but try to look at HGE. It requires at least DirectX 8.0 so your applications will work only on Windows but on their forum you will find many topics on how to port it to OpenGL. In my opinion HGE will be easier to learn than SDL, because SDL is a low level library and you will have to learn how to handle many things by yourself. HGE is more ready to start just out of the box.
In short, yes - there's nothing in the WinAPI that will help you much. However, there are dozens of game engines that you could build your game on that would take a huge amount of gruntwork out of creating the game itself. A bit of Googling will help you.
(Personal recommendation: although it's technically a 3D engine, something like Unity is an excellent engine that includes tutorials for creating 2D games. Unity isn't C, but it does make your life a lot easier...)
EDIT: I actually want to learn how to write games from scratch, becouse it must be great programming experience, and if you consider games like Commander Keen on DOS, created with no framework or libraries, but still so great.
This is actually not quite right. Commander Keen (and any DOS games) do use libraries: the ones provided by DOS, BIOS, etc. Without libraries of one form or another, you wouldn't be able to do anything useful with C. For game programming, you really do want to leave all the low level details to someone else.
I'd recommend Allegro as a beginning game programming library.
Check out this one Game dev starting
They have realy a big resource related to game programming and a lot of beginner stuff. SDL is good, but you should consider about learning basic game techniques before start coding and even before start thinking about the api/libs you use.
Clear out how much "intelligence" you need (Ki), consider about loading/Saving a an early time, ... so much things that you should keep in mind if you want to finish your project.
Do you need a game editor? (Also..work) What about sound/graphics? Writing all this stuff on your own will take a lot of time (if you do not have experience). Creating the content is another big issue which can consume a lot of time, if you make it at all.
Maybe it will help you to have a look on some dev kids, because that will give you the idea how their engine works. Like this one (outdated) Dev kid
I've just started a similar project a few days ago, you can check it out over at GitHub.
It should give you some ideas about how the game is structured. As well as some details on a scrolling 2D map with collision (which turns out to be quite complicated if you want to get it 100% bug free). Oh, and it's using SDL as many here have already suggested.
As for me, this is my first C project. But I'll have to admit that I've done similar stuff in Java and Python before, so this was a good way for me to quickly learn C. And since it's learning and not any productive stuff, I'm using plain C99, which makes the task even "funnier".
But back to the game, you really need to think about your design before you start coding, write it down on a sheet of paper, or if you're like me and you don't have tree stuff in reach write it in pseudocode.
Think about as many possible game states as you can, nothing's worse than having to re-implement the whole player/map/whatever stuff from scratch just because you did not think about feature XYZ before.
Design is very important, if you don't have a goal to begin with, your project will reach a point where it fails, just like my Tuff did, well it also failed due to missing music and somebody who would have designed enemies, etc.
Speaking of graphics and such, bear in mind that the game will consist of much more than just the plain code. If you aren't good in graphics then take that into account while designing. Because you will quickly lose your motivation when the only things on the screen are colored rectangles.
Action Arcade Adventure Set (originally published as a book) is probably one of the most complete tutorials on how to write a 2D side-scrolling game. Although an older reference, many fundamentals for developing a 2D side-scroller have not changed.
Full source code examples and some tools to develop a side-scroller are provided as downloads. There is only one external library used to handle graphics primitives. As this is an older DOS program, you may have to use a DOS emulator like DOSBox or modify the examples for more modern environments.
I suggest you skim chapters 1 to 9 and focus on chapters 10 to 17.

some links for graphics in C

I'm looking for some tutorials which can teach about graphics on C, I tryed find it, but all I can find are discussions about special topics, I'm beginner, thanks in advance
What platform are you trying to work on?
And what are you trying to achieve? "Graphics" can be a lot of things. Are you trying to work on game type stuff? Are we talking 2d or 3d here? Is it image manipulation or just displaying them?
OpenGL and DirectX will let you do pretty much anything you need to do and interface directly to the hardware drivers, but may well be overkill for many things.
SDL
Cairo
If you need something more specific than those then feel free to ask a more specific question.

Is DxScene the "WPF for Delphi"? Anyone used it?

I am playing with DxScene and VxScene:
http://www.ksdev.com/dxscene/index.html
It looks very nice and powerful: 3d accelerated vector graphics, cross plaform, nice effects, many 2d GUI controls (vector based), good scaling, transparency, rotating (x, y, z), 3d models, etc. Even with many effects, the CPU stays very low (0%)!
http://www.ksdev.com/dxscene/snapshot/screen0.jpeg
But can it be seen as a good WPF alternative for Delphi?
And does anyone use it instead of normal Delphi VCL?
Yes, I am using it now in a new project and intend to use it for all future projects.
It's indeed extremely powerful and versatile. It does consume SVG and even XAML, among many other formats, so you could consider it as a Win32 API WPF alternative. Believe me, I've been looking for one for ages, and this is it for me.
Current drawback: lack of documentation. You have to learn it all from the examples and by asking questions in their forum. Not ideal, but it can only get better!
All it needs is more users, and it'll grow into something wonderful.
I'm not sure, but it looks like it's the GUI base for FlStudio
It looks very promising, the effects are very good, in the past years I have seen it's being enhanced constantly. I have check it the second time today (only the compiled demo), it seems that many new controls are added, I like the "expander" expandable panel.
It's very promising, I'm consider using it in the future, I'm not sure if the new version has fix or not, but when the first time I checked the trial version, it lacks of documentation...
Very good effect and promising though!
You might find this article interesting, it explains how to use the DirectWrite and Direct2D features in Delphi 2010, it seems to be rather simple, and is well explained here: Delphi 2010 DirectWrite "Hello World" Example [1].
Screenshot from the article showing the result.
[1] http://blogs.embarcadero.com/pawelglowacki/2009/12/14/38872

TreeView Drawing

Is there a really quick and easy way to draw a TreeView in a GDI Graphics Object (its TreeNode Collection) in a way such as
alt text http://www.tenstep.com.br/br/TenStepPGP/imagens/EAP5.jpg
?
It could be a component do buy or any that is for free.
Thanks
There are be several ways to go about this:
Write it yourself (it's rather easy to do if you know the type of diagrams you're dealing with and customization is not important)
Automate one of the well-known applications which do that (Visio or Omnigraffle come to mind). In fact, when I had to programmatically generate manipulate diagrams like that, I ended up writing .NET code inside Visio.
Look through open-source UML tools to see if there is code you can use. A good list of such tools can be found on Wikipedia. Please pay attention to the license of the code you end up using.

What is the best path for working with 3d graphics?

Right now, I think a combination of C and openGL is what I need to learn, but it seems like there is still more to it that I need. Also, I'm not sure where to start. I know some C, from reading the C Programming Language (K&R).
If you understand the concepts behind 3D computer graphics then OpenGL + C is about all you need. If you need some help with the concepts then I'd suggest the NeHe OpenGL tutorials and a good reference book like The Red Book.
It depends on what you are trying to do:
If games interest you and you just want to develop amateur stuff without all the fuss, XNA + C# is by far the easiest way to start.
If you plan on becoming a professional game developer, your best bet is DirectX + C++.
If you like open source and just want to mess around with general 3D, OpenGL + C/C++ will offer you a nice community of dedicated people.
There are of course a number of engines and library you can use on top of the last two, such as Torque, Geometric Tools, etc.
I suggest you to take a look at .NET possibilities, i.e XNA Framework
I don't think there is more to it. What makes you think so ?
C and OpenGL is enough to begin with.
I've found that using 3D Studio Max and actually making models helped a lot when it came to learning some OpenGL. I could understand all the intricacies with normals and whatnot.
I would really recommend against trying to learn C and OpenGL at the same time. They are both complicated and more so when you mix them.
I would recommend extremely highly getting, reading, and working through some of the examples in the book Computer Graphics: Principles and Practice. Yes, the book is MASSIVELY out of date; it's still the canonical reference for this sort of thing.

Resources