• Welcome to Dark Bit Factory & Gravity.
 

opengl 3d second tryout

Started by zawran, February 15, 2009

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

zawran

Yesterday I started working on opengl 3d again. Its been a long while since I messed around with raw opengl, so not everything is fresh in my mind. But I got off to a decent start I think.



Download from here: http://zac-interactive.dk/temp/ogl.zip

It isn't much, but its a start. It shows 9 cubes with texture and a lightsource. There is a readme.txt file which explains the keyboard controls.

I would like to add some shadows, some of those selfshadowing ones would be cool, but I am not sure how those are done yet, so for now I will work on adding more dynamic object creation options than just the cube, while I look around for a solution for shadows.

Shockwave

You could use the stencil buffer to make shadows in this case Zawran :)

Works well here on old hardware. It would be great to see a demo from you again after all this time.
Shockwave ^ Codigos
Challenge Trophies Won:

zawran

Quotestencil buffer

And I am off to google it right away :)

Yeah it would be cool, if I got back into it and made some kind of demo, even a small intro would be nice. We'll see how things goes. At least I have the coming week off work and nothing better to do.   :updance:

Clyde

Nice one dude, its a start at least. And I second that about a new demo eventually :)

I'd recommend you look at some of the NeHe examples that were converted to BlitzMax. Im not sure if its been done yet, but there is a Nehe article / source on Cartoon Shading.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

nkk_kan

good work dude
runs smooth even on my sad excuse of a pc :D

Pixel_Outlaw

#5
Looks great!


Just remember that Blitz only uses OpenGL 1.1. Why they haven't updated, I have no clue.  :boxer:
Also shaders seem to have hit and miss support with many computers.
Challenge Trophies Won:

zawran

QuoteAlso shaders seem to have hit and miss support with many computers.

Shaders, yikes I have just jumped back in, I don't think I will be messing with shaders yet. First I am going to try and get the basics going before I try and step into the big league :)

But from what I have found searching the BlitzResearch forums is that using glew, you can get access to extensions and GLSL shaders in GL2.0, but I have not even begun to look into how it might work yet.

zawran

Not a huge update, but I have added the option of turning things foggy :)



I am still working on adding more mesh building code to enable me to build more complex entities. At some point I will take a look at loading a model from a 3d package. I seem to remember that I have some code somewhere that I might be able to convert to bmax.

Pixel_Outlaw

#8
I started a topic about loading .3ds models in OpenGL with Blitzmax but I don't think the code was every fully written. It didn't help that it was in French.

Funny thing is I was going to suggest you try some fog and you beat me to it. You might try some black fog too.

Some time ago I wrote a small primative routine library. It was intended for gl lists and the models only had per face lighting calculations but I can provide it if you see any value in it.
Challenge Trophies Won:

benny!

First version runs smooth here. Nice start!
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

zawran

#10
Well I got 3ds model loading working, at least for models without texture and color definition, but its a start :)



Download test here: http://zac-interactive.dk/temp/oglloader.zip

I also changed my mesh setup, and re-coded the dynamic primitives code so that it works the same. Now I have to find a simple 3ds model with texture so that I can work on the code to read the texture data. After that I will start working on adding options for either displaylists or vbo depending on which I can get my head around an which works best. A long time ago I did dabble with displaylists and I seem to remember it being straight forward, but we'll see once I get started on it.

[edit] It seems rather difficult to locate a free simple 3ds model with texture, something like a crate or barrel will do. If one of you guys have one or a link to one you are willing to share I appreciate it highly.

hellfire

#11
Quotea free simple 3ds model with texture
Here's some simple knot.
I can put some more stuff somewhere later...
Challenge Trophies Won:

Pixel_Outlaw

#12
Quote from: zawran on February 16, 2009
[edit] It seems rather difficult to locate a free simple 3ds model with texture, something like a crate or barrel will do. If one of you guys have one or a link to one you are willing to share I appreciate it highly.

It seems that the .3ds format required a path to the texture rather than including the texture in the .3ds file. I may be mistaken however.

Hellfire's knot looks untextured in AutoCAD (which supports textured .3ds file import)
Challenge Trophies Won:

zawran

Yes the texture is not included in the 3ds files, but has to be loaded seperately, but the texture UV coords are there, and I need a model with its texture image to test that I am reading the texture UVs correctly. :)

The knot Hellfire provided, although doesn't make use of texture, does look great.

hellfire

Ah right, I applied a procedural material, so 3dsmax didn't export a texture-filename.
Challenge Trophies Won:

zawran

QuoteI'll whip something up sir

Why thank you my good man :)

For starters it would probably be best with just a cube/box with each face UV mapped to a different part of a texture. That is perhaps the most simple model to test with and it should be very easy to see if the outcome is correct. Unfortunately I do not have any 3d software available at the moment. (the knot looked really cool though  :clap: )

hellfire

#16
Quotejust a cube/box with each face UV mapped to a different part of a texture
Try this.
I intentionally rotated and scaled the texture-coordinates of each face differently so that wrong uvs are obvious.
Challenge Trophies Won:

Pixel_Outlaw

Ah sorry I went a bit overboard and made a castle lol.

Perhaps the cube is best for now. I do know that Anim8or will export .3ds however it doesn't supply texture information.
Challenge Trophies Won:

zawran



Well it looks like I still have work to do with reading the texture UV coors, or it could be something wrong in the code that picks the UV coords during the render. Anyway my work is not quite done it seems. Well onwards and upwards as they say :)

hellfire

#19
in opengl texture-coordinates are bootom-up.
simply try v=1-v.
(the knot should have proper uvs included, too, by the way)
Challenge Trophies Won: