3D tutorial?

Hey guys, I have recently been trying to learn to code in 3d. I’ve been reading @Ignatz’s ebook. Real helpful. I’ve mastered 3d cubes, and now want to move on to spheres. I tried the link in the ebook. It won’t work. Can anyone help?.
Thanks.

you can try http://jmv38.comze.com/CODEAbis/files/3D-tutorial-v0.txt
It is a fairly old program, but I’ve just checked it still works.

I think that was the same link as in the ebook. I won’t work for me. I try to load the page and it keeps saying the sever is unresponsive. (Or something in that nature)

@Jmv38 @Progrmr235 I tried the above link and didn’t have any problems. I loaded the code and went thru the tutorial.

I tried the link again, still the same problem. I don’t know @dave1707 and @Jmv38, it’s probably just a glitch with my iPad if you said it works for you guys

@Progrmr235 Not sure why you’re having trouble. I tried the above link on my iPad 1 running the old version 5.1.1 iOS code and didn’t have any problems.

@Progrmr235 - try this link for that code instead.
https://gist.github.com/dermotbalson/26518774e821ff7023bb

Also see this recent discussion.
http://codea.io/talk/discussion/5594/sphere-generator/p1

Actually, I think it’s a problem with my internet severer @dave1707. I tried the same link on a PC. And thanks @ignatz, your link works.

Still a bit confused, but whatever. I’ll figure it out eventually

I have one more question. Do I need to understand shaders to understand 3d spheres?

not if you use @Jmv38’s code

(but don’t be too scared of shaders, they are fun - I have an ebook on them, too)

Was the link you gave me one to @Jmv38’s code?

yes

Then I will probably have a lot more questions in the forseeable future

a fun thing you can do with spheres is to create a 3D sky that wraps all around

description and image link:
http://coolcodea.wordpress.com/2013/12/05/139-3d-sky/

code: https://gist.github.com/dermotbalson/7799661

That does sound cool, but I want to make a space type game. Where you fly though stars and avoid Obsticals and stuff

'function setup()
    camX = 0
    camY = 0
    camZ = 200
    lookX = 0
    lookY = 0
    lookZ = -2000
    Cube = true
Cu={}
end
function newCube()
    cu = {}
    d = 7.5
    cu.cr = {
    vec3(-d,-d,d),--1. bottom left corner
    vec3(d,-d,d),--2. bottom right corner
    vec3(-d,d,d),--3. top left corner
    vec3(d,d,d), --4. top right coner
    vec3(-d,-d,-d),--5. bottom back left
    vec3(d,-d,-d),--6. bottom back right
    vec3(-d,d,-d),--7.  bottom top right
    vec3(d,d,-d)}--8.  bottom top left
     cu.c = {color(255, 255, 255, 255),color(255, 255, 255, 255),color(255, 255, 255, 255),color(255, 255, 255, 255),
    color(255, 255, 255, 255),color(255, 255, 255, 255),color(255, 255, 255, 255),color(255, 255, 255, 255),
    color(255, 255, 255, 255),color(255, 255, 255, 255),color(255, 255, 255, 255),color(255, 255, 255, 255),
    color(255, 255, 255, 255),color(255, 255, 255, 255),color(255, 255, 255, 255),
    color(255, 255, 255, 255),color(255, 255, 255, 255),
    color(255, 255, 255, 255),color(255, 255, 255, 255),color(255, 255, 255, 255),color(255, 255, 255, 255),
    color(255, 255, 255, 255),color(255, 255, 255, 255),color(255, 255, 255, 255),color(255, 255, 255, 255),
    color(255, 255, 255, 255),color(255, 255, 255, 255) ,color(255, 255, 255, 255),color(255, 255, 255, 255),
 color(255, 255, 255, 255),color(255, 255, 255, 255),color(255, 255, 255, 255),color(255, 255, 255, 255),
    color(255, 255, 255, 255),color(255, 255, 255, 255),color(255, 255, 255, 255)}
     cu.cl = {cu.c[1],cu.c[2],cu.c[3],cu.c[4],cu.c[5],cu.c[6],cu.c[7] ,cu.c[8],cu.c[9],cu.c[10],cu.c[11],cu.c[12],cu.c[13],cu.c[14],cu.c[15],cu.c[16],cu.c[17],cu.c[18],cu.c[19],cu.c[20],
    cu.c[21],cu.c[22],cu.c[23],cu.c[24],cu.c[25],cu.c[26],cu.c[27],cu.c[28],cu.c[29],cu.c[30],cu.c[31],cu.c[32],cu.c[33],cu.c[34],cu.c[35],cu.c[36]}
    cu.v ={
    cu.cr[1], cu.cr[2],cu.cr[3],cu.cr[3],cu.cr[4],cu.cr[2], -- front
 cu.cr[3],cu.cr[1],cu.cr[7],cu.cr[7],cu.cr[5],cu.cr[1], -- left side
    cu.cr[4],cu.cr[2],cu.cr[6],cu.cr[6],cu.cr[8],cu.cr[4], -- right side
    cu.cr[6],cu.cr[8],cu.cr[7],cu.cr[7],cu.cr[5],cu.cr[6],-- back
    cu.cr[6],cu.cr[5],cu.cr[2],cu.cr[2],cu.cr[1],cu.cr[5], -- top 
    cu.cr[7],cu.cr[4],cu.cr[3],cu.cr[4],cu.cr[7],cu.cr[8]}
    cu.x = math.random(-1200,1200)
    cu.y = math.random(-1200,1200)
    cu.z = -2000
    cu.RX = 0
    cu.RY = 0
    cu.RZ = 0
    cu.rX = 3
    cu.rY = 3
    cu.rZ = 0
    m = mesh()
    m.vertices = cu.v
    m.colors = cu.cl
    table.insert(Cu,cu)
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
background(0)
    newCube()
    for i,cu in pairs(Cu) do
        cu.z = cu.z + 7
    perspective()
    camera(camX,camY,camZ,lookX,lookY,lookZ)
    pushMatrix()
        translate(cu.x,cu.y,cu.z)
        rotate(cu.RX,1,0,0)
        rotate(cu.RY,0,1,0)
        rotate(cu.RZ,0,0,1)
    m:draw()
    popMatrix()
        if cu.z >= 0 then
            table.remove(Cu,i)
        end
    -- This sets the line thickness
cu.RX = cu.RX + cu.rX
    cu.RY = cu.RY + cu.rY
    cu.RZ = cu.RZ + cu.rZ
end
    -- Do your drawing here
    
end'

You’ll understand what I mean if you run this code

ah, well you might prefer this kind of thing then

2D: http://coolcodea.wordpress.com/2013/08/16/101-simulating-an-asteroid-field/

3D: http://coolcodea.wordpress.com/2013/08/19/102/

PS when posting code, you need three ~ (not two) before and after the code, without any quotes. See how I fixed your post above.

Yeah. But another thing I want to do is have two kinds of Obsticals. One that that you can hit and one that uses an AI to try to hit you. And I want to make both types of Obsticals a sphere shape

Spheres are a bit boring, you need to make them bumpy, like this

http://codea.io/talk/discussion/4517/3d-asteroids-for-that-scary-in-your-face-feeling/p1

I have code if you’d like it

I see you’re point. (And I liked the music and am impressed with how you used lighting affects). Still, I probably have to get comfortable with spheres before I can make anything like that