• Create Account

# Lil_Lloyd

Member Since 01 Feb 2006
Offline Last Active Jun 05 2013 07:41 AM

### In Topic: My custom mem allocator isn't working because....

18 February 2013 - 08:30 PM

Eek! I have another issue now, and it shows my ignorance with pointers to pointers. I search through a linked list like so:

```//use two pointers to gague where the new ptr should go
MallocStruct** ptr1 = NULL;

//case3 other wise needs to be inserted into a list somewhere...
while(newFree > *ptr2){

ptr1 = ptr2;

ptr2 = &((*ptr2)->next);

//if next is NULL we need to go to case 4 - inserting at the end
if(*ptr2 == NULL) break;

} ```

Then, if I need to insert my new block, I insert it like so:

```// end of the list
if(ptr2 == NULL){
(*ptr1)->next = newFree;
newFree->prev = (*ptr1);
}else if(ptr1 == NULL){
//beginning of the list
(*ptr2)->prev = newFree;
newFree->next = (*ptr2);
(*ptr2) = newFree;
}else{
//middle of the list
(*ptr1)->next = newFree;
newFree->next = (*ptr2);
(*ptr2)->prev = newFree;
newFree->prev = (*ptr1);
} ```

The problem is the middle of the list insertion. I'm under the false assumption that (*ptr1)->next = newFree; merely changes the address that (*ptr1)->next points to, however it changes the value of *ptr2 too! How am I supposed to insert a node into a list like this?

### In Topic: Making a sliding puzzle

18 February 2013 - 08:22 PM

What you need to do is have many quads (tiles or squares in the puzzle) and have the main image as a texture. Then for the coordinates of the quads you also need texture coordinates between 0.0 and 1.0. As an example if I had four squares the texture coordinates of the top left square would be

(0.0,0.0)---------(0.25,0.0)
| |
| |
| |
(0.0,0.25)--------(0.25,0.25)

As the square moves around its screen coordinates will change but its texture coordinates will remain constant. I also made a sliding puzzle some time ago, you can see it under my projects here: http://www.lloydcrawley.com/projects/ at the bottom of the screen

There is a github repo link there too if you want to look at the source code. Good luck!

### In Topic: My custom mem allocator isn't working because....

18 February 2013 - 10:06 AM

Thank you!

### In Topic: Frustum culling - culling nearby objects?

10 February 2013 - 04:11 AM

As a complete guess, try transposing your MVPMatrix matrix before extracting the planes from it.

I know when I did this, most of literature that I found was based around matrices that have been constructed to work with row-major vectors, like D3D traditionally did.

You know I said this didn't work? Well, before I started normalising the planes properly it didn't. I tried it again last night and it worked PERFECTLY. However, it was only after agonising hours of experimentation that I decided to try this again. Including making a debug view from above with the bounding rectangles shown on screen. Taught me a few things though! Thanks.

### In Topic: Tutorial: an XBOX360 pad Class using GLFW

10 February 2013 - 04:06 AM

Well I can't remember clearly but last summer I tried using Xinput with GLFW and thought it was a pain, and found GLFW by itself easier to manage as long as I didn't want to use the shoulder triggers

PARTNERS