RE: retrieve OpenGL state from fragment program in CG
"Pat Brown \(OpenGL\)" <[email protected]>
| Newsgroups | gmane.games.devel.opengl |
|---|---|
| Organization | Fat City Network Services, San Diego, California |
| Message-ID | <[email protected]> |
There is no way to get at the texture enables in fragment programs.
Additionally, the texture enables have no impact on fragment program execution -- you don't have to enable a texture to use it in your program. An instruction like
TEX result.color, fragment.texcoord[0], texture[0], 2D;
says you want to use the 2D texture bound to texture image unit 0. For each texture image unit, the texture of the appropriate type is automatically "enabled".
This is true of straight ARB_fragment_program, all Cg fragment program profiles, and GLSL as well.
If you want to modify your program execution based on a condition, your best bet is to probably use a program parameter/uniform to convey that information to your program. For ARB_fragment_program, that would be
glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0,
(any condition) ? 1.0 : 0.0);
You can then use that value in your shader as needed.
Pat
-----Original Message-----
Sent: Thursday, September 15, 2005 11:12 AM
To: Multiple recipients of list OPENGL-GAMEDEV-L
Hi Guys
I am using CG, and I would want to retrieve opengl state from fragment
program. I just need to know (inside the fragment program) if 2d texture is
enable in one particular texture unit.
/********* main program ************/
glActiveTextureARB(GL_TEXTURE1_ARB);
if (any condition)
glEnable(GL_TEXTURE_2D);
else
glDisable(GL_TEXTURE_2D);
/* ----------------------------
fragment program:
well, how to retrieve "texture unit 1" status without
using parameters.
is it possible to retrieve this kind on information from glstate.*?
how?
... */
Thx guys!
RIX
-----
FAQ and OpenGL Resources at:
http://www.geocities.com/SiliconValley/Hills/9956/OpenGL
--
Author: =?iso-8859-1?Q?Rhadam=E9s_Carmona?=
INET: [email protected]
Fat City Hosting, San Diego, California -- http://www.fatcity.com
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [email protected] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
-----
FAQ and OpenGL Resources at:
http://www.geocities.com/SiliconValley/Hills/9956/OpenGL
--
Author: Pat Brown \(OpenGL\)
INET: [email protected]
Fat City Hosting, San Diego, California -- http://www.fatcity.com
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [email protected] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).