PDA

View Full Version : Texture Problem --> Help Me



JunHa
10-10-2005, 06:40 AM
hi all,

i would like to know " how to map texture to the box & draw a normal sphere with color at the same project?" i don't know how to write the fragment file...

so, who can help me solve this problem? let's show me the sample code...

V-man
10-10-2005, 08:35 AM
Why don't you download RenderMonkey from ati.
In the workspace, right click "Effect Window", choose
Add Effect -> OpenGL -> Textured

The shaders it generates are


//VERTEX SHADER
varying vec2 Texcoord;

void main( void )
{
gl_Position = ftransform();
Texcoord = gl_MultiTexCoord0.xy;

}
//FRAGMENT SHADER
uniform sampler2D baseMap;

varying vec2 Texcoord;

void main( void )
{
gl_FragColor = texture2D( baseMap, Texcoord );

}This does standard texture mapping by reading baseMap. It will work for any geometry.

When you are done learning GLSL, then you can write your own app, making GL calls yourself.

JunHa
10-14-2005, 11:32 PM
Thanks, V-man .....

But i would like to get the full simple source code that can compile on VC++.

Can you help me?

V-man
10-17-2005, 04:01 AM
It's not available through RM.
FYI, some people have written tutorials. A search on this site will provide some links.
ATI's and NV's GL SDKs probably have examples you can look at.