oscarcat

Member
  • Content count

    2
  • Joined

  • Last visited

Community Reputation

105 Neutral

About oscarcat

  • Rank
    Newbie
  1. Hi, i'm creating a simple adventure game where the player just walks around different rooms, and when they hit door, the game refreshes to a new room. Each room size is 600x400 and the game consists of 3 rooms. The window only displays 1 room at a time. I've worked through most of the tutorials on lazyfoo and here for scrolling, but i can only find tutorials that moves the camera with the player in the center. I tried using translatef as shown in the tutorials but it just distorts the room and if i try to create QUADS that goes beyond 600x400 it does not display, even when i call glTranslatef() to the position. Sorry if this is a little hard to understand, hopefully this diagram will make my post easier to follow: [img]http://i.imgur.com/GdKGE.png[/img] Here are relevant code snippet [code] bool init() { //relevant init code glViewport(0, 0, 600, 400); glMatrixMode(GL_PROJECTION); return true; } void render() { //relevant render code glClear(GL_COLOR_BUFFER_BIT); glPushMatrix(); glOrtho(0,600,400,0,-1,1); if (player->room == 1) glTranslatef(0, 0, 0); if(player->room == 2) glTranslatef(-600, 0, 0); //pan camera right 600px if(player->room == 3) glTranslatef(0, -400, 0); //pan camera down 400px //initialize all rooms and objects in the whole maze glPopMatrix(); //End rendering phase } [/code] Any help would be appreciated, thanks.
  2. Scrolling help

    edit: wrong subforums