-----sig:“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs"Political Correctness is fascism disguised as manners" --George Carlin

-----sig:“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs"Political Correctness is fascism disguised as manners" --George Carlin

I tried to do it with just one texture but my tex coords must be off. I'm also drawing the cube with two triangle fans, because two opposing vertices touch all the other faces. Gonna take a look at your City3D program a little later for some hints. I still don't think it's going to look right.

Looks like you're using an orthographic view instead of a perspective one.

Here's the complete source code with Code::Blocks project for my City3D. It's a project I have been messing around with since 2004. It includes a separate Allegro 4 project for the map editor (already compiled), it's just a 2D editor that saves to the same map name each time. If you're curious about other maps, just rename them to city.map and the program will load them.

The main program doesn't use Allegro, it doesn't use anything (except the freeimage library, though I have separate code to load uncompressed TGAs which can be used instead). This is a Windows (IE: WinMain()) project, no allegro, no sdl2, nothing. It was something I started in order to learn a little straight Windows coding. The OpenGL stuff is pretty straight forward, if you can handle my coding style and C only code.

Oh, and I changed my code to use all QUADS, no triangles, though they could be used, I tried to keep it as simple as possible to make learning OpenGL easier, which is why I also stuck to a grid layout and cubes at the time (before Minecraft! heh).

I added in keys (listed on the main screen when you run it) to show wireframe mode, so you can see what is drawn. TO enable/disable Vsync, to enable/disable fullscreen mode, disable the onscreen text (except the FPS) which can speed things up a tad. SHIFT key goes super fast, use E and Q to fly up in the air (better when zipping around the map). Frustum culling can be toggled, note, my frustum culling is simple, and only culls to the right and left, but doesn't take into account your angle looking up and down (because this was meant to be only driving, no flying and looking up and down). You can toggle the skybox on and off as well etc... the code may help. Maybe try converting this to use Allegro as the main framework? I plan to convert this to modern opengl, should be interesting to see the FPS difference.

I think it would be nice adding an actual texture to the ex_camera skybox - maybe I'll do that tonight. The skybox code in there originally is from a textured version so I can just copy&paste it back in and I'll add a command-line paramater to specify a picture with the skybox.

Otherwise, from your screenshot it definitely looks like some of the UV coordinates are off. Also - are you sure your camera is inside of your box? It won't work if you look at it from the outside.

That screenshot is with an orthographic projection, so I can see the cube, because for some reason it doesn't show up when I use a perspective projection. I'll put my code up on GitHub. https://github.com/EdgarReynaldo/Skybox

EDITI enabled GL_CULL_FACE, I set the front face to GL_CCW, and I set it to cull backfaces, but I see the outside of my skybox. What gives? I know I wound the vertices in CCW order.

EDIT2My skybox and my cube are both inside out, but I don't know why.

EDIT3I think it has something to do with the handedness of OpenGL. My vertices are wound perfectly counterclockwise, but when I print them out, they are wound in clockwise order? WTF?

Ha, no, I just used the picture you posted and set the U/V coordinates to 0.25/0.33 - so they simply include the white pixels. Only hacked it in in half an hour or so. Just wanted to confirm that indeed all you do is paste a texture on the inside of an unlit untranslated cube - and ex_camera already was doing everything (except apply a texture).

Ah, okay. Yeah, it is much simpler than some realize. A sort of optical illusion. The concept is simple enough. If you want a 360 degree view all around you, and you have four sides all the same size, than you make each view 360/4 degrees, or a 90 degree field of view.

Terragen is handy for that, it's what I used. It doesn't have degrees (the old version anyhow), but the ZOOM factor when set to 1 even, equals 90 degree field of view. After that, just render each direction to a 512x512 texture and you're all set.

Anyhow, the original pics are in that zip if anyone wants them separate. I only done it in that single cross shape because that is the most common I find online.