Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

What language for 3D?

satrianisatriani Member Posts: 7

Hi to all,

I am a mathematician and I want to start programming
3D-related algorithms. I am interested in transformations, rendering, etc and I am not sure what language to choose. Should I start with C++ or Java? I am not a beginner in the programming idea and I have done some pre-work in C++. I certainly know the math for 3D and I even have some pseudo-code for the work I want to do but I don't know the capabilities of every language. Bottom line is: For advanced 3D computer graphics what is the right language?

Thanks in advance and excuse my English.

/S
«1

Comments

  • CroWCroW Member Posts: 348
    hi,

    i think c/c++ is a good language for writing 3d-stuff coz it generates real machine-code,which executes always faster as an interpreter language like basic or java.

    how do you want to do your stuff?do you want to use an API like direct3d or opengl or are you a hardcore math-guru and write a true software-renderer?when using the api,every language which could access the api-funcs could do the job,c/c++,vb or even java could do the job.of coz java isnt a good decision,because you need the api installed on the target-pc and your program will run only on one platform(win32 xor linux xor..).and its slow...

    when writing a true software-renderer,you could also come to a point where things get to slow in pure c.thats the moment you need some inline assembly to speed up your code with 3d-now,mmx and so on.

    i think an API like opengl is the best point to start.its popular,fast and will use any acceleration your hardware provides...
  • satrianisatriani Member Posts: 7

    Thanks for the reply,

    First of all I intend to write 3D algorithms using methods of my own, and I don't want to include API's like OpenGL. I want to start by comparing basic methods of 3D transformations and rendering techniques (CPU cycles,time etc) without the use of any data stored. For example if I want to draw a cube and transform it to a new position in space I want to be able to construct the whole process myself not using pre-stored functions and routines.

    I am trying to decide between JAVA and C++ cause after spending some time with books and tutorials for MS Visual C++ and Borland Java, it seems to me that JAVA is easier....but is it better for 3D?

    Thanks again
    Steve



    : hi,
    :
    : i think c/c++ is a good language for writing 3d-stuff coz it generates real machine-code,which executes always faster as an interpreter language like basic or java.
    :
    : how do you want to do your stuff?do you want to use an API like direct3d or opengl or are you a hardcore math-guru and write a true software-renderer?when using the api,every language which could access the api-funcs could do the job,c/c++,vb or even java could do the job.of coz java isnt a good decision,because you need the api installed on the target-pc and your program will run only on one platform(win32 xor linux xor..).and its slow...
    :
    : when writing a true software-renderer,you could also come to a point where things get to slow in pure c.thats the moment you need some inline assembly to speed up your code with 3d-now,mmx and so on.
    :
    : i think an API like opengl is the best point to start.its popular,fast and will use any acceleration your hardware provides...
    :

  • chick80chick80 Member Posts: 349
    : Thanks for the reply,
    :
    : First of all I intend to write 3D algorithms using methods of my own, and I don't want to include API's like OpenGL. I want to start by comparing basic methods of 3D transformations and rendering techniques (CPU cycles,time etc) without the use of any data stored. For example if I want to draw a cube and transform it to a new position in space I want to be able to construct the whole process myself not using pre-stored functions and routines.
    :
    Good luck!!! I tried to do that myself some years ago, and I only managed to do very basic stuff... however I'm not a mathematician, I think that if you are it will help you much.

    : I am trying to decide between JAVA and C++ cause after spending some time with books and tutorials for MS Visual C++ and Borland Java, it seems to me that JAVA is easier....but is it better for 3D?
    :
    : Thanks again
    : Steve

    No, C++ is better than Java for 3D apps, basically because it's faster (well, ASM will be even faster than C++, but it will complicate the work very very much!).

    nICO

    [hr]
    [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS


  • Vorsin S.V.Vorsin S.V. Member Posts: 25
    Yea, ray tracer is a rather GOOD stuff... :)

    Of course for that kind of programming you should choose C++, (java is not compiler and it works very slow for that kind of stuff). Some time ago I've done my ray tracer for an internayional contest and I want to say that C is the best for this. In my vertex model editor (which was made 2 years ago), I use software rendering (texturing, etc.) and I had to include ASM blocks in code (or ASM objects to be included). So that the speed was rather good. I do not know if you are going to make 3D on this level, but anyway, for that kind of work (I repeat), choose C++.
  • SephirothSephiroth Fayetteville, NC, USAMember Posts: 1,035
    Visual anythign si on about the same level with eachother. Visual ASM would be as slow as Visual Basic. Now if you're comparing actual Java to actual C++ (meaning you use some text editor to code and nothing else), then it would be Asm for the fastest stuff, C/C++ next, then probably Pascal, then Java, and so on. If you tackle Pascal, may God have mercy upon your soul (=.

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • WVMWVM Member Posts: 2
    He,

    not really an answer to your question here, sorry for that, but I just wanted to say that I find it curious to see that all the other replyers
    are steering you away from java so much.
    Most likely they have been benchmarking their programs while these were painting stuff onto their screens. They probably also have been using the software package AWT for the connection with their screens.

    The slowness from java was coming from using this AWT package.
    Indeed, if you want to write a softwarerenderer you are better of using the c or c++ 'window' or 'frame' which is faster than the java AWT window.
    If you just want to print out your mathresults, java can give you c++ equal performance and in some cases outperform c++.
    Mind you, don't use java1.1 . That version was indeed slow.

    The thing is that c and c++ are hitting some compiler generated performance barrier, while java (thanks to evolution) can perform increasingly clever tricks at runtime which gives it an edge.

    But, what's a softwarerenderer without a connection to the screen?
    If you cannot/wantnot build your own window for java, then choose c or c++. If you had been looking for using openGL, it would have been a very hard decision between c++ and java.

    Cheers,
  • Vorsin S.V.Vorsin S.V. Member Posts: 25
    Looks like you're work on Java. So I am not going to abuse it, but you should bore in mind (if you do not know), that Java is INTERPRITATOR. Not compiler. And it is very laugh to listen "The slowness from java was coming from using this AWT package". It was not developed for FAST appliactions. Make a diffirence between FAST software render engines in C (or other compiler languages) and Java applications for Internet. If you have a slow processor (not Athlon 2000XP+, but Pentium 166 MHz), you could make a simple compare between Compiler and Interpritator (or you do not know what is Interpritator?). So, I am not going to talk with fan of Java (because it is impossible to talk with them). Java is a good language, but it was developed for the special purposes only.


    : He,
    :
    : not really an answer to your question here, sorry for that, but I just wanted to say that I find it curious to see that all the other replyers
    : are steering you away from java so much.
    : Most likely they have been benchmarking their programs while these were painting stuff onto their screens. They probably also have been using the software package AWT for the connection with their screens.
    :
    : The slowness from java was coming from using this AWT package.
    : Indeed, if you want to write a softwarerenderer you are better of using the c or c++ 'window' or 'frame' which is faster than the java AWT window.
    : If you just want to print out your mathresults, java can give you c++ equal performance and in some cases outperform c++.
    : Mind you, don't use java1.1 . That version was indeed slow.
    :
    : The thing is that c and c++ are hitting some compiler generated performance barrier, while java (thanks to evolution) can perform increasingly clever tricks at runtime which gives it an edge.
    :
    : But, what's a softwarerenderer without a connection to the screen?
    : If you cannot/wantnot build your own window for java, then choose c or c++. If you had been looking for using openGL, it would have been a very hard decision between c++ and java.
    :
    : Cheers,
    :

  • SephirothSephiroth Fayetteville, NC, USAMember Posts: 1,035
    Java will never be as fast as C/C++ or ASM. Think of what it originated to do. Web-stuff. That doesn't require blazing speeds to run at 120fps. Java is good for what it was designed for, back-end stuff. People who use Java for game programming and such are only fooling themselves.

    If you wish to write your own custom API for rendering graphics you'd be best off to use C/C++ if you're a math-god. This does NOT mean Visual C/C++, because that code is EXTREMELY sloppy and slow to begin with. I mean hand-coded C/C++ done in Wordpad or something similar. And if you're not a math-god but know ASM very well, you could use ASM to do your work, and the speed of ASM may make up for flaws in the math coding.

    As for the language debate, it basically goes like this.
    1) Assembly
    2) C/C++, Pascal
    3) Visual C/C++, Visual Pascal
    4) Basic (Any Variation), Java
    5) Visual Basic, Visual Java

    I don't care how good you are, nothing will EVER touch the speed of apps written in pure assembly. I once coded in assembly back on my 650 chips (1.8MHz Atari 400/800 chips). Those apps flew, while ones done in Basic were much slower. Problem is, 6502 ASM doesn't work on x86 chips, and I don't have a year to waste learning the new stuff, haha!

    Oh, and Visual versions of any language are always slower than if you hand-coded the sae app for several reasons. I'll list them below. Actually, i am tired, so I'll list the two primary reasons, then go to bed.
    1) Code is not optimized
    2) Generally has extra BS included (open your sources in Wordpad to see)

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • PharabeePharabee Member Posts: 84
    Hi Steve,
    I know what do you mean. Im building my own 3D function too. Im a Assembly programmers, at least I have made all basic function to draw on the screen ( Line, Circle,PolyGon etc.). I use VESA mode 0x118=1024x768x24-Bit, and Im on protected mode. I found difficulties on Geometry Pytagoras, especially on 'GetAngle' Function, Im still thinking about how to Obtain the angle only from position like x1,y1,x2,y2? any Idea
  • Vorsin S.V.Vorsin S.V. Member Posts: 25
    :I found difficulties on Geometry Pytagoras, especially on 'GetAngle' Function, Im still thinking about how to Obtain the angle only from position like x1,y1,x2,y2? any Idea
    :

    tan(a)=dy/dx, dx=x2-x1, dy=y2-y1
    between 2 vectors: cos(a)=[v0*v1]/(|v0|*|v1|), where v0, v1 - vectors, [v0*v1] - dot product
«1
Sign In or Register to comment.