# Need some help with my direction

Page 1 of 1

## 2 Replies - 1053 Views - Last Post: 16 July 2011 - 11:58 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=239688&amp;s=572dc50920e3e667996562d91c73b404&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 jbeme

Reputation: 3
• Posts: 98
• Joined: 30-October 09

# Need some help with my direction

Posted 15 July 2011 - 07:26 PM

I am currently working on 3d graphics in depth for the first time (as well as assembly language, but I will talk about that later). So here is where I currently am, or at least I hope this explains what I have.
```// this is within a function that links another object.
// or perhaps hinges to it?
// Array to hold objects. This is global just not shown here.
// [which object][which quad item][x,y,and z coords x 4]
float plotobject[1][10][12];
// first number is x, second y, third z. Assigns numbers to plotobject array.
// Second to last number = which quad item
// Last number = which object
createglobalspot(-150, 150, 50, 150, 150, 50, 170, 170, 70, -170, 170, 70, 1, 0);
// this then moves the object as a whole depending input
// leftright = moving item top left or right
// forwardback = moving item top forward or back
// twist = moving item side forward or back
moveobject(whichobject, totalitems, leftright, forwardback, twist);
// fixsize moves object on x and y axis
// then adjusts x and y by z axis (basically creates the z axis)
fixsize(whichobject, totalitems, zspot, xspot, yspot);
// then I plot the results

glColor3f(1.0f, .1f, 0.1f);   glVertex2f(plotobject[0][0][0],   plotobject[0][0][1]);
glColor3f(1.f, .1f, 0.1f);   glVertex2f(plotobject[0][0][3],  plotobject[0][0][4]);
glColor3f(1.f, 0.1f, 0.1f);   glVertex2f(plotobject[0][0][6], plotobject[0][0][7]);
glColor3f(1.f, 0.5f, 0.1f);   glVertex2f(plotobject[0][0][9], plotobject[0][0][10]);

glEnd();
// and eventually a timeout between frames
sleep(5);

```

I created all the functions myself using a 1000 point system for movements that later I change to radians. all axis also go 1000 in each direction (later I * by 0.0001f so it can plot).
```movementangle = ((movementangle/1000.0f)*90.0f)*(PI/180.0f);

```

So yeah basically I need help with where to go from here, "good" tutorials are very helpful I would also prefer C if possible - cheap books work as well (\$10 or less unless there is no other way~). Right now I plan to ignore programming my own lighting effects (figure I understand the math, just not ready to work on it).
Few ideas on where to go, could use help modifying this list and how to learn these things:
1) I need to get better with DLL's. I am having trouble getting all variables to transfer correctly. I basically have not found anything that really helps (the monitors on here deleted the one example I got that did help~).
2) On the note of DLL's, I could use some help figuring out how to set up the timing to pre-render (if that is the right term) the screen.
3) Now to assembly language. I am still having trouble calling up individual cores, much less instruct the video cards in any way. I figure in this manner I can segregate a few cores to only run video, therefore I could render multiple very high depth pictures in a row (I figure this is more practical once computers catch up to the x8 and x12 standard).
4) I could also use some help with putting assembly language within C programming (though I will admit I have yet to look this one up much, figure I will work on that once I figure out some of the other stuff). Though I suppose its worth asking at this point if its possible to call a segment of information in C using the exact same programming I would use with NASM?

Anyways, not sure if I even understand what I said. But yeah there it is. If there is anything anyone needs clarified please ask. Also, I would like to learn all these things one way or another as I like complete knowledge. Thanks for any advice or any tutorials.

This post has been edited by jbeme: 15 July 2011 - 07:30 PM

Is This A Good Question/Topic? 0

## Replies To: Need some help with my direction

### #2 anonymous26

• D.I.C Lover

Reputation: 2
• Posts: 3,638
• Joined: 26-November 10

## Re: Need some help with my direction

Posted 16 July 2011 - 12:45 AM

First of all I would like to praise your efforts and thirst for knowledge. I think it best that I answer later today when I get on my computer rather than answer loosely on my iPhone. I have several criticisms about your code that need addressing, as well as answering your individual questions, unless someone else gets there first!

### #3 anonymous26

• D.I.C Lover

Reputation: 2
• Posts: 3,638
• Joined: 26-November 10

## Re: Need some help with my direction

Posted 16 July 2011 - 11:58 AM

Okay, right. First off, don't do this

```float plotobject[1][10][12];

```

it makes you code very difficult to read and is error prone - making debugging a nightmare later.

look into using a struct, something like:

```struct COORDS
{
int objectRef;   // A reference to identify your object.
float x;
float y;
floay z;
};

```

then you can have an array of structs to index through your coordinates:

```COORDS plotobject[NUMBER_OF_OBJECTS];

```

1000 coordinates seems like a lot to store, and I'm pretty sure that some of your coord overlap, but that is another matter. To your questions:

1. You need to stop relying on tutorials and work things out from documentation. If you must use tutorial then here is a quick Google search. Are you saying that these are unsuitable?

2. After you master dlls you will understand that anything can be moved into them and called by the main part of your code as though it were part of the main program.

3. Run by me why you want or even need to do this? Look to make your code efficient first before playing with cores.

4. Do you mean inline assembley?

You code needs revising significantly and you need to focus on that first and getting it right before you look to managing how the hardware is specifically used.