Split up a screen into regions

Posted by nexen on Game Development See other posts from Game Development or by nexen
Published on 2013-08-23T08:22:54Z Indexed on 2013/10/25 22:13 UTC
Read the original article Hit count: 163

Filed under:
|
|
|
|

My task: I want to split up a screen into 3 regions for buffs-bar (with picked items), score-info and a game-map. It doesn't matter are regions intersect with each other or not.

For example: I have a screen with width=1; height=1 and the origin of coordinates (0;0) is the left bottom point. I have 3 functions: draw items, draw info, draw map. If I use it without any matrix transformations, it draws fullscreen, because it's vertex coordinates are from 0;0 to 1;1. (pseudo-code)

drawItems();
drawInfo();
drawMap();

And after that I see only map onto info onto items.

My goal: I have some matrixes for transformation vertexes with 0;0->1;1 coordinates to strict regions. There is only one thing, what I need to do - set matrix before drawing. So my call of drawItems-function is like: (pseudo-code)

adjustViewMatrixes_andSomethingElse(items.position_of_the_region_there_it_should_be_drawn, items.sizes_of_region_to_draw);
setItemsMatrix();
drawItems(); //the same function with vertex coordinates 0;0->1;1, 
             //but it draws in other coordinates, 
             //because I have just set the matrix for region

I know only some people will understand me, so there is a picture with regions which I need to make. Every region has 0;0 -> 1;1 inner coordinates.

enter image description here

© Game Development or respective owner

Related posts about opengl

Related posts about java