Nick_Miller

01-23-2013, 09:24 PM

Hey all,

I feel pretty bad for not understanding this, but now's the time to learn...

I'm trying to do an intermediate level of applying transformations to my scene, and I just can't figure it out.

The objective is to have a 32x32 grid of blocks (where each block is 32x32 pixels in glOrtho mode)

So in total I have grids of 1024x1024 pixels.

Also, each block is to have a coordinate between 0 and 31 inclusive. (These are relative to the grid coordinates, which are divisible by 32 and range from 0 to 2.147Bil)

Also, after the first grid, I want another to be directly next to it.

Here's some psuedo:

public void renderGrid()

{

glTranslated(GridPos.x, GridPos.y, 0) //This is where I believe I'm having issues.

getBlocks().render()

}

public void renderBlock()

{

//Note, the methods used here are in a class "Primitive" that can be used to render any type of object (given the correct VBO's were initialized)

//So it seems almost mandatory that the transformations are pushed as to not affect anything previous.

glPushMatrix()

glScaled(32, 32, 0) //Scale the blocks to be 32x32 pixels

glTranslated(BlockPos.x, BlockPos.y, 0) //Now we can move each block by another 32 pixels per each coordinate. (so at a coordinate of 31 the bottom-left of the furthers block is at a real coordiante of 992x992.

glPopMatrix()

}

I don't know if this is really clear, so please ask for clarification if needed.

I greatly appreciate any help you have, and would like to know how the ordering of transformations affects the results.

Thanks so much! God Bless!

-Nick

I feel pretty bad for not understanding this, but now's the time to learn...

I'm trying to do an intermediate level of applying transformations to my scene, and I just can't figure it out.

The objective is to have a 32x32 grid of blocks (where each block is 32x32 pixels in glOrtho mode)

So in total I have grids of 1024x1024 pixels.

Also, each block is to have a coordinate between 0 and 31 inclusive. (These are relative to the grid coordinates, which are divisible by 32 and range from 0 to 2.147Bil)

Also, after the first grid, I want another to be directly next to it.

Here's some psuedo:

public void renderGrid()

{

glTranslated(GridPos.x, GridPos.y, 0) //This is where I believe I'm having issues.

getBlocks().render()

}

public void renderBlock()

{

//Note, the methods used here are in a class "Primitive" that can be used to render any type of object (given the correct VBO's were initialized)

//So it seems almost mandatory that the transformations are pushed as to not affect anything previous.

glPushMatrix()

glScaled(32, 32, 0) //Scale the blocks to be 32x32 pixels

glTranslated(BlockPos.x, BlockPos.y, 0) //Now we can move each block by another 32 pixels per each coordinate. (so at a coordinate of 31 the bottom-left of the furthers block is at a real coordiante of 992x992.

glPopMatrix()

}

I don't know if this is really clear, so please ask for clarification if needed.

I greatly appreciate any help you have, and would like to know how the ordering of transformations affects the results.

Thanks so much! God Bless!

-Nick