News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

The usual C/C++ vs Asm thing

Started by vanjast, May 31, 2011, 07:46:57 PM

Previous topic - Next topic

vanjast

I'm curiously busy browsing some books on 3D graphics engines and have discovered why it's a really difficult topic for most to understand.

While I understand the C & C++ language and concepts.. these authors have a tendency to get horribly lost in a real messy spider web of C code and other junk, continuosly taking a jab at Asm as if they have a 'complex maximus' or something.
For the poor layman.. this is a complete load of garbage. A 1000+ pages and I sat there asking myself... "what is this guy trying to say ??" ... it was a complete mess, except for the first 3 chapters (~100 pages).

Now for the next book.. hopefully this was at the bottom of the sh1tlist.
:P

baltoro

#1
VANJAST,
You're right. I got interested in 3D graphics a couple of years ago,...and discovered that most of the books on the subject were more confusing than informative. I wrote stuff specifically for DirectX, and, it's a pain in the ass (especially, if you use the .NET managed Direct3D version).
I did, however, find some very useful texts and source code, which I have explored and tested extensively.
I don't know if you are programming with DirectX or OpenGl,...but, DirectX has evolved considerably in the last couple of versions, making programming DirectX difficult.

In DirectX, alot of the more interesting stuff is in Shader development, which, ironically, is alot like assembly programming.
Here's an example of an older ShaderX publication: Shader Programming Tips and Tricks with DirectX 9

The editor for this series is Wolfgang Engel, and he has a really interesting 3D graphics blog: Diary of a Graphics Programmer
Another exceptional 3D graphics blog is: Tom Forsyth's Tech Blog
DirectX is a Microsoft proprietary technology, so here is the: MSDN High Level Shading Language Reference

...Of course, you don't have to use any of the DirectX or Direct3D libraries. You can implement all your 3D mathematics from scratch. I have a copy of this book: "Tricks of the 3D game Programming Gurus: Advanced 3D Graphics and Rasterization", by Andre LaMothe, published, 2003. This book is humongeous,...and, excellent. LaMothe explains EVERYTHING. All the mathematics (mostly trigonometry), and, all the C language techniques you need to create a 3D graphics engine (with a huge amount of source code) are included with the book.

A couple of sites that are also really useful, are the ATI and NVIDIA developer sites. They archive source code for various graphics effects (2D and 3D) for both DirectX and OpenGl. Also, the book, Real-Time Rendering, has a website which is huge, and has links to a large collection of graphics references.
NVIDIA Games and Graphics Development
AMD Developer Central
Real-Time Rendering Resources



Baltoro

vanjast

Thanks Baltoro... I haven't seen/heard of most of those links.  :U

I looked into DirextX7 (actually studied it like a madman !!) a few years ago, but never got further as real life 'took my toys away'.  :(
I always wanted to do 3D programming as I'm really interested in the maths side of things, so I browse through this stuff (part-time).

I've got this idea of a really simple (and addictive) network game. Although the concept is simple, the implementation is not  :bg
so the little bug on my shoulder is starting to bite really hard.  :lol

baltoro

#3
GPUs (Graphics Processing Units) have evolved so rapidly in the last decade, that it is typicallly a requirement in Direct3D (all versions after version 7) to call: GetDeviceCaps (DirectX9) to determine what your graphics accelerator is capable of. The call to GetDeviceCaps returns a: D3DCAPS9 structure,...which is a HUGE data structure, but, provides an enormous amount of information abour the graphics accelerator that will be executing your DirectX program. The DirectX SDK comes with a graphic utility that displays all the available Device capabilities, without having to code it.
The DirectX and Direct3D and their associated libraries are quite complicated, initially, and takes some time to become familiar with the typical sequence of function calls in a render loop. But, the 3D mathematics is all encapsulated in the various available functions, and it is efficient, and, the graphics look fabulous when displayed. It's usually best to start out with an entry-level book that's strictly about the DirectX fixed-function pipeline.   
A very useful resource is the documentation at MSDN: Tutorials and Samples for Direct3D 10
...Also, a fairly comprehensive introduction to DirectX Version 9 is: The Direct3D Graphics Pipeline, by Richard Thomson. The various chapters (in pdf format) are listed,...this is over five years old, but describes the existing features of DirectX Version 9 adequately.

...If you want to read some really, mind-blowing stuff,... here are several great websites for technical papers on advanced graphics techniques are:   
Baltoro


Alloy

#5
It's been asked before but where are some procedural assembly examples? So much directx/ DirectDraw assembly code examples works don't work with the latest DirectX libraries.
We all used to be something else. Nature has always recycled.

baltoro

ASTRO,   
That YouTube lecture was very informative,...thanks.
What I noticed about Direct3D is that it uses the 32-bit REAL4 type everywhere. I think that's because you wouldn't notice a significant difference, visually, in the 3D display if you were implementing the math with a floating point number with greater precision. There are lots of simple things you could to compensate.

And,...ALLOY,...
I don't know where you would look for that kind of thing. I think the real advantage with using DirectX in C++, is that the hardware access is implemented to be as fast as possible. What is DirectX?
Baltoro

Alloy

Ooops.... Sorry, I didn't proofread that. I meant to say "So much directx/ DirectDraw assembly code examples don't work with the latest DirectX libraries."  (corrected)  For a time there were some examples but they are fewer now. DirectX steadily gets better and is far more thread-friendly but x86 coding if has not.
We all used to be something else. Nature has always recycled.

hutch--

You will always get the problem where libraries are written to suit one language at the expense of other languages and this is effectively the case with DirectX written for C++.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

baltoro

#9
DirectX has changed pretty significantly with each version since Version 8.
You find that you have to query the users system to see which DirectX version is installed before you can initialize your program.
Microsoft's DirectX and Direct3D are COM interfaces and their implementations,...so, C++ is probably the best choice.
Here is: DirectX Frequently Asked Questions, MSDN
Also, here is the Wikipedia Direct X page, which contains a listing of all the versions, and numerous references.
Baltoro