Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

loadImage(...) and createGraphics(..., P2D) have different y-coordinates

未关闭
#1,134 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
java

调研方向

重现提供的 sketch,并比较 loadImage(...) 与 createGraphics(..., P2D) 的纹理坐标行为,包括 BufferedImage 路径和 shader 输出。从这些入口点和 PGraphics 开始,然后确定是否可以统一坐标约定;当两个图像源在 shader 下产生相同的 y 方向时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

bug
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);
}
Image
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:

Image Image

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...

主要语言
Java
星标
497
派生
183
平均合并
4 小时 39 分钟
30 天内合并 PR
3

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

processing/processing4 的其他 Issue

查看 processing/processing4 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。