View Full Version : 4 Quick questions
05-19-2007, 01:20 PM
1) Is it possible to draw textures or polygons instead of a polygon wire? (like texture mapping, but for edges and with other polygons as well)
2) Wich is better for me to learn from C and C++? I also know Pascal quite well. Is it a good option?
3) How much other libraryes could I need to have a game-like layout (keyboard, mouse and joystick input - audio output - OpenGL)
4) Is it possible to use OpenGL with software rendering? (maybe like Mesa3D, but is this directly supported?)
Edit: Subscribing discussion.
Thanks in advance for any help.
05-19-2007, 01:41 PM
1) it's possible to draw a texture. It's possible to draw polygons.
2) There are sites about using Pascal and GL like delphi3d.net
It is a good option.
3) OpenAL, DevIl, libpng, libjpeg, libtiff, and many others exist
4) Yes, it is possible to use Mesa3D as a software renderer. On WIndows, simply drop the opengl32.dll file of mesa into your application folder (where your exe is)
05-19-2007, 01:44 PM
I can only answer your second question:
If object orientation is no problem for you, i would recommend java - i've also learned at first C/C++ and then java, and it was very easy for me
@V-man: do you know how to use mesa with JOGL(Java OpenGL)?
05-19-2007, 02:43 PM
Thanks so much for your answers.
I just would ask a little more specification for 1) and 3) - wich is:
1) Is it possible to draw a texture instead of each line dot? And what about a polygon instead of each dot?
3) I know there are plenty of libraryes, this is the problem so far, indeed. What to choose? I would like to use the less possible libraryes, if possible cross-platform / easily portable as well.
About the second question, what an average user should use?
05-19-2007, 03:23 PM
About the second question, what an average user should use?That really depends on what you want to do. When you want performance (for fast games or simulations), you should use C/C++. It is still the fastest alternative. When choosing between the two, I'd go for C++. Object orientation is the way to go in modern software development.
When you want maximum portability without a lot of porting effort, Java is the way to go. It's possible to write portable programs in other programming languages, but with Java you don't have to do anything to get portability.
When you don't want to learn a new language, Delphi supports OpenGL pretty well (it's basically "Visual Pascal").
I would like to use the less possible libraryes, if possible cross-platform / easily portable as well.That's kind of a contradiction ;)
The less libraries you use, the less portable your program is going to be. Especially open source libraries are often available for a lot of platforms, while when you do the things yourself, you have to port the relevant code yourself.
In theory you don't need any other libraries in addition to OpenGL. You can make your window with the operating system functions, code your own image loading code, write your own XML parser and so on... But that's a lot of unneccesary work, why bother with something others have already done? :p
As for "What to choose?", that again depends on "What do you need?". You'll propably need image loading, for this I'd suggest DevIL. It's portable to many platforms, and it's very easy to use. For window creation and input, you could try SDL, but there are other alternatives, e.g. glut. Have a look at them and choose what you like most.
05-19-2007, 03:51 PM
Let's say I just wish to load "standard" .bmp files.
I'm focusing on audio playback and peripheral input at the moment, so let's also assume I just want to load uncompressed audio data.
Anyway, is just a suggestion as the choice is effectively large.
05-19-2007, 07:33 PM
Originally posted by Archon:
@V-man: do you know how to use mesa with JOGL(Java OpenGL)? If you run your program by executing in the console
then the mesa opengl32.dll should be in the same folder as the exe
I suggest you use C++ as Java has limitations. AT least with C++ you can generate your own exe.
05-20-2007, 03:23 AM
You could also try D as the programming language as it allows to use C libraries, is object oriented, allows everything C does (as far as I know), has a garbage collector and gives you a binary (exe).
There is an official compiler for Windows and Linux (probably mac too) and also a gnu one.
05-22-2007, 08:57 AM
Let me be more specific again.
Let's drop off input, audio and programming language (but keep ready to re-bring them on later).
Well, it's possible to draw textures and polygons, so in order to do what's my purpose of doing, I should be able to get each line's dot (in coordinates) and draw a new texture or polygon at exactly those coordinates. Is this possible? Better asked as: is this possible without manually emulating line draw?
As promised earlyer, let's bring back on our sound and input "issue": let's say I just wish to write a simplicistic engine, wich plays a sound and draws a shape depending on what key I pressed down.
Sounds should be wav or any other uncompressed audio format, while keys should be keyboard keys.
What kind of libraryes should I use, considering I wish at least a minimal abstraction layer (maybe one day I'll port the same simple game on gp2x or so) should I use?
Last, let's bring back on the programming language.
We know OOP could be done in C exactly (or almost) as one could do with C++.
However, C++ is better suited for OOP development, while C is better suited for speed.
Both of them have pro and cons, and I'm not afrayd of learning one but I would dislike a wrong choice wich could put me in the need to learn the other as well.
D is an interesting language, I saw the page. But is not really standard, and since I'm oriented toward small/embedded devices for gaming (NDS, PSP, GBA, gp2x, modile phones and handhelds) I'm trying to figure out what's the best solution letting me the less porting work possible.
Thanks again for your patience and support.
05-22-2007, 09:44 PM
if gp2x is this, http://en.wikipedia.org/wiki/GP2X then you should go to their forum and ask how to program for it. Unless someone here is working with that device as well.
For the PC, there are libs like SDL that handle window creation, input. Other libs like OpenAL can do 3D sound.
"However, C++ is better suited for OOP development, while C is better suited for speed."
I doubt there is a speed advantage. Do you have any benchmarks?
05-22-2007, 11:21 PM
Was just an example, just to put one in. Doesn't mean I really need to port to the gp2x.
C is better suited for speed, I readed in some articles. I don't know from my experience, just read.
What about the questions?
05-23-2007, 04:41 AM
OK, it's your choice what language you want to program in.
"NDS, PSP, GBA, gp2x, modile phones and handhelds"
For mobile phones, there is GL ES which you can read about at khronos.org
It's basically GL 1.5 with the useless stuff removed.
"Well, it's possible to draw textures and polygons, so in order to do what's my purpose of doing, I should be able to get each line's dot (in coordinates) and draw a new texture or polygon at exactly those coordinates. Is this possible? Better asked as: is this possible without manually emulating line draw?"
You can't draw a texture. You can draw textured polygons. You can draw polygons in pixel space. The projection and modelview matrices need to be setup properly.
glOrtho(0.0, windowwidth, 0.0, windowheight, -1.0, 1.0);
glVertex3f(100.0, 100.0, 0.0);
glVertex3f(100.0, 200.0, 0.0);
glEnd();So those are pixel precise coordinates.
05-23-2007, 09:38 AM
Ok, so using this code you get a line from 100, 100 to 100, 200.
Is it possible, to have 11 triangles at Y points: 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 without using some kind of iterative line-drawing emulation?
Let's say, i wish to draw them on the above points without using something like for a = 0; a 10; a++ drawTriangle 100.0, 100.0 + a * 10 ; - assuming draw triangle is already set up .
I'm just asking, where's the need being so fussy?
Perhaps I asked something extremely simple.
Is it possible to have this?
Assuming each '-' is a line dot and each '*' is a polygon, without tracing all the line dots?
Is there any function that does line from, to, whatDoYouWantToDrawInsteadOfDots ; ?
I just feel discouraged...
Omitted parenthesys because of error report during posting.
05-23-2007, 09:58 AM
You'd have to do the computation on your own for that sort of thing, but it's not a huge amount of coding. OpenGL is supposed to be a low-level API - the only functions it exposes are those that can only be done by the graphics driver.
That's a rather interesting way to draw a line, though - may I ask what it's being used for?
05-23-2007, 12:21 PM
This was just a mine idea. Basicly, there's a lot of code rewriting across music, 3D graphics, 2D vector graphics, sometimes games as well, etc.
One day I started thinking on an ipothetical single codebase, wich would have been used for various computations. Then, I got known to PureData....
I was trying a way to figure out how would I have done something similar and I thunk "OpenGL handles vector3, vector4, and matrix calcs. It's of course a great start".
Basicly, this line thing was the only missing part.
Unfortunately, something as this should be done not only on a line, but on vertexes and filling as well.
This would require me to track down all three operations manually, so is not really worth against a fully manual plotting, except for hw acceleration.
Maybe a mixed solution would kick ...., however.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.