DSGM OpenGL

Show us what you're making.

DSGM OpenGL

Postby Foxi4 » September 11th, 2013, 10:13 am

Work in Progress adaptation of libnds's VideoGL into a DSGM environment. :twisted:

This project will require you to install additional Actions. Again, this is a Work in Progress, some things may not work as intended and not all Actions have all the necessary arguments.

Functionality covered so far:

- Texturing (Generating slots, Loading, Binding)
- Drawing textured Quadrilaterals (does not take arguments yet!)
- Drawing textured Triangles (does not take arguments yet!)
- Setting Render Parameters (Shadows, Lightsources, Culling etc.)
- Drawing textured Models from CallLists
- Creating Lightsources
- Rotation and Translation

Enjoy! :grin:
Attachments
DSGM 3D Proto Library.nds
NDS Testing ROM
(435.31 KiB) Downloaded 243 times
Actions.rar
Actions Pack
(4.91 KiB) Downloaded 212 times
DSGM 3D Proto Library.dsgm
DSGM Source
(50.17 KiB) Downloaded 217 times
Last edited by Foxi4 on September 11th, 2013, 5:27 pm, edited 1 time in total.
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1221
Joined: December 31st, 2010, 3:25 am

Re: DSGM OpenGL

Postby Nobody » September 11th, 2013, 4:39 pm

I'm sure this is revolutionary! I'm glad to see people are actually working on 3D and trying to do things that have not yet been done! I haven't tried it out, but if I have the time I will try to soon
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Retro Ducks: viewtopic.php?f=13&t=3533 (latest)
The Living Dead 2: viewtopic.php?f=13&t=3483
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082
User avatar
Nobody
 
Posts: 2323
Joined: February 14th, 2011, 12:08 am
Location: United States of America

Re: DSGM OpenGL

Postby Foxi4 » September 11th, 2013, 5:22 pm

YoshiInAVoid wrote:I've only ever used OpenGL on PCs before, so I've always gone with the "immediate mode is bad" idea and used VBOs and shaders instead.

VideoGL isn't really OpenGL - it's merely made to resemble it for the sake of compatibility, porting and ease of development. :P There isn't much to fear from it but to be frank, I'm only discovering what things do myself now - I'm a complete 3D n00b. :lol:
But the DS doesn't have it's own GPU, so I guess here it's ok?

The DS does have its own "GPU" - both ARM7 and ARM9 have a couple graphics cores divided into two engines - Main and Sub, Main being capable of 3D with a relatively modern feature set, just a very small vertices-per-frame rate (6144 per frame and only the visible polygons count towards the total polycount, the rest is discounted thanks to Culling etc.). The chip may not be external and dedicated but it does its job fine, so none of this is Software Rendered.
Did you have to use FIFO to put some of the weight on arm 7?

I didn't use any FIFO - everything is done by the 3D Engine. There are commands that can utilize FIFO within VideoGL though.
Nobody wrote:I'm sure this is revolutionary! I'm glad to see people are actually working on 3D and trying to do things that have not yet been done! I haven't tried it out, but if I have the time I will try to soon

Suit yourself, but keep in mind that this setup re-arranges the VRAM Banks and as such renders PALib graphics functionality crippled on the selected screen until you re-initialize everything back to the way it was. ;)
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1221
Joined: December 31st, 2010, 3:25 am

Re: DSGM OpenGL

Postby Foxi4 » September 11th, 2013, 10:39 pm

Oh, they're really not that bad. Thing is, everything FIFO-related is handled automatically when you call a CallList so there's really no reason to pack the textures yourself in-code - libnds blasts everything through async DMA and it's blazing fast as it is. The commands aren't that complex either.

http://libnds.devkitpro.org/a00152.html

As for the PAlib-crippling aspect, on one hand you lose the capacity to use PAlib functionality in terms of graphics, but on the other you get the far superior capabilities of hardware-accelerated pseudoOpenGL, so it's hardly something to cry over. :D To be frank, the 3D engine could even be effectively used in 2.5D projects - the maximum size of a sprite on the DS is 64x64 pixels while with GPU acceleration and the 3D engine you can push a 1024x1024 texels ones, and even without such a huge texture you can stretch small ones as much as you like, so it's definitely worth some attention.

Once 3D is covered, I'll try to add backdrop functionality. ;)
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1221
Joined: December 31st, 2010, 3:25 am

Re: DSGM OpenGL

Postby Buck_7 » September 13th, 2013, 6:26 pm

Cool, you're working on 3d again? :grin:
User avatar
Buck_7
 
Posts: 1460
Joined: February 19th, 2011, 1:44 am

Re: DSGM OpenGL

Postby Foxi4 » September 14th, 2013, 1:42 am

Never really stopped working on it, I just couldn't be ar*ed to learn more about it for quite a while. :P
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1221
Joined: December 31st, 2010, 3:25 am

Re: DSGM OpenGL

Postby BLsquared » September 18th, 2013, 3:25 pm

Just one question:
If I were to make a 2.5D game with this, how would collisions work? Could I still use the DSGM collisions, or would I do something else?
You may call me BLsquared, Commodore, or TexasBatman. Preferably BLsquared.
My avatar was made by this guy: http://christianmanga.com/smf/index.php ... bum;in=374

"Every puzzle has an answer." - Professor Layton
"In war, there is indeed no substitute for victory." - Douglas MacArthur
"Love and Peace!" - Vash the Stampede
"It's High Noon!" - McCree
Member of Memefefe's Squad
User avatar
BLsquared
 
Posts: 997
Joined: August 10th, 2011, 4:39 pm
Location: United States of America

Re: DSGM OpenGL

Postby Nobody » September 18th, 2013, 5:25 pm

Commodore wrote:Just one question:
If I were to make a 2.5D game with this, how would collisions work? Could I still use the DSGM collisions, or would I do something else?

I would assume you'd use something else since DSGM should be using the 2D sprite collision
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Retro Ducks: viewtopic.php?f=13&t=3533 (latest)
The Living Dead 2: viewtopic.php?f=13&t=3483
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082
User avatar
Nobody
 
Posts: 2323
Joined: February 14th, 2011, 12:08 am
Location: United States of America

Re: DSGM OpenGL

Postby Buck_7 » September 18th, 2013, 5:39 pm

I'd be thinking since this is 3d, each object or model would have an x axis, a y axis and a z axis, so same as the 2d collision ,but with a included if for z maybe. I feel It's going to be a lot to code if foxi4 is going to make this fully functional in DSGM.
User avatar
Buck_7
 
Posts: 1460
Joined: February 19th, 2011, 1:44 am

Re: DSGM OpenGL

Postby Foxi4 » September 18th, 2013, 11:52 pm

There's a huge number of approaches you can try when it comes to collision in 3D, different ones work differently for different games. For a 2.5D game (like New Super Mario Bros.) you could actually use standard 2D collision since all the 3D tiles are doing is "looking pretty" when the camera itself doesn't actually move.

You can base it on intersection of bounding boxes just like DSGM does in 2D, except in 3D - you know the widths and height of the object so you can calculate that easily.

You can use distance to calculate collision - If the distance is smaller than the sum of radiuses of circles drawn from the center on the bases of the models to their edges then they're colliding.

This is not so much a matter of OpenGL or VideoGL - it's a matter of mathematics. The same principles used in PALib and in 2D apply in VideoGL in 3D, just with the addition of a third plane.
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1221
Joined: December 31st, 2010, 3:25 am

Re: DSGM OpenGL

Postby BLsquared » September 20th, 2013, 11:58 pm

Alrighy. Thanks!
You may call me BLsquared, Commodore, or TexasBatman. Preferably BLsquared.
My avatar was made by this guy: http://christianmanga.com/smf/index.php ... bum;in=374

"Every puzzle has an answer." - Professor Layton
"In war, there is indeed no substitute for victory." - Douglas MacArthur
"Love and Peace!" - Vash the Stampede
"It's High Noon!" - McCree
Member of Memefefe's Squad
User avatar
BLsquared
 
Posts: 997
Joined: August 10th, 2011, 4:39 pm
Location: United States of America

Re: DSGM OpenGL

Postby bart2465 » October 31st, 2013, 9:04 pm

i made my own 3d model in sketchup, exported it to .3ds. after that i converted it with the converter to a bin file and included it to dsgm.
i have some questions:
how can i make my own texture and include it into dsgm?
when i disable the texture and use materials in sketchup i only can see the color red on the ds. can this be fixed?
can i change the distance between the object and the camera?
can i have multiple 3d objects in 1 screen at the same time?
Superball 3D for android is finally out!
It's one of the best 3D platform games on android!
you can download it now:
https://play.google.com/store/apps/details?id=com.PleiterGames.Superball3D
User avatar
bart2465
 
Posts: 32
Joined: May 5th, 2012, 4:51 pm
Location: home

Re: DSGM OpenGL

Postby Foxi4 » November 4th, 2013, 1:40 am

1) Any texturing program will do, then convert it to a 16-bit bitmap using PAGfx or GRIT and load from NitroFS.
2) Don't use Materials, I don't think they import correctly and the DS thinks they're simply normal shading.
3) "The engines don’t move the ship at all. The ship stays where it is and the engines move the universe around it." - Professor Farnsworth, Futurama
In OpenGL, the camera is actually static - it's the scene that translates. You can move the scene forwards and backwards, but the camera stays where you initialized it, the rest is an optical illusion.
4) You can have any number of objects between popping and pushing the matrix, the reason why this tech demo actions don't allow you to do so is because they're a tech demo and a work-in-progress. The demo flushes right after rendering of the object is done which is why you may experience flashing when introducing more than one 3D object - this will be fixed later.
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1221
Joined: December 31st, 2010, 3:25 am

Re: DSGM OpenGL

Postby Foxi4 » November 30th, 2013, 10:27 pm

Right, so the OpenGL extension is going along nicely. I've implemented a couple of changes, namely:

  • Two new types introduced - VERTEX and UVCOORD in order to simplify the necessary user input to a minimum:
  • VERTEX type is a container with 3 floating point values, it stores information about a single point in 3D space
  • UVCOORD type is a container with 2 integer values, it stores information about which portion of the texture file you wish to use - this will allow using "sprite sheets" as textures for animated surfaces in the future as well as storing textures for multiple primitives in one file
  • The DSGMGlDrawTri() and DSGMGlDrawQuad() functions now accept VERTEX and UVCOORD arguments

Now, I'm at a crossroads. I'm not entirely sure if I should structure this DSGM extension to be educational in nature, as in show concepts of OpenGL in an Action-like manner or if it should simply do what it's supposed to do. My original idea was the former, but that's going to make the library hard to use for newbies, however the latter approach will not really "teach" the users anything.

Opinions?
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1221
Joined: December 31st, 2010, 3:25 am

Re: DSGM OpenGL

Postby bart2465 » December 1st, 2013, 1:09 pm

keep up the good work!
Superball 3D for android is finally out!
It's one of the best 3D platform games on android!
you can download it now:
https://play.google.com/store/apps/details?id=com.PleiterGames.Superball3D
User avatar
bart2465
 
Posts: 32
Joined: May 5th, 2012, 4:51 pm
Location: home

Re: DSGM OpenGL

Postby Buck_7 » December 3rd, 2013, 7:06 pm

Whatever you think is best! By the way, what's the difference between drawing a sprite with a texture and drawing a textured quad with the same texture as the sprite?
User avatar
Buck_7
 
Posts: 1460
Joined: February 19th, 2011, 1:44 am

Re: DSGM OpenGL

Postby Foxi4 » December 5th, 2013, 2:12 am

Buck_7 wrote:Whatever you think is best! By the way, what's the difference between drawing a sprite with a texture and drawing a textured quad with the same texture as the sprite?

As the name suggests, a sprite is just a sprite, regardless of where you're getting the data from wheras a Quad is constructed of vertices onto which a texture is projected. A sprite is flat and drawn onto a canvas, a Quad is a collection of points in 3D space.

In an OpenGL context you only operate on the latter, but if you ignore the Z-plane, you can create Quads to represent your sprites as you would on a normal canvas.
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1221
Joined: December 31st, 2010, 3:25 am

Re: DSGM OpenGL

Postby BLsquared » December 5th, 2013, 6:23 pm

And use that to make a 2.5D platformer! Question: can I use a collision BG for collision and the quads for displaying the actual stage?
You may call me BLsquared, Commodore, or TexasBatman. Preferably BLsquared.
My avatar was made by this guy: http://christianmanga.com/smf/index.php ... bum;in=374

"Every puzzle has an answer." - Professor Layton
"In war, there is indeed no substitute for victory." - Douglas MacArthur
"Love and Peace!" - Vash the Stampede
"It's High Noon!" - McCree
Member of Memefefe's Squad
User avatar
BLsquared
 
Posts: 997
Joined: August 10th, 2011, 4:39 pm
Location: United States of America

Re: DSGM OpenGL

Postby Foxi4 » December 6th, 2013, 1:02 am

You can and you can't - it just wouldn't be nearly accurate enough due to the used perspective. There are two "easy" ways of doing what you want to do - collision detection on the basis of returned colour by using two rendering passes, one with coloured polygons and one with textures after the collision is detected or a far less troublesome one - detection based on hitboxes which is commonly used in 3D games.
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1221
Joined: December 31st, 2010, 3:25 am

Re: DSGM OpenGL

Postby BLsquared » December 6th, 2013, 5:35 am

Gotcha. So, I'll have to learn a few things.
You may call me BLsquared, Commodore, or TexasBatman. Preferably BLsquared.
My avatar was made by this guy: http://christianmanga.com/smf/index.php ... bum;in=374

"Every puzzle has an answer." - Professor Layton
"In war, there is indeed no substitute for victory." - Douglas MacArthur
"Love and Peace!" - Vash the Stampede
"It's High Noon!" - McCree
Member of Memefefe's Squad
User avatar
BLsquared
 
Posts: 997
Joined: August 10th, 2011, 4:39 pm
Location: United States of America

Next

Return to Work In Progress

Who is online

Users browsing this forum: No registered users and 1 guest

cron