Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (788)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (860)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Accessing GL_LUMINANCE_ALPHA32F_ARB texture with Shader  (Read 3230 times)
0 Members and 1 Guest are viewing this topic.
Offline AI Guy

Senior Newbie

« Posted 2008-02-05 22:51:35 »

I have a fully functional set of 3 textures, and a fragment shader with functions that access the textures and return structures, to effective have a database.

What I am concerned with is that one of them is comprised of 2 element, 32 bit float, texels. I access it like:

vec4 texel = texture2DRect(sampler_nm, addr);

What happens is texel[0], texel[1], & texel[2] all have the value of the first element that went in.  texel[3] has the value of the second element.  This sort of scares me.  I was hoping the first 2 elements would have the values, and [2] & [3] either be the next texel or be garbage.

This is occurring on a GeForce 8800 GTX/PCI/SSE2 renderer, but compiled using the ARB version of shaders.  How thin is the ice I am on, in terms of portability?  Should I redesign?  Does anyone know what 3 element texels do?
Offline Riven

« JGO Overlord »

Medals: 1357
Projects: 4
Exp: 16 years

Hand over your head.

« Reply #1 - Posted 2008-02-05 23:02:51 »

It's a few years ago that I worked with greyscale textures, but I'm fairly sure this is normal behaviour.

In the 'old times' with fixed-pipelines, the texture-multiplies must have had values in the G and B, or else:
RGB1 * L2
would have resulted in
R1*L2, G1*0, B1*0.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline Chris61182

Junior Devvie

« Reply #2 - Posted 2008-02-05 23:04:24 »

Don't worry, everything is working just like it should be. If I'm not mistaken, the behavior should correspond to Table 3.20 in the OpenGL spec....

Alpha Texture = {0, 0, 0, A};
Luminance Texture = {L, L, L, 1};
LuminanceAlpha Texture = {L, L, L, A};
Intensity Texture = {I, I, I, I};
RGB Texture = {R, G, B, 1};
RGBA Texture = {R, G, B, A};
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline AI Guy

Senior Newbie

« Reply #3 - Posted 2008-02-06 19:55:13 »


It makes sense that the luminance, the first element, would be spread across the 3 colors & and the alpha, the second element, would be in the alpha.  What a shock.

I find it easiest to specify vec4's as arrays rather than a color structure, because my data has nothing to do with color.  I need to take it more into account that color is the reason for OpenGL in the first place.
Pages: [1]
  ignore  |  Print  

hadezbladez (2078 views)
2018-11-16 13:46:03

hadezbladez (796 views)
2018-11-16 13:41:33

hadezbladez (2047 views)
2018-11-16 13:35:35

hadezbladez (412 views)
2018-11-16 13:32:03

EgonOlsen (3441 views)
2018-06-10 19:43:48

EgonOlsen (3663 views)
2018-06-10 19:43:44

EgonOlsen (2270 views)
2018-06-10 19:43:20

DesertCoockie (2991 views)
2018-05-13 18:23:11

nelsongames (3059 views)
2018-04-24 18:15:36

nelsongames (3724 views)
2018-04-24 18:14:32
Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!