questions about graphics programming

Started by
2 comments, last by Hodgman 9 years, 9 months ago

hi I caught some ideas like ...

os kernel -> cpu io interface ( port ) -> GPU -> VRAM -> Display
also I understood almost all and lastest graphic cards uses VGA standard.
therefore I know I freely use same code to almost all graphic cards. but i have some problems
many CPUs are each other architectures so I have to code each sources...
umm ... Are they very different ? Is it true they have many different instructions?
I really wonder each OSs of different kernel have different codes for display and graphic cards?
if they have few different instructions, I'm really very happy ....sleep.png
Advertisement
I'm not sure I understand your question, but generally you would write your program in a high level language against an API such as Direct3D or OpenGL. This hides the specific details from you, although if you need to maximise the amount of detail when rendering you'll need to be very familiar with how to use the API and the hardware in an optimal fashion.

It is possible to write programs that are mostly agnostic to the CPU architecture and GPU specifics. Most popular languages in use today are portable with either little or some effort (depending on how low level they are). It is also possible to write programs that work across different operating systems by choosing libraries that already support the platforms you wish to target.

I'm not sure I understand your question, but generally you would write your program in a high level language against an API such as Direct3D or OpenGL. This hides the specific details from you, although if you need to maximise the amount of detail when rendering you'll need to be very familiar with how to use the API and the hardware in an optimal fashion.

It is possible to write programs that are mostly agnostic to the CPU architecture and GPU specifics. Most popular languages in use today are portable with either little or some effort (depending on how low level they are). It is also possible to write programs that work across different operating systems by choosing libraries that already support the platforms you wish to target.

so do you mean that programmers can control vram and gpu with high level language having same instructions to gpu or cpu being free of other OSs?

Yes, unless you're writing a driver and/or and OS, you will use a high-level API.

On Windows you can use Direct3D or OpenGL. On Mac/Linux you only have OpenGL. On mobiles there is OpenGLES. On game consoles they are either complete custom, or a modified version of Direct3D.

Direct3D code is written in C++ on the CPU side, and HLSL on the GPU side.

OpenGL code is written in C on the CPU side, and GLSL on the GPU side.


If you want to program the GPU directly, you can use old VGA techniques from the 90's... But this will likely all be emulated on modern computers, so there isn't muh point.
to directly control a modern GPU, you would have to write your own driver from scratch, and you would have to rewrite it for every single model of GPU (and for every OS). Every GPU runs on completely different instructions than every other one -- which is why we are forced to use high-level languages and APIs.

This topic is closed to new replies.

Advertisement