Welcome to GM Shaders!
These shader tutorials were carefully written with beginners and amateurs in mind, however, this can be a difficult topic. I advise taking your time when reading through them and take as many breaks as you need. They are designed to be comprehensive, yet concise which means you may not want to skip over anything unless suggested, or you'll miss something important! I avoid repeating myself wherever possible to keep these short. Throughout the tutorials, you will find highlighted text which contains additional information. Thanks for reading!
This first tutorial covers the basics of shaders in GameMaker Studio. Make sure you have an understanding of coding in GML as I won't explain it here. If you are already familiar with the purpose and setup of shaders, then feel free to skip to the next tutorial.
Shaders are used to produce all kinds of graphical and visual effects for 2D or 3D.
They are perfect for enhancing any game's visuals.
You can use them for anything from color effects like grayscale, sepia tone to blur effects, to lighting effects like normal maps, shadows
to water reflections/refractions, shockwaves, wind, and much more!
Let's get started from the very beginning by looking at texture pages in GM.
Before we get to the shaders, I want to explain a bit about texture pages (also known as a texture atlas) and how draw_sprite()
works in GM.
First, when you run your game, all textures including, sprites, fonts, are placed on texture pages.
In summary, a texture page takes trimmed-down sprites and fits as many as possible on a single page. You can
read more about texture pages here.
Additionally, you can assign sprites to specific texture pages in the settings or use the "Separate Texture Page" option to put one on its own texture page.
That means drawing a sprite is actually just drawing a part of a larger texture page:
When you draw a sprite, it is actually drawing two triangles together which form a rectangle (quad).
Each vertex carries information such as its position, texture coordinates, and color.
So the vertices' positions are in the corners of the sprite.
The texture coordinates of the whole texture page range from 0 to 1.
So 0,0
is the top-left corner of the texture page and 0,1
is the bottom-left corner.
Typically a sprite's texture coordinates will be somewhere in the middle of the texture page.
When you use draw_sprite_ext()
it sets the color and alpha of all the vertices in the sprite.
If you've used vertex buffers or draw_vertex_*
functions you'll probably know that you can change the colors of individual vertices
and you can use this to create gradients and other effects.
Understanding this helps with shaders because these are the inputs the shaders have to work with.
Shaders are graphical programs run on your GPU that handle drawing of sprites, surfaces, vertex buffers, etc. GM supports two types of shaders: the vertex shader and fragment shader (sometimes called pixel shaders).
When you don't apply any shader, GM uses a default "passthrough" shader. This passthrough shader outputs the texture with the draw color and alpha the way you're used to. It also handles things such as alpha testing and fog/lights in 3D, but that is for another time.
Shaders process all vertices simultaneously and then all the pixels. This means that any conditional effect (dependent on a specific area, time or any other variable) will perform slower since all vertices/pixels use the same code despite varying results.
Right-click the shaders folder and select "Create Shader" or press ALT+A. I'll title mine "shd_passthrough" because this is going to be just another (simplified) passthrough shader. If you right-click the shader in the resource tree, you have three options to choose from:
For now, we will just use GLSL ES because it is fairly standard and can be used on all platform targets.
I've gone through the default vertex and fragment shader, but I replaced the comments with my own. This will give a basic explanation of what each line does, but don't worry about the details just yet. Vertex shader code quickly explained:
//Receive the input positions (x,y,z/depth) of the vertices.
attribute vec3 in_Position;
//Receive the input color (red, green, blue, alpha) of the vertices.
attribute vec4 in_Colour;
//Receive the input texture coordinates (u,v) of the vertices.
//u,v are the x,y of texture coordinates, but called u,v to avoid confusion.
attribute vec2 in_TextureCoord;
//Pass the texture coordinates to the fragment shader.
varying vec2 v_vTexcoord;
//Pass the vertex color/alpha to the fragment shader.
varying vec4 v_vColour;
//Handle vertex.
void main()
{
//Create a vector for the vertex position and translation amount (1.0).
vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
//Output the vertex position (in projection-space).
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
//Set the vertex color/alpha to be passed to the fragment shader.
v_vColour = in_Colour;
//Set the texture coordinates to be passed to the fragment shader.
v_vTexcoord = in_TextureCoord;
}
Fragment shader explained:
//Pass in the texture coordinates from the vertex shader.
varying vec2 v_vTexcoord;
//Pass in the vertex color/alpha from the vertex shader.
varying vec4 v_vColour;
//Handle fragments/pixels.
void main()
{
//Set the output the vertex color multiplied by texture color of each pixel.
gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
}
Okay, so now you have a shader, but how do you use it? Well, you just have to set it, draw anything that you want the shader effect to apply to (surfaces, sprites, etc) and then reset it when you're done to resume normal drawing. Here's an example:
//Begin drawing with the shader effect.
shader_set(shd_passthrough);
//Draw code for the shader goes here (e.g. draw_self, draw_surface, etc).
draw_surface(application_surface,0,0);
//Disable the shader.
shader_reset();
This way you have full control what each shader applies to. Sometimes I need separate shaders for separate objects (e.g. a wind shader only for foilage) and using draw_self
with a shader works neatly.
Shaders also work great with GM's surfaces especially for effects that apply across multiple objects or screen effects (e.g. motion blur or bloom).
Congrats on creating and examining a shader!
For many, matrices and vertex positions look quite complicated, but that's okay!
Don't worry too much about the details as the next tutorials will break the process down into bite-sized pieces.
For now, I hope you learned something interesting and are looking forward to writing your own shaders.


EFCC To Arraign Mompha On Monday
Mompha will be arraigned before Justice Mohammad Liman of the Federal High Court, Ikoyi, Lagos, on Monday, November 25.
by SaharaReporters, New YorkThe Economic and Financial Crimes Commission has filed a 14-count charge bordering on alleged money laundering and other related offences against suspected Internet fraudster, Ismaila Mustapha, also known as Mompha.
Mompha will be arraigned before Justice Mohammad Liman of the Federal High Court, Ikoyi, Lagos, on Monday, November 25.
He will be prosecuted by EFCC counsel, Mr Rotimi Oyedepo.
Mompha filed a N5m suit against the commission on Thursday for alleged illegal detention.


Steem-Engine is hosting a competition to invent S.C.O.T. SCOT stands for Smart Contract Organizational Token. SCOT is essentially a voting botlayered on top of a Steem Engine token. SCOT tracks and distributes Steem Engine tokens beyond just Steem. It’s a baby step to creating decentralized community tokens on the Steem Engine platform.
This project is inspired by the quote “anything you can do with a smart contract I can do with a bot and a set of keys.” This seems like a really quick way to get these tokens distributed to users within a community. We will likely work on additional smart contract approaches, but they will take many months to develop where as we expect SCOT should be a fairly quick project.
The first person/team to create SCOT which meets the requirements and project objective will be given 1000 ENG tokens. Runners up may be chosen and given 500 ENG tokens.
SCOT requirements-
It must be open source
It must use Steem-Engine tokens
It must distribute tokens based on voting patterns on the steem blockchain
Story mode
A community organizer creates a token on the Steem Engine platform and sets a high enough supply cap such that they feel confidant that inflation has enough time to ramp up. SCOT has the active key and issues tokens every day based on infation rules.
Users go through either a token specific app (like partiko, appics, steepshot) or through a more general condenser instance (steemit, mspsteem, steempeak) and vote normally. Tokens are either chosen automatically based on the app or chosen manually through an interface.
Users of the app vote and interact normally, but based on the voting pattern the bot is also distributing Steem-Engine tokens once per day.
Users can choose to boost their posts using the voting bot script attached. This will foster token specific custom trending and ranking pages for the different tokens/communities.
Details
A user can set the amount of inflation (by year if they so choose).
The inflation is paid out daily through voting.
The amount of inflation earned daily by a user is determined by how many votes they receive and how much Token Power the voter had and chose to use.
There is no Staking in this system so 1 Token = 1 Token Power.
A user gets 10 votes per day. (Bonus if you can allow the program to accept non 100% votes, bonus for figuring out downvoting).
We suspect an app will have a special json code automatically applied to all posts through their interface to note those posts are accepting a certain token. Non app specific condenser instances will have to build a UI to allow users to choose a handful (5 or fewer) tokens to be able to receive on a post they make.
So, a user goes through an app, makes a post and other users upvote them. They don’t have much steem, but the voters do have a lot of app/SE tokens. The user receives little steem, but gets a lot of app tokens at the end of the day.
Global Setting
We suggest Steem Engine create a key like “SETokensSupported” which would be an array of SE Tokens symbol, for example, a json_metadata:
{
"app": "steemit/1.23",
"SETokensSupported": ["TKN1", "TKN2", "TKN3"]
"format": "html",
"tags": ["steemit", "steem"],
"users": ["ned", "dan"],
"images": ["https://img.busy6.com/@ned"],
"videos": [
"https://www.youtube.com/watch?v=rkQ7b-u8_6g",
"https://www.youtube.com/watch?v=H399YZ0pv0o"
],
"status": "archived",
"canonical":
"http://blog.steem.io/steem/@ned/the-first-phase-of-the-steem-faq-and-wikee-consolidation-of-knowledge"
}
If you have a different suggestion or approach be sure to include that in your submission.
Best of luck! Contact us in Discord if you have any questions
This page is synchronized from the post: ‘Dev Contest// 1000 ENG // Open Source Steem Engine Voting Bot’


Privacy disclaimer: your photo does not get uploaded anywhere, all of this happens on your device, in your browser. It even works offline.
Browse for your photo here and if there is geographical information in it, you'll see a map and get a link to Google maps.


Build An Interactive Website!
Summer 2017
---
@Day 1: The Document Object Model
DOM basics, simple interactions
---
HTML Review
*Elements* are the building blocks of a webpage.
`
` `` ``
An element is written with two *tags*:
an opening tag `
` and a closing tag. `
`.
You can put text inside of an element.
`
To be or not to be, that is the question.
`
Elements can be nested inside of each other.
```
HTML is fun!
```
The Webpage of Peter the Gopher
This Is A Big Heading.
This Is A Sub Heading.
Paragraphs have spacing on the top and bottom.
Paragraphs can contain text, with some parts emphasized and bold.
Elements often have attributes.
Lists are fun!
A list
with three
items.
---
CSS Selectors Review
The Webpage of Peter the Gopher
This Is A Big Heading.
This Is A Sub Heading.
Paragraphs have spacing on the top and bottom.
Paragraphs can contain text, with some parts emphasized and bold.
Elements often have attributes.
Lists are fun!
A list
with three
items.
---
JavaScript Review
Use the JavaScript console (Command-Alt-I) to test these out for yourself.
```
// Single-line comment
/*
Multi-line comment
*/
// Declaring a variable
var cookies;
// Assigning a value to a variable
cookies = 4;
cookies = cookies + 3;
cookies += 2;
cookies++;
// Declaring and assigning a variable at the same time
var myString = "Hello World";
// Control Flow and Boolean Expressions
var feelingLucky = true;
if(feelingLucky){
console.log("Lucky!");
}else if(cookies === 10){
console.log("You have exactly 10 cookies!");
}else if(cookies > 10 && cookies < 100){
console.log("You have more than 10 cookies but less than 100.");
}else{
console.log("What else is there to say?");
}
// Arrays
var luckyNumbers = [8, 25, 777];
console.log(luckyNumbers[2]);
luckyNumbers[3] = luckyNumbers[1] - luckyNumbers[0]
console.log(luckyNumbers[3]);
console.log(luckyNumbers.length);
var friends = [
"Alice",
"Bob",
"Chris"
];
console.log(friends[2]);
friends.pop();
console.log(friends[2]);
friends.push("Dave");
console.log(friends[2]);
// Functions
var greet = function(name){
return "Hello, " + name
};
console.log( greet("Darryl") )
console.log( greet("world") )
// Objects
var myPet = {
name: "Spot",
species: "dog",
likes: [
"squeaky things",
"eating sausages",
"being scratched behind the ears"
],
isAwake: false,
status: function(){
var word;
if(this.isAwake){
word = "awake";
}else{
word = "asleep";
}
return this.name + " the " + this.species + " is " + word
}
};
console.log(myPet.name);
console.log(myPet.likes[1]);
myPet.age = 3;
console.log(myPet.age);
myPet.isAwake = !myPet.isAwake;
console.log(myPet.isAwake);
console.log(myPet.status());
// Loops
for(var i = 0; i < luckyNumbers.length; i++){
console.log( luckyNumbers[i] );
}
for(var friend of friends){
console.log( greet(friend) );
}
var countdown = 10;
while(countdown > 0){
console.log(countdown)
countdown--;
}
```
---
Using CodePen
[CodePen](https://codepen.io) allows you write HTML, CSS, and JavaScript independently of each other and see how your app or webpage looks like as you edit it.
You won't have to worry about writing the document structure, i.e. ``, ``, ``, `
---
Let's Practice!
{{
Choose one of these challenges, and create it using what you know about HTML, CSS, and JavaScript so far. Be creative!
- Riddle: Display a question on the webpage along with at least three answer buttons. Display a victory message when the correct answer is picked, and a failure message otherwise.
- Counter: Start with two buttons and a number display that shows 0. When one of the buttons is clicked, increase the number by 1; for the other, decrease by 1.
- Activity Logger: Make a button. Whenever any of the 5 above events is triggered on the button, `console.log()` a sentence describing what occurred (e.g. on double click, output `"You double clicked the button! Click-click!"`).
}}
---
@Day 2
Modifying attributes and styles, structure and content
---
Manipulating Classes
The HTML attribute `class` is not only useful for CSS styling. They can be used to store information about an element's current *state*.
Before: ``
After: ``
You can manipulate classes with an element's `.classList` property.
`.classList.add()` `.classList.remove()` `.classList.toggle()`
*Dynamically manipulated* classes are especially powerful when used with CSS.
```
```
```
#like-button {
background-color: white;
color: gray;
}
#like-button.liked {
background-color: #3b5998;
color: #fff;
}
```
```
var button = document.getElementById('like-button');
button.addEventListener('click', function(){
button.classList.toggle("liked");
});
```
1
---
Night and Day
---
Query An Element By A CSS Selector
Sometimes you'll want to get an element that doesn't have an ID. `document.querySelector()` can help with that!
`.querySelector()` takes a string with a CSS selector, and returns the first Element that matches it.
```
// Get the first element that is inside a
var strongElement = document.querySelector('p strong');
```
---
Querying Multiple Elements
Here are two ways to access multiple elements at once.
`document.getElementsByTagName()` `document.querySelectorAll()`
`.getElementsByTagName()` will return an `HTMLCollection` object containing all the elements that match an element name.
```
// Get all
s
var headings = document.getElementsByTagName('h2');
```
`.getElementsByTagName()` will return an `NodeList` object containing all the elements that match an element name.
```
// Get all elements inside a
var strongElements = document.querySelectorAll('p strong');
```
---
Iterating Through Lists of Elements
`HTMLCollection` and `NodeList` behave similarly to arrays, which means we can iterate through them an access each element.
Here's how to add a `:)` to all `
`s:
```
for(var i = 0; i < headings.length; i++){
var heading = headings[i];
heading.innerText += ' :)';
}
```
or
```
for(var heading of headings){
heading.innerText += ' :)';
}
```
1
This Is A Sub Heading.
This Is Another Sub Heading.
All of these have smiley faces.
---
You Have The Tools, Now Create Something Fun!
{{
- Timer
- Target Shooter
- Quiz
- Color Picker
- Virtual Keyboard
- Something Else?
}}
---
@Day 3: Forms
---
The `


| SchemaSpy Analysis of limestone.tolsen | Generated by SchemaSpy |
| Generated by SchemaSpy on Wed Apr 01 10:22 GMT-05:00 2009 | |
| Database Type: PostgreSQL - 8.3.7 |
Please support this project |
XML Representation Insertion Order Deletion Order (for database loading/purging scripts) |
29 Tables:
Total rows: 92
| Table | Children | Parents | Rows | Comments |
|---|---|---|---|---|
| aces | 1 | 1 | 8 | |
| acl_inheritance | 1 | 4 | ||
| acl_privileges | 1 | 1 | 12 | |
| auth_user_cookies | 0 | |||
| autoversion_types | 5 | |||
| binds | 1 | 2 | 4 | |
| binds_locks | 2 | 0 | ||
| bits_pw_reset | 0 | |||
| cleanup | 1 | 0 | ||
| collections | 1 | 4 | ||
| databasechangelog | 22 | |||
| databasechangeloglock | 1 | |||
| dav_aces_privileges | 2 | 8 | ||
| group_members | 2 | 2 | ||
| locks | 2 | 2 | 0 | |
| locks_resources | 2 | 0 | ||
| media | 1 | 0 | ||
| namespaces | 2 | 2 | ||
| principals | 9 | 1 | 4 | |
| properties | 2 | 0 | ||
| quota | 1 | 4 | ||
| redirectrefs | 1 | 0 | ||
| resources | 15 | 2 | 8 | |
| transitive_group_members | 2 | 2 | ||
| user_domains | 1 | 0 | ||
| users | 1 | 1 | 2 | |
| vcrs | 1 | 3 | 0 | |
| versions | 2 | 3 | 0 | |
| vhrs | 2 | 2 | 0 |


Two requirejs.config calls to the same context should operate on the same context. More info
Check console for messages


---
layout: archive
title: "Blog"
date: 2014-05-30T11:39:03-04:00
modified:
excerpt: ""
tags: []
image:
feature:
teaser:
---
{% for post in site.categories.articles %}
{% include post-grid.html %}
{% endfor %}
{% if paginator.total_pages > 1 %}
{% endif %}


Testing¶
When building your application you’ll eventually want to test that your sessions are behaving as expected. You can use the InMemorySessionInterface
for testing purposes. You’ll want to insert some logic in your application so that in a testing environment, your application uses the InMemorySessionInterface
. An example is like follows:
main.py
import asyncio_redis
import os
from sanic import Sanic
from sanic.response import text
from sanic_session import (
RedisSessionInterface,
InMemorySessionInterface
)
app = Sanic()
class Redis:
_pool = None
async def get_redis_pool(self):
if not self._pool:
self._pool = await asyncio_redis.Pool.create(
host='localhost', port=6379, poolsize=10
)
return self._pool
redis = Redis()
# If we are in the testing environment, use the in-memory session interface
if os.environ.get('TESTING'):
session_interface = InMemorySessionInterface()
else:
session_interface = RedisSessionInterface(redis.get_redis_pool)
@app.middleware('request')
async def add_session_to_request(request):
await session_interface.open(request)
@app.middleware('response')
async def save_session(request, response):
await session_interface.save(request, response)
@app.route("/")
async def index(request):
if not request['session'].get('foo'):
request['session']['foo'] = 0
request['session']['foo'] += 1
response = text(request['session']['foo'])
return response
if __name__ == "__main__":
app.run(host="<IP_ADDRESS>", port=8000, debug=True)
Let’s say we want to test that the route /
does in fact increment a counter on subsequent requests. There’s a few things to remember:
- When a session is saved, a
session
parameter is included in the response cookie. - Use this session ID to retrieve the session data from the
session_interface
. - You can also use this session ID on future requests to reuse the same client session.
An example is like follows:
import os
os.environ['TESTING'] = 'True'
from .main import app, session_interface
import pytest
import aiohttp
from sanic.utils import sanic_endpoint_test
def test_session_increments_counter():
request, response = sanic_endpoint_test(app, uri='/')
# A session ID is passed in the response cookies, save that
session_id = response.cookies['session'].value
# retrieve the session data using the session_id
session = session_interface.get_session(session_id)
assert session['foo'] == 1, 'foo should initially equal 1'
# use the session ID to test the endpoint against the same session
request, response = sanic_endpoint_test(
app, uri='/', cookies={'session': session_id})
# again retrieve the session data using the session_id
session = session_interface.get_session(session_id)
assert session['foo'] == 2, 'foo should increment on subsequent requests'


Settings-Edit Other Details
Name: $name
Change
Hometown: $home
Change
Cuurent City: $current
Change
Work At: $work
Change
Phone No: $phone
Change
Email: $email
Change


Saracens left "devastated" by guilty verdict but others have little sympathy
Premiership champions have been handed a 35-point deduction and fined £5.36 million for breaching salary cap regulations in past three seasons
by Alex Spink, https://www.facebook.com/alexspinkmirror/It was meant to be the day of Owen Farrell’s dreams - instead it turned into the stuff of nightmares.
Tuesday had been booked for a victory parade in central London, at which the England captain would show off the World Cup.
Then South Africa won the final, the open top bus tour was quickly cancelled and onto its place in the calendar Premiership Rugby dropped a bombshell.
Farrell and eight of his Saracens club mates were starting their first full day at home after a physically and emotionally draining two months in Japan, when the first shockwaves were felt.
English club chiefs announced the Premiership champions had been handed a 35-point deduction and fined £5.36 million for breaching salary cap regulations in the past three seasons.
The punishment follows an investigation into business partnerships between chairman Nigel Wray and some of the club's players.
Wray owns businesses with Farrell, Billy and Mako Vunipola and Richard Wigglesworth - England stars who have helped Sarries win seven domestic and European titles in five years.
As recently as June the North Londoners were hailed as the greatest club side of all time. Now some will think differently.
“Unlucky,” tweeted ex-Bath star James Wilson. “Over paying your players and then having to pay that bill... Was it worth it all? To be best in Europe over the last few seasons? To now be officially labeled cheats?”
Such words will deeply wound Wray, who has done more than any individual to try to make club rugby viable in England in the 25 years since the game at the top end officially turned professional.
His personal investment, which easily tops £40 million, has gone into community projects which include Saracens High School - the first pro sports club to open a mainstream school.
“I have put my heart and soul into the game I love, this is absolutely devastating,” he said. “It feels like the rug is being completely pulled out from under our feet.”
It is not only Saracens who have benefitted on the pitch, the England squad is built on its Sarries spine - with eight of the 23-man World Cup final squad as well as Eddie Jones and Steve Borthwick.
In a candid interview in May, Wray told me he could understand people thinking his co-investment arrangements with some of his highest profile players was a way round the wage cap.
“But there is a huge difference between investment - where the player can lose money, we can lose money - and salary,” he said. “To me that’s a most important point.”
That, as it has turned out, is a matter of opinion.
“The career of a rugby player might end tomorrow,” he continued. “We have to help them build a much better tomorrow. Hopefully that time will be in their mid-30s but at some stage players will fall off a cliff.
“Their salary will go down by 90 per cent. They will lose the ‘family’ they have been with for 15 years. We’ve got to work at giving them a better future. And that’s what we do and will continue to do.”
Time will tell on that too, with Tony Rowe, chairman of an Exeter club beaten in the past two finals by Saracens, calling for them to be suspended from the league until they can prove their squad is within the salary cap.
Saracens say they will appeal which means all sanctions are lifted until that process is completed in the New Year. They insist they won’t be “forced” to sell players, nor are they barred from signing new players.
But is is hard to see how change is avoidable given their squad is, if anything, stronger than that found to have breached the cap.
English rugby was hoping to build on the excitement of the World Cup. Instead it is battling to preserve the integrity of its premier competition.


@* * Copyright 2021 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *@ @import include._ @import model._ @import config.AppConfig @import model.EmailPreferencesChoice.EmailPreferencesChoice @this(main: MainView, applicationConfig: AppConfig) @()(implicit request: Request[_], loggedInUser: LoggedInUser, messagesProvider: MessagesProvider) @checkedFlag(checked: Boolean) = @{if(checked){" checked"} else {""}} @buildOptionRow(preferencesChoice: EmailPreferencesChoice, checked: Boolean = false) = {


Interfaces
Address
Association
Classification
ClassificationNode
ClassificationScheme
ContentVersionInfo
Description
EmailAddress
ExternalIdentifier
ExternalLink
ExtrinsicObject
Identifiable
InternationalString
LocalizedString
Name
Organization
Person
PersonName
PostalAddress
RegistryObject
Service
ServiceBinding
Slot
SpecificationLink
TelephoneNumber
UsageDescription
UsageParameter
User
Value
ValueList
VersionInfo |