[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - strange thing with vector macros

strange thing with vector macros

Discuss programming topics that involve the OpenGL API.

Moderator: InsideQC Admins

strange thing with vector macros

Postby revelator » Thu Nov 10, 2011 4:50 pm

something i noticed while fiddling with vertex lights.

original glColor4f (color[0] * l, color[1] * l, color[2] * l, alpha) things work as expected.

with VectorScale(color, l, color); glColor4f (color[0], color[1], color[2], alpha); which should give the same result the lighting does not change with the angles ??? is this a bug.
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2605
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: strange thing with vector macros

Postby Spike » Thu Nov 10, 2011 5:27 pm

depends if color is an int[3] or a vec3_t/float[3]
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: strange thing with vector macros

Postby revelator » Thu Nov 10, 2011 9:54 pm

float [3] same as output so im a little stumped as to why this aint working correctly :/
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2605
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: strange thing with vector macros

Postby r00k » Fri Nov 11, 2011 3:14 am

Is vectorScale any faster? why not just go with what works?
r00k
 
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: strange thing with vector macros

Postby revelator » Fri Nov 11, 2011 3:35 am

Might not be any faster but i was planning to use it in several places where things could be made simpler but with these results id be crazy to do it :mrgreen:

strange newer the less.
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2605
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: strange thing with vector macros

Postby andrewj » Fri Nov 11, 2011 3:45 am

you've mucked something else up, probably because the 'color' variable got modified by the VectorScale() call.
andrewj
 
Posts: 133
Joined: Mon Aug 30, 2010 3:29 pm
Location: Australia

Re: strange thing with vector macros

Postby revelator » Fri Nov 11, 2011 6:22 am

Probably but its weird. See i can do the same routine as the VectorScale macro uses and it works if i restrict it to the function where i want to use it but if i use the global macro it breaks.
I have a strange hunch that some other function using the VectorScale macro is bleeding data and corrupting the output.

Maybe if i write the output to a new vec3_t initialized to 0 it will work ? worth a try.

something like
vec3_t rgb = {0,0,0};
and probably also the lightscale
float l = 0;

l = vertexligtfunc(yadda,yadda,yadda); // nope my code does not look like this :) examplary use only.

VectorScale(color, l, rgb); glColor4f(rgb[0], rgb[1], rgb[2], alpha);
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2605
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: strange thing with vector macros

Postby revelator » Sun Nov 13, 2011 3:39 pm

Hmm initializing the vectors to zero fixed it so it seems something was modifying the values.
Thanks for the help though :)
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2605
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: strange thing with vector macros

Postby mh » Mon Nov 14, 2011 12:03 pm

You should actually be able to do this without needing a VectorScale at all, and even in the fixed pipeline too. Look at - what you'll want is to set shadelight as the environment constant colour, the shadedots lookup as the per-vertex colour, and set up the combiners to evaluate GL_CONSTANT_ARB * GL_PRIMARY_COLOR_ARB * GL_TEXTURE. That would remove the need to do some per-vertex calculations on the CPU so it should run faster, although whether or not it's measurably faster depends on other factors in your code. But all the same, getting things off the CPU and onto the GPU where they belong is the right thing IMO.

This should work on any graphics hardware from a TNT2 upwards. Shaders would of course be better yet again.
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: strange thing with vector macros

Postby revelator » Mon Nov 14, 2011 12:56 pm

Sounds like an interresting way of doing it ill give it a try :) thanks.

Might even be possible to do hardware point lighting by using combiners but that might be a tad slow (idea from looking at some older tenebrae code).
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2605
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: strange thing with vector macros

Postby mh » Mon Nov 14, 2011 1:39 pm

You can do attenuation maps using combiners easily enough, but it's not really going to be productive. Overdraw stacks up very quickly with traditionally lit Quake maps - 50x or more in some places in e1m1 for example. It can seem kinda neat to push the limits of the fixed pipeline in this way, but in reality you're coding to hardware that nobody really has anymore, and even if you do identify someone who has such old hardware, this kind of thing is going to be so slow on it anyway that you may as well have not bothered.
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: strange thing with vector macros

Postby revelator » Mon Nov 14, 2011 2:30 pm

i suspected as much. hmm i really need to read some more on glsl (if i ever get time) im working for the government now :shock:
Btw for a small laugh for once nvidia was not to blame for driver crashes it turned out to be flash in combination with firefox that caused the black screen o death cases :lol:
I suspect were going to see a lot of those edge cases in the future as things get more complicated :)
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2605
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger


Return to OpenGL Programming

Who is online

Users browsing this forum: No registered users and 1 guest