Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
116 views3 pages

Shader Programming for Beginners

This document provides instructions for writing shader programs to draw various shapes and manipulate images. Specifically, it asks the reader to: 1) Write a fragment shader to draw an ellipse centered on the screen as shown in Figure 1. 2) Write a shader program to load an image and wrap it to the OpenGL screen, then extend it to zoom the image 2x from the center and convert it to grayscale as shown in Figures 2 through 4. 3) Write a shader program to wrap a video texture to the screen and draw a 10 pixel grid over it, as depicted in Figure 5.

Uploaded by

ishara7777
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
116 views3 pages

Shader Programming for Beginners

This document provides instructions for writing shader programs to draw various shapes and manipulate images. Specifically, it asks the reader to: 1) Write a fragment shader to draw an ellipse centered on the screen as shown in Figure 1. 2) Write a shader program to load an image and wrap it to the OpenGL screen, then extend it to zoom the image 2x from the center and convert it to grayscale as shown in Figures 2 through 4. 3) Write a shader program to wrap a video texture to the screen and draw a 10 pixel grid over it, as depicted in Figure 5.

Uploaded by

ishara7777
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Tutorial 1

Notes :
1. Pleases use https://www.shadertoy.com/ editor to program the shaders
2. Please use linear algebra operations to optimize the codes

1. Figure 1 contains ellipse drawn with a fragment shader. The shape centered to the
screen midpoint and the border adjacent to the screen border. Write the fragment shader
program to draw this shape.

Figure 1

2. Load an image and wrap to the OpenGL screen using a shader program (Figure 2)
a. Write the fragment shader program to zoom the image 2x from centre. (Figure 3)
b. Turn the image into grayscale format (Figure 4)

Figure 2
Figure 3

Figure 4

3. Write a fragment shader program to wrap a video texture to opengl screen. Extend the
program to draw a grid over the video. A grid cell should be 10 pixels in size. (Figure 5)

Figure 5

You might also like