One for the pros...

BlitzMax Forums/OpenGL Module/One for the pros...

UByte(Posted 2008) [#1]
I'm probably clutching at straws but is there a way in OpenGL, possibly with extensions but not vertex shaders to achieve the following:

for an arbitrary three component vertex (position) [x y z] being fed into the vertex pipeline i need the gl to normalise [xyz] then multiply by z.

OR

for an arbitrary four component vertex (position) [x y z w] being fed into the vertex pipeline i need the gl to normalise [xyz] before the division by w where w is always 1/z.

This needs to be achieved for sucessive vertices preferably with no state changes. I am currently doing this on the cpu side but would prefer to...
A) Let the gl handle it for possible performance gains
B) Be able to offload my geometry into vertex buffer objects.


ImaginaryHuman(Posted 2008) [#2]
Umm, did you check the auto-normalize feature, to see if that does what you want, or does that only apply to normal vectors?


JoshK(Posted 2008) [#3]
Pass it in the normal array and enable GL_NORMALIZE.

If you use vertex attributes you can auto-normalize an arbitrary vertex array.


UByte(Posted 2008) [#4]
As far as I can tell GL_NORMALIZE will only normalise vertex normals. Just to clarify its the vertex position I wish to normalise and then scale by w to achieve what I can only describe as a fish-eye effect in rendering the geometry.

This is trivial with a vertex program, the reason I'm keen to avoid doing so is to have my engine work on low-end systems i.e. laptops. as I'm intending to develop a 'casual' game. Maybe I am underestimating my potential user-bases sytems?


JoshK(Posted 2008) [#5]
You cannot do this without a vertex program.


ImaginaryHuman(Posted 2008) [#6]
um, you could fake a fisheye by rendering your screen and either grabbing it to a texture or rendering to a texture, and then using that texture to draw a grid mesh which you distort. But it may not be as good quality as in a shader.


UByte(Posted 2008) [#7]
I didn't think it was possible. Time to give up on fixed-function now I think. The transformation I would have to apply to the geometry's actual normals is even more bizzare.

Many thanks anyway.