15,905,028 members
See more:
Posted

## Solution 4

1. We're not going to do your homework for you.
2. You're homework isn't to draw a cube; you merely need to construct one in memory according to the parameters given.

## Solution 1

Use SDL to draw to the screen. You can draw a cube by constructing each side of it with triangles (2 triangles to a side). Do some 3D math to rotate the cube into the correct viewing position and with the correct projection. Then draw each pixel of each triangle to a buffer. If a point was already drawn to the buffer and the z-coordinate is closer than the one that may get drawn, then don't draw the new one. If you want an image on the cube rather than a solid color, map an image to each triangle so each pixel on the screen can be transformed to the corresponding pixel in the image. And if you want to add lighting, create a light source and do some calculations to see how the light interacts with the surface of each triangle and the viewing camera. Finally, once you've finished drawing everything to that buffer, transfer it to the screen using SDL.

That's the hard way of doing it. There are various libraries out there for simplifying things (SDL actually has some ways of simplifying this task). If you are an absolute beginner, I recommend XNA, but then you'd have to learn some C#. OpenGL is another option (I believe SDL is actually built on top of OpenGL).

v2

## Solution 2

This is a hard question to answer. Where do you want to draw it ? Do you expect it to move ? GDI has methods for drawing lines, which can be made to look like a cube, but you'd need to use DirectX to draw an actual 3D shape that can be moved in 3D.

## Solution 5

thanks for your help but i do not want a complete solution you are right.because of my learning proccess i should do this however i am really in need of some different perception to understand it. i am really sorry if i was misunderstood

## Solution 3

actually my main question is in

http://www.cmpe.boun.edu.tr/courses/cmpe160/fall2009/cmpe160project1.htm

can you check it out for me?