Vertex:

#version 120

void main() {
	gl_TexCoord[0] = gl_MultiTexCoord0;
	gl_Position = ftransform();
}

Fragment:

#version 120

uniform sampler2D tex;

void main(){
    vec4 texSlmp = texture2D(tex, gl_TexCoord[0].st);
    gl_FragColor = vec4(texSlmp.r, texSlmp.g, texSlmp.b, 1.0);
}

All I get with this is a black screen.

I cannot seem to get tutorials for anything older than OpenGL 3.3, and for my usecase, I could go lower, except everyone tells me “OpenGL is obsolete, try Vulkan instead”.

gl_TexCoord[0] seem to be all zeros if I modify the fragment shader to try to output gl_TexCoord[0].st, so its content would be displayed as color information, which I did for a different test. Also I can’t find anything on how do I “pass” textures (or other values) to the shaders in the official docs, nor any of the tutorials I could find explains how that actually works.

EDIT: Target version is OpenGL 2.1/GLSL 1.20

EDIT2: I updated the shaders to GLSL 3.30, but then my DuckDuckGo search results suddenly turned bad about the subject, and in/out still doesn’t work between vertex and fragment shaders (values taken from the vertex shader is all zero).

  • ZILtoid1991@lemmy.worldOP
    link
    fedilink
    arrow-up
    1
    ·
    1 month ago

    I appreciate the renderdoc, but the rest has a big “Catching mice is deprecated, recommend relying on humans instead.” vibe to it.

    Issue with DX is that I don’t want to lock myself into Microsoft stuff, especially as they’re forcing ML bullshit onto their users. I’ve heard of WebGPU, but thanks for its name, I thought it was a “web-only” thing, also I don’t want to write even the most computationally heavy things in JS.

    Since I’m writing stuff in D, I can just use nuvk in the future, maybe by translating OpenGL calls to nuvk calls, which it will translate to Vulkan or Metal.