Author Topic: A little "HowTo" use OpenGL in GLBasic  (Read 18883 times)

Offline kanonet

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1142
    • View Profile
    • My GLBasic code archiv
Re: A little "HowTo" use OpenGL in GLBasic
« Reply #30 on: 2014-Aug-18 »
Should i redo it to Vertex buffer object ( VBO )  ???
Ah... and the Rendering to Triangles/ Trianglestrips?
Would be interesting. And yes to triangles/trianglestips.

BTW how would you do animations?
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1540
    • View Profile
Re: A little "HowTo" use OpenGL in GLBasic
« Reply #31 on: 2014-Aug-19 »
I have already taken out the random colors.

For the last time, can I get feedback from anyone regarding my demo because that is all I ask:
Here is the link again, in case you have dyslexia:
http://www.glbasic.com/forum/index.php?action=dlattach;topic=9962.0;attach=6817

Offline fuzzy70

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 828
  • Look left, Look right, LOOK OUT!!
    • View Profile
Re: A little "HowTo" use OpenGL in GLBasic
« Reply #32 on: 2014-Aug-19 »
Your demo seems to work fine Matchy. Things look a bit odd if you go below the cubes as looks like faces are fighting each other to be viewed.

Other than that what feedback are you looking for?

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1540
    • View Profile
Re: A little "HowTo" use OpenGL in GLBasic
« Reply #33 on: 2014-Aug-19 »
Thanks fuzzy70 and you'll see the face color modifications. I think that I am not putting in the bottom face of the cubes and it's really just supposed to be land. Also, it crashes above 128x128 but I am able to get more than twice otherwise with my code.
With my "3d engine" I was able to turn off zbuffer and display only the side of the cube (wall) that is required. I did this so that is would work on Android.
So what would be interesting to have an algorithm to do just that. I mean, when creating a cube, where is the back?



Offline fuzzy70

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 828
  • Look left, Look right, LOOK OUT!!
    • View Profile
Re: A little "HowTo" use OpenGL in GLBasic
« Reply #34 on: 2014-Aug-19 »
I'll have a look, am pretty sure I saw an algorithm somewhere that culls cube faces as if your close up you only see one side & if far away the maximum you will ever see are 3 sides.

Also personally any of the cubes that's blue I would make them share the same colour so there the same level like water should be as there not small enough to simulate waves or such but that's not the point of the demo.

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1540
    • View Profile
Re: A little "HowTo" use OpenGL in GLBasic
« Reply #35 on: 2014-Aug-19 »
 :good:

I don't know how it could without recreating the object. In terms on block tiling, one simple way to do it is to just create a 3-sided cube then just rotate it to face the player.

Alternatively, what I wanted to original to with the demo was to have it as one object (top face) with it's slant to the next tile height, so it looks like proper terrain. :whistle:

Offline fuzzy70

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 828
  • Look left, Look right, LOOK OUT!!
    • View Profile
Re: A little "HowTo" use OpenGL in GLBasic
« Reply #36 on: 2014-Aug-19 »
Alternatively, what I wanted to original to with the demo was to have it as one object (top face) with it's slant to the next tile height, so it looks like proper terrain. :whistle:
That's just a simple plane generated from an array, pretty sure on one of the noise posts (cant remember if perlin or simplex noise) I posted a program that scrolls the noise isometric style drawn with polyvectors. That wasn't drawn from arrays but rather calculating the noise per frame so major performance hit.

Not sure if this would help but glEnable(GL_CULL_FACE) might give a boost over scanning what faces are visible or not as unlike a minecraft style display where there are cubes possibly above & below these ones are just adjacent to each other.

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1540
    • View Profile
Re: A little "HowTo" use OpenGL in GLBasic
« Reply #37 on: 2014-Aug-19 »
I almost had terrain just commented/left out the code in the demo because it was getting late that evening.

Next test should be for Android, because that is the original reason for the idea of efficient object drawing, otherwise its shouldn't really be a concern aside from speed.

Offline fuzzy70

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 828
  • Look left, Look right, LOOK OUT!!
    • View Profile
Re: A little "HowTo" use OpenGL in GLBasic
« Reply #38 on: 2014-Aug-19 »
Other than the quick & dirty iso one I posted using polyvectors (which was only done to show another way of viewing the noise plus added FMB to roughen it up a bit) by last exploration of landscape generation was on the Amiga in Assembly language & lookup tables lol. Basically a long while ago  :D

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5013
  • O Rly?
    • View Profile
Re: A little "HowTo" use OpenGL in GLBasic
« Reply #39 on: 2014-Aug-19 »
BTW how would you do animations?

I don't think about it...  :zzz:
should i?
I <3 DGArray's :D

PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2666Mhz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline kanonet

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1142
    • View Profile
    • My GLBasic code archiv
Re: A little "HowTo" use OpenGL in GLBasic
« Reply #40 on: 2014-Aug-19 »
How should I know, its your project?
IMHO if you dont use shaders, you need to build the animated object at runtime, each frame. So you could not use your display lists etc. Pr do you know a way that I dont see?
(If you use shaders you can render static objects and just animate them in shader - but I have done this myself already, so Im less interested in this)
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64