PDA

View Full Version : OpenGl 3D Room



Torrtuga
04-27-2015, 02:25 PM
I am learning openGl and know the basic concepts of 3D in it.
But I could not figure how to create a room of this type which I saw in many Projects.
The walls converge in the end with ceiling and floor.

How can we write this in openGl?

1765

reader1
04-27-2015, 08:35 PM
I am learning openGl and know the basic concepts of 3D in it.
But I could not figure how to create a room of this type which I saw in many Projects.
The walls converge in the end with ceiling and floor.

How can we write this in openGl?
1765
You may use glBegin(GL_QUADS) ;
glVertex3f(x1,y1,z1,h);
...
glEnd();
to draw 6 or 5 plane to construct the room.
you can also use in way of index.

Torrtuga
04-27-2015, 10:54 PM
Do we have to make a cube and change the camera position?

reader1
04-28-2015, 02:32 AM
Do we have to make a cube and change the camera position?
Cube is a solid object, but room is a space feature. thus, need not to produce a cube.
To move or not the camera position denpends on which you will watch.

Torrtuga
04-28-2015, 03:17 AM
Then how can we create a 3D room in openGL?

reader1
04-28-2015, 05:36 AM
see #2 thread

Torrtuga
04-28-2015, 06:51 AM
This site is useless. Of no help ever.

IonutCava
04-28-2015, 07:19 AM
draw 6 or 5 plane to construct the room..
... is a perfectly valid answer.


This site is useless. Of no help ever.
What are you having difficulties with?
Drawing the planes and positioning them?

daniel2k
04-28-2015, 11:58 AM
Just a pointer if that helps. The room is just a cube with it's normals inverted facing towards the inside.
If you get that far you just place the camera on the one side so you are viewing the inside of the cube.
The rest in the photo you provided is done by lighting, it seems they are using some advanced rendering like ray tracing

here is a link to get started with a cube
http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_05

IonutCava
04-28-2015, 12:16 PM
I initially missed his other post where he attempted exactly what you described:
showthread.php/186165-Changing-Camera-Position?p=1266051&viewfull=1#post1266051 (https://www.opengl.org/discussion_boards/showthread.php/186165-Changing-Camera-Position?p=1266051&viewfull=1#post1266051)