Results 1 to 5 of 5

Thread: Draw a room

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2010
    Posts
    10

    Draw a room

    Hi all!
    I'm trying to draw a room in opengl. I've searched and another topic I found on this forum told me that I should try to use GL_QUADS.
    I've try :

    glBegin(GL_QUADS);
    /* Floor */
    glColor3f(0.0,0.0,1.0);
    glVertex3f(-1,-1,-1);
    glVertex3f(1,-1,-1);
    glVertex3f(1,-1,1);
    glVertex3f(-1,-1,1);

    /* Ceiling */
    glVertex3f(-1,1,-1);
    glVertex3f(1,1,-1);
    glVertex3f(1,1,1);
    glVertex3f(-1,1,1);

    /* Walls */
    //wall1
    glVertex3f(-1,-1,1);
    glVertex3f(1,-1,1);
    glVertex3f(1,1,1);
    glVertex3f(-1,1,1);

    //wall2
    glVertex3f(-1,-1,-1);
    glVertex3f(1,-1,-1);
    glVertex3f(1,1,-1);
    glVertex3f(-1,1,-1);

    //wall3
    glVertex3f(1,1,1);
    glVertex3f(1,-1,1);
    glVertex3f(1,-1,-1);
    glVertex3f(1,1,-1);

    //wall4
    glVertex3f(-1,1,1);
    glVertex3f(-1,-1,1);
    glVertex3f(-1,-1,-1);
    glVertex3f(-1,1,-1);

    glEnd();

    However, just the floor and wall3 appeared on my screen. Anyone can help me!

  2. #2
    Senior Member Regular Contributor
    Join Date
    Mar 2009
    Posts
    153

    Re: Draw a room

    Do you have culling enabled? If yes try to disable it: glDisable(GL_CULL_FACE);

  3. #3
    Senior Member Frequent Contributor
    Join Date
    Oct 2009
    Posts
    592

    Re: Draw a room

    There's a NeHe FPS tutorial, try that if you want a room. Also, there are plenty of Cube tutorials both on NeHe and elsewhere. Randall is right though, that probably you've enabled GL_CULL_FACE. Just leave it disabled.

  4. #4
    Junior Member Newbie
    Join Date
    Dec 2010
    Posts
    10

    Re: Draw a room

    Yeah it worked. thanks a lot!

  5. #5
    Junior Member Newbie
    Join Date
    Dec 2010
    Posts
    10

    Re: Draw a room

    according to codecolony.de site, I used texture to cover my room. my texture just could cover exterior sides of the room, hence standing in the room, i couldn't see the texture on walls. Which parameter can help me to set texture for not exterior but inner sides of my room?

Similar Threads

  1. OpenGl 3D Room
    By Torrtuga in forum OpenGL: Basic Coding
    Replies: 9
    Last Post: 04-28-2015, 12:16 PM
  2. how to draw a room with walls
    By lara in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 11-26-2011, 02:45 AM
  3. Making a room
    By nergal in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-27-2002, 07:32 AM
  4. How to create a room??
    By new_to_opegl in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-25-2002, 06:11 AM
  5. modelling a room
    By fox in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 11-20-2001, 02:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean