Creating noise images with Python and OpenGL

  • #1
244
6

Main Question or Discussion Point

Hi

I am learning how to do a line integral convolution with OpenGL given a vector field. So, as a first step, I need to learn how to create an nxn noise image. Are there any good tutorials/books I can use to learn how to do this?
 

Answers and Replies

  • #2
11,794
5,402
Here's one way:

Python:
import random
n=3
nxn = [[random.random() for i in range(n)] for j in range(n)]
You can replace random.random() with an expression to magnify the random values as random.random() values vary from 0.0 to 1.0

so 5*randomrandom() will give you a spread of 0.0 to 5.0

and (5*randomrandom()+3) will give you a range of 3.0 to 8.0 as examples.
 
  • Skeptical
Likes Avatrin
  • #3
244
6
Alright, but this doesn't output an image. That's why I am asking for a tutorial or a book; I am not sure a forum post is gonna tell me how to create images with OpenGL.
 

Related Threads on Creating noise images with Python and OpenGL

Replies
13
Views
2K
  • Last Post
Replies
6
Views
10K
  • Last Post
Replies
3
Views
4K
  • Last Post
Replies
9
Views
17K
Replies
1
Views
2K
  • Last Post
Replies
14
Views
6K
Replies
1
Views
2K
  • Last Post
Replies
2
Views
3K
  • Last Post
Replies
1
Views
3K
  • Last Post
Replies
1
Views
3K
Top