processing / processing/processing4
loadImage(...) and createGraphics(..., P2D) have different y-coordinates
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 494
- Fork
- 183
- Merge medio
- 4h 39m
- PR unite (30g)
- 3
Descrizione
Most appropriate sub-area of Processing 4?
OpenGL
Processing version
4.4.4
Operating system
MacOSX
Steps to reproduce this
PShader texCoordShader;
PGraphics pgP2D, pgDefault;
void setup() {
size(800, 400, P2D);
String fragShader =
"#ifdef GL_ES\n" +
"precision mediump float;\n" +
"#endif\n" +
"varying vec4 vertTexCoord;\n" +
"void main() {\n" +
" gl_FragColor = vec4(vertTexCoord.st, 0.0, 1.0);\n" +
"}";
saveStrings("frag.glsl", split(fragShader, "\n"));
texCoordShader = loadShader("frag.glsl");//, "vert.glsl");
pgP2D = createGraphics(400, 400, P2D);
pgDefault = createGraphics(400, 400); // Default JAVA2D renderer
pgP2D.beginDraw();
pgP2D.endDraw();
pgDefault.beginDraw();
pgDefault.endDraw();
}
void draw() {
background(0);
shader(texCoordShader);
image(pgP2D, 0, 0);
image(pgDefault, 400, 0);
}
Additional context
I'm working on a keystone library that is using a shader.
Because a image has different coordinates then a graphics created with P2D I need to know what the user is giving.
Not only that, it complicates the shader math way more then I would like.
To give an example:
The difference between those is P2D and default renderer (both in a sketch that is P2D).
Notice that the text is correct in both cases!!!
This does not just apply for PGraphics, using loadImage is different as well (cause also baked by a BufferedImage).
Having a mix of both of them really complicate things.
Complaining is easy however. I will dig into seeing if I can find a solution.
Would you like to work on the issue?
Trying...
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproduci lo sketch fornito e confronta il comportamento delle coordinate della texture di loadImage(...) con quello di createGraphics(..., P2D), incluso il percorso BufferedImage e l’output dello shader. Parti da questi punti di ingresso e da PGraphics, quindi determina se la convenzione delle coordinate può essere resa coerente; il lavoro è completato quando entrambe le sorgenti di immagini producono lo stesso orientamento y sotto lo shader.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- computer-graphics
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100