How to preform affine transformation in c++?

Hello I've been looking around for a way to give the illusion of 3D graphics without actually having 3d graphics I've sat down and came out with an idea but for it too work I need to know how to preform scaling , rotation , shearing like mode 7 on SNES .

I was hoping someone could get me started knowing how to do this.

from what I've read I need to be able to alter pixels based on a matrix the problem is what is the matrix and how do I alter pixels in SDL? or is there something I'm missing that is obvious.

Thanks for the help!

I don't mind doing anykind of math.

Well, 3D computer graphics is in fact an illusion :) If your program will have some vertices that are transformed by multiplying them by some matrices, then this is how 3D graphics is actually done. Unless you mean something else...

One thing... manual setting of individual pixels is horribly inefficient. Do yourself a favor and just learn OpenGL.
I've used it and hate it

Anyway, maybe I could help you, but I'm not sure what you really want to do. In a very basic form, 3D graphics is implemented as follows: you have a set of triangles made of vertices (3D vectors). In order to render a scene, you:
1) transform vertices to the coordinate system of the camera,
2) transform the result to the 2D plane of the screen,
3) draw triangles using the resultant 2D vertices.
For drawing, you need to either use a depth buffer, or draw triangles in order, strating from the farthest ones.

All those things will be done by the hardware if you use OpenGL. If you want to do it in software, I suggest to look a little into DOS graphics. Yes, ancient DOS ;) (I'm sure you could still find a few demo scene freaks that use it) It's true that SDL allows you to directly manipulate individual pixels, but I wouldn't hope to create anything usable this way.
Topic archived. No new replies allowed.