Texturing in mjb/cs519/Handouts/Textures.1pp.pdf · PDF file mjb – January 13, 2020...
date post
16-Aug-2020Category
Documents
view
0download
0
Embed Size (px)
Transcript of Texturing in mjb/cs519/Handouts/Textures.1pp.pdf · PDF file mjb – January 13, 2020...
mjb – January 13, 2020
1
Computer Graphics
Texturing in GLSL
Textures.pptx
This work is licensed under a Creative Commons Attribution-NonCommercial- NoDerivatives 4.0 International License
Mike Bailey [email protected]
mjb – January 13, 2020
2
Computer Graphics
#version 330 compatibility out vec2 vST;
void main( ) {
vST = gl_MultiTexCoord0.st; gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
#version 330 compatibility in vec2 vST; uniform sampler uTexUnit;
void main( ) {
vec3 newcolor = texture( uTexUnit, vST ).rgb; gl_FragColor = vec4( newcolor, 1. );
}
Vertex shader:
Fragment shader:
2D Texturing
Texture2D 6 worldtex.bmp . . . Program World \
uBlend \ uFrequency \ uOffsetS uOffsetT \ uTexUnit 6
mjb – January 13, 2020
3
Computer Graphics
World
mjb – January 13, 2020
4
Computer Graphics
Teapot