Game Development Community

Using OpenGL shaders?

by Jason Cahill · in Torque Game Builder · 06/13/2005 (2:04 pm) · 11 replies

OK, this is a bit crazy, but it's something I'd be interested in playing with. What version of OpenGL does T2D / Torque use? Is it easily possible for me to extend a fxSceneObject to render things with pixel shaders? For example, I've seen really cool 2D examples in other engines that do "snow" or "water" effects using a combination of pixel / vertex shaders. I know that OpenGL 1.4 supports this stuff (but to be honest, I've only ever explored this with D3D).

Melv, or anyone else that has worked on the sources, can you comment on 1) feasibility and 2) ease.

Obviously, the engine has full source code so "anything is possible", which is why factor #2 is probably at least, if not more important, than #1. Thanks.

#1
06/13/2005 (9:03 pm)
IIRC, T2D uses OpenGL 1.2(or at least that's what I gathered from browsing through the source)
#2
06/14/2005 (12:07 am)
You could certainly do it but by far the easiest and most powerful method and something I'd desperately love to try would be to include the T2D files in TSE and make the fairly minor modifications of OpenGL usage in T2D to the GFX layer stuff in TSE.

If money is an issue here then you can easily bind to the appropriate vertex/fragment extensions (there's a resource showing you how to do this) and go from there.

TSE is the recommended route and wouldn't be a deadend solution for further dev.

- Melv.
#3
06/14/2005 (1:14 am)
That's a great suggestion. I've seen on many occassions that you've said T2D drops right into TGE (I own that too), but I don't currently own TSE and didn't know what the integration story was. Perhaps when I get to the point where this is a "must have" for my game, I'll pick up a copy. Prices around here are so cheap, why not? :-)
#4
06/14/2005 (4:38 am)
The thing to remember that T2D won't just drop right into TSE as it does TGE though as TSE doesn't use an OpenGL-base abstraction layer for graphics but rather a special GFX layer.

The good thing is that T2D doesn't use that much OpenGL manipulation and conversion to TSE would be easier than adding in decent shader support directly into T2D so it's a win to port to TSE. The thing to be careful of would be to note all the relevant changes so that you can merge easier when you get T2D updates.

If you do the work, be sure to post some shots or email them to me; I'm sure we'd all be very interested in seeing something!

Good Luck,

- Melv.
#5
06/14/2005 (12:38 pm)
Do keep in mind that TSE is currently DirectX only--so you would be restricting your portability if you went in the TSE direction until the OpenGL implementation is complete--and that won't be until after TSE 1.0 (non-EA is released).

Other than that caveat, it sounds like an excellent idea!
#6
06/14/2005 (2:45 pm)
No offense to the broader mission of Garage Games, but cross platform is not my goal. Playing with cool technology is my goal, so TSE sounds fun.

I did a grep on the T2D sources and there are only about 350 gl calls, most of which are grouped together nicely into bunches. I was thinking that one way to tackle this was to write a thunk layer, so that I could target either TGE or TSE. The scarier thing is merging changes as Melv does massive amount of work. This sounds like a cool project.
#7
06/14/2005 (6:00 pm)
No offense taken at all--just wanted to make sure you (and others) kept that in mind, especially since many of the T2D crew here aren't long time GG community members, and may not have been up to speed on the current TSE (early adopter as well), restrictions.

Would love to see what you come up with...just keep in mind that being across two licenses, you won't be able to present any TSE specific stuff here in the forums or as a resource :(
#8
06/14/2005 (10:18 pm)
Darn. Really? Not to question the EULAs too much, that doesn't make sense to me. One of the values of this work would be to cross sell T2D purchasers to TSE+TGE. If you could easily communicate and show the value prop, why wouldn't people upgrade? If you can't, because the licensing gets in the way, it hurts GG more than it helps.

Again, not trying to be a pain, I just think you are missing out on a sales opportunity here. I think you guys are doing great work and I sure wouldn't want to break your rules, but I'd like to help you if possible too! :-)
#9
06/15/2005 (12:31 am)
Well, if you post everything that you need to do to get shaders working in T2D, then there wouldn't be any reason to purchase TSE! Besides, there isn't currently an upgrade path from T2D directly to TSE (although we may need to look at this, I'll bring it up).

This is really a tricky one, because what we want to be careful of is having you expose TSE code (not necessarily OpenGL stuff, just TSE code) to those that don't have a TSE license.

If you plan on doing this in any case for your own personal work, I'd be willing to take the time to see your changes, and determine if they are appropriate for a T2D licensees only resource if you email it to me directly. Patch against T2D would be best!
#10
06/15/2005 (12:41 am)
Oh my, I feel like I've opened Pandoras box! ;)

I wish we could all zoom 10 years ahead so that non-shader capable cards are something that nobody owns or even knows about. T2D Shader Editor(tm)!

I'll give a similar offer to what Stephen kindly did; I'll help you out on any T2D related conversion issues if you need to ask, either via email or the perhaps the TSE private forums.

- Melv.
#11
06/15/2005 (6:40 am)
Thanks guys, this sounds like a good plan. I'm sure we can ultimately work something out that helps everybody. I'll get started on this in the next few days and will be in touch as soon as I have something notable. It will obviously take a little while as I don't know anything about TSE yet. but, assuming it's not a complete departure from how DirectX or OpenGL do shader stuff, it shouldn't be that hard to pick up. This will be a fun project. Thanks for all the info and expectation setting before getting started!