3D programming

Started by
9 comments, last by 3dnewbie 17 years, 2 months ago
Hey all :) For a while now I have been thinking about learning 3D programming and the math behind it (somewhat into the math already). One thing that annoys me though is that it seems only to be possible by using APIs like directx or open gl. I realise if I only cared for the result (ie making a game), it would be much better to learn those and the advanced functions they offer, and then go from there. However, for learning purposes I would like to develope it all myself. I realise it will be much less efficient, I know it's not necessary...still I want to do it. The problem is Windows forces me to use some kind of API as far as I understand it, as I cant directly access video memory for example. My Question is: How can I directly access the video memory with direct3d or opengl? If I could set the color of a single pixel on the screen, I could build anything else from there (in theory) right?
Advertisement
Sounds like you want Pixel Toaster.

Quote:PixelToaster is a library for C++ programmers who want to write their own software rendering routines, instead of using hardware accelerated rendering with OpenGL or Direct3D.


Basically it lets you open a window and gives you a big chunk of memory to doodle on in any way you want to. [grin]
Quote:Original post by Janx
Hey all :)

For a while now I have been thinking about learning
3D programming and the math behind it (somewhat into
the math already).

One thing that annoys me though is that it seems
only to be possible by using APIs like directx or
open gl.


You are mistaken, you can program 3D even without DX or GL. Pick up a book on 3D basics like Computer Graphics: Principles and Practice. Plus there are excellent resources all over the internet that delve into all aspects of 3D programming and concepts that have nothing to do with DX or GL.


Quote:Original post by Janx
My Question is:
If I could set the color of a single pixel on the
screen, I could build anything else from there (in theory) right?

read up on GLSL/CG/HLSL.

[Edited by - _neutrin0_ on February 2, 2007 8:12:32 AM]
++ My::Game ++
Quote:Original post by _neutrin0_
You are mistaken, you can program 3D even without DX or GL. Pick up a book on 3D basics like Computer Graphics: Principles and Practice. Plus there are excellent resources all over the internet that delve into all aspects of 3D programming and concepts that have nothing to do with DX or GL.


I have lots of sources for 3D basics. Plea
se tell me how I can write 3D applications under Windows without an API (honestly asking, I was told its not
possible, if it is that would be awesome).

Quote:Original post by _neutrin0_
Why reinvent the wheel?

I think I gave my reasons for wanting it to do like that.

Quote:Original post by _neutrin0_
These are APIs that have been time tested and every aspect of them has been optimized thoroughly, more that you can ever hope to achieve single handedly. They define specs that are used by h/w manufacturers. Plus they make development cycles short, so things can be done a LOT faster.

Did you actually read my posting? I said that I know it is faster, easier,
more efficient to do it with APIs. I want to do it for learning purposes.

Quote:Original post by _neutrin0_
Do you blame us for using that? Its like saying "lets code in assembly instead of C++ or C# or Java".

Where did I blame anyone for anything. Just because I want to do it differently
makes it wrong or what? You feel attacked because I want to learn it a different
way than you did?
Quote:Original post by OrangyTang
Sounds like you want Pixel Toaster.

Quote:PixelToaster is a library for C++ programmers who want to write their own software rendering routines, instead of using hardware accelerated rendering with OpenGL or Direct3D.


Basically it lets you open a window and gives you a big chunk of memory to doodle on in any way you want to. [grin]


Thanks! :)

I am sorry you felt attacked, that wasn't my intention, corrected my post.
Actually I sent you a link telling you it can be done. I am sorry I will edit my post. Maybe it came off wrong.
++ My::Game ++
Quote:Original post by _neutrin0_
I am sorry you felt attacked, that wasn't my intention, corrected my post.
Actually I sent you a link telling you it can be done. I am sorry I will edit my post. Maybe it came off wrong.


kk ;)
Its certainly possible. Im writing such a program for my dissertation. Its a piece of software capable of loading and rendering textured 3d objects. The only thing im using directX for is to set the display to full screen and return a pointer to the video memory. If you like i can give you a copy of the class which does that bit.
OpenGL also has functions to let you set individual pixels. (As does the Win32 API itself)

Quote:Original post by Janx
Quote:Original post by _neutrin0_
You are mistaken, you can program 3D even without DX or GL. Pick up a book on 3D basics like Computer Graphics: Principles and Practice. Plus there are excellent resources all over the internet that delve into all aspects of 3D programming and concepts that have nothing to do with DX or GL.


I have lots of sources for 3D basics. Plea
se tell me how I can write 3D applications under Windows without an API (honestly asking, I was told its not
possible, if it is that would be awesome).


Well, you will need an API of some sort. This is because the operating system (quite rightly) will complain and kill your program if you try, straight off, to write directly to video memory (which is as close as you can come with standard C++). However, it is possible to get access to video memory and then write to it. Unfortunately, I only know how to do this in assembly language, but there will be a WINAPI (assuming you're using Windows - I've not done much stuff under other operating systems and so don't know for Linux, Macs, etc) function that lets you do something similar, I'm sure.

All you need really, as you say, is the ability to plot pixels - or at a slightly higher level, to plot polygons. You can perform the transformation from 3D space to 2D screen space yourself, mathematically and the rest all follows.
[TheUnbeliever]

This topic is closed to new replies.

Advertisement