Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (404)
games submitted by our members
Games in WIP (289)
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 1459 times)
0 Members and 1 Guest are viewing this topic.
Offline AI Guy

Senior Newbie





« Posted 2008-02-05 23: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
« League of Dukes »

JGO Overlord


Medals: 437
Projects: 4


Hand over your head.


« Reply #1 - Posted 2008-02-06 00: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
Projects: Revenge of the Titans, Titan Attacks, Droid Assault, and Ultratron
Offline Chris61182

Junior Member





« Reply #2 - Posted 2008-02-06 00: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!
Try the Free Demo of Revenge of the Titans
Offline AI Guy

Senior Newbie





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

Thanks,

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  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (37 views)
2013-05-17 21:29:12

alaslipknot (46 views)
2013-05-16 21:24:48

gouessej (75 views)
2013-05-16 00:53:38

gouessej (75 views)
2013-05-16 00:17:58

theagentd (83 views)
2013-05-15 15:01:13

theagentd (77 views)
2013-05-15 15:00:54

StreetDoggy (119 views)
2013-05-14 15:56:26

kutucuk (143 views)
2013-05-12 17:10:36

kutucuk (143 views)
2013-05-12 15:36:09

UnluckyDevil (153 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.091 seconds with 21 queries.