![]() |
|
Learn OpenGL |
Elias
Member #358
May 2000
|
Btw. Allegro comes with an example that displays a skybox: https://github.com/liballeg/allegro5/blob/master/examples/ex_camera.c -- |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Neil Roy said: Here, you may need this. I always knew you rolled your toilet paper upside down. Blasphemy! Elias said: an example that displays a skybox
{"name":"611229","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/e\/9e5bed09f24e3dc30de79ffc7a979c06.png","w":642,"h":401,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/e\/9e5bed09f24e3dc30de79ffc7a979c06"} Still working on my example. Will report back. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
bamccaig
Member #7,536
July 2006
![]() |
Edgar Reynaldo said: I always knew you rolled your toilet paper upside down. Blasphemy! Here, here! -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Neil Roy
Member #2,229
April 2002
![]() |
Edgar Reynaldo said: I always knew you rolled your toilet paper upside down. Blasphemy!
Actually, mine is hung properly, only not on a normal roll, but I have a hanger I bent so that I can hang in from a towel rack and not have to become a contortionist to use it! {"name":"611230","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/8\/888f58fb9b21db36c295f6fa228cc9ff.jpg","w":512,"h":695,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/8\/888f58fb9b21db36c295f6fa228cc9ff"} --- |
Ariesnl
Member #2,902
November 2002
![]() |
Some things are the same in every part of the world. Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard) |
Chris Katko
Member #1,881
January 2002
![]() |
I imagine they use something involving The Cloud. -----sig: |
Neil Roy
Member #2,229
April 2002
![]() |
Ariesnl said: I wonder what they use in the amazon forrest
Probably small furry creatures. --- |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
My skybox is seriously messed up. EDIT My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Chris Katko
Member #1,881
January 2002
![]() |
It's a feature! You're just holding the monitor wrong. -----sig: |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
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. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Neil Roy
Member #2,229
April 2002
![]() |
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. https://www.dropbox.com/s/r4bea14ll60vcz9/City3D_source.7z?dl=0 --- |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Been up all night and the coffee house network has banned Dropbox, so I'll get it a little later. Need some zzzzs. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
bamccaig
Member #7,536
July 2006
![]() |
Hah, I stayed up all night too. I feel like shit today though. Append: I guess this wasn't the O/T thread... Whoops. -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
I don't know what I'm doing wrong. My cube coordinates look right, and so do my texture coordinates. {"name":"611241","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/6\/d6d68a2224a1ecd4d3cb22580ea3a32b.png","w":1365,"h":847,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/6\/d6d68a2224a1ecd4d3cb22580ea3a32b"} My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Elias
Member #358
May 2000
|
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. -- |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
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 EDIT EDIT2 EDIT3 My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Neil Roy
Member #2,229
April 2002
![]() |
You're using Orthographic projection. That is not 3D and will never work. --- |
Elias
Member #358
May 2000
|
Here is an updated ex_camera: https://github.com/liballeg/allegro5/compare/master...allefant:skybox I called it like this: ./ex_camera /tmp/skybox.png And it looks like this: There is some white border around the top face but I think that's because of Neil's source picture, adding a few pixels where he has white there likely would fix it! {"name":"611244","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/9\/496cc9b40906b13bfa6cceed84e840f8.png","w":1140,"h":739,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/9\/496cc9b40906b13bfa6cceed84e840f8"} -- |
Neil Roy
Member #2,229
April 2002
![]() |
I never did test that image. Is it edge clamped? I attached the original separate images in a 7z to this message if you want to work with them, to redo that. --- |
Elias
Member #358
May 2000
|
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). -- |
Neil Roy
Member #2,229
April 2002
![]() |
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. --- |
|
|