Board index FlightGear Development Effects and shaders

Accessing textures defined in cxx

An exciting "new" option in FlightGear, that includes reflections, lightmaps, the particle system etc.. A lot is yet to be discovered/implemented!

Accessing textures defined in cxx

Postby eatdirt » Mon Nov 15, 2021 12:13 am

Here comes the noob question...

How do I access, in the fragment shader, textures defined in the cxx code (as in simgear).

Context: I have defined a EffectGeode object in simgear having a texture, it gets rendered as it should provided the vertex and fragment shaders are empty. As soon as I fill them with anything, bang, the texture is gone. I know that I should explicitly set fragColor using the texture's texel in the fragment shader to get any texture output, but my problem is that I have no idea how to get that texture...

All examples on the wiki are using .eff files that explicit set texture indices and their source images, but I did not find examples using a Texture defined in the cxx code!

Thanks!
eatdirt
 
Posts: 1012
Joined: Wed Aug 15, 2018 3:06 pm

Re: Accessing textures defined in cxx

Postby eatdirt » Mon Nov 15, 2021 12:34 am

God, it seems that asking the question helps to find the answer... That is just the index :)

Code: Select all
gl_TexCoord[0]


I've tried this before, but multiplying texel by a color which is black does not help to visualize the texture... :oops:
eatdirt
 
Posts: 1012
Joined: Wed Aug 15, 2018 3:06 pm

Re: Accessing textures defined in cxx

Postby merspieler » Mon Nov 15, 2021 9:35 am

eatdirt wrote in Mon Nov 15, 2021 12:34 am:God, it seems that asking the question helps to find the answer...


Rubber duck debugging...
Nia (you&, she/her)

Please use gender neutral terms when referring to a group of people!

Be the change you wish to see in the world, be an ally to all!

Join the official matrix space
merspieler
 
Posts: 2241
Joined: Thu Oct 26, 2017 11:43 am
Location: Wish to be in YBCS
Pronouns: you&, she/her
Callsign: you&, she/her
IRC name: merspieler
Version: next
OS: NixOS

Re: Accessing textures defined in cxx

Postby wkitty42 » Mon Nov 15, 2021 3:02 pm

YEP! i cannot begin to count the times i've solved a programming problem by talking to someone else about it... especially when they weren't a programmer themselves... always fun is converting program-speak into something analogous to something they could understand (eg: working on a car)... one of my automotive mechanic friends helped me solve quite a few problems by suggesting i simply "change the spark plug" which worked great with the reverse analogy applied... it was great!
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04


Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 7 guests