Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a way to get OpenGL to do linear texture-mapping?



Ahh - you are using vertex programs - I thought you were fixed-function...

To get the similar effect, just multiply the matrix I sent you with the output vertex position...

Here is the GooBall water vertex shader (with all the wave stuff removed). Its CG, but you should be able to figure it out ;-)

struct appdata {
	float4 vertex;
	float3 normal;
	float2 texcoord;
};

v2f vert(appdata v) {
	v2f o;
	// HACK FOR OCEAN WATER: fade out waves...
	waveHeights *= v.texcoord.x;
	o.col.a = v.texcoord.y;

	o.pos = mul(glstate.matrix.mvp, v.vertex.xyzw);
	o.fog = o.pos.z;

	// Calculate the reflection vectors
	// ------------------------------------------------
	// basics: Get the screenspace UV coords
	// TODO: normal-based pertubation
	float4x4 mat= float4x4 (
		128,0,0,128,// - _BumpPeturb / 4,
		0,-128,0,128,// - _BumpPeturb / 4,
		0,0,.5,.5,
		0,0,0,1
	);
	o.ref = mul (mat, o.pos);
}

On Mar 30, 2005, at 1:42 PM, jonas echterhoff wrote:

No, that doesn't make a difference. I don't think that most modern OpenGL implementations would benefit performance-wise from affine texture-mapping, since it's all in hardware.
Using glTexGen with GL_EYE_LINEAR should probably use linear texture-mapping i guess. I cannot use that, however, since I'm using a vertex shader and can't use the TexGen stuff that way. But it should be possible somehow.. Maybe by manipulating the projection and/or texture matrix?


jonas

On Mar 30, 2005, at 12:16 PM, Dario Accornero wrote:

On 30 Mar 2005, at 10:38, jonas echterhoff wrote:

I'm looking for a way to get OpenGL to draw a texture with linear/affine mapping and not perspective correct. The reason is that i want to render a reflection of a part of my scene. This reflection is rendered to a texture, so it is already perspective correct. If I render this reflection texture using perspective-correct texture mapping it will end up looking distorted.

Assuming this is fixed-function, I'm not sure there's a way to *force* affine mapping, but... have you tried glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_FASTEST) right after glBindTexture? GL_FASTEST should in theory give you affine mapping, whereas GL_NICEST should always give you perspective mapping, but as you can see it's just a glHint, not a requirement...


HTH,
Dario


_______________________________________________ Do not post admin requests to the list. They will be ignored. Mac-opengl mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden


Nicholas Francis
Director, www.otee.dk


_______________________________________________ Do not post admin requests to the list. They will be ignored. Mac-opengl mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden
References: 
 >Is there a way to get OpenGL to do linear texture-mapping? (From: jonas echterhoff <email@hidden>)
 >Re: Is there a way to get OpenGL to do linear texture-mapping? (From: Dario Accornero <email@hidden>)
 >Re: Is there a way to get OpenGL to do linear texture-mapping? (From: jonas echterhoff <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.