I'm overlooking something but what?

For some reason NulPoint is not found even though I’ve verified that glGetAttribLocation() is called with the right information so I can only think that it’s classed as unused because of the way I attempted to use my shaders. Any ideas from the below?

Vertex Shader:

#version 440
vec4 NulPoint;
out vec4 DyeColor;
void main()
{
	gl_Position = vec4( NulPoint.xyz, 1.0 );
	DyeColor = vec4(1.0,1.0,1.0,1.0);
}

Geometry Shader

#version 440
#include "same.glsl"

layout(points) in;
layout(triangle_strip, max_vertices=256) out;

const int INT_MAX = int(  ~0u >> 1 );
const int INT_MIN = int(~(~0u >> 1));

const uint		uqtr = ~0u / 4;
const uint		uoct = ~0u / 8;
const double	dcap = double(~0u);
const double	dqtr = double(~0u / 4);

out		vec4	DyeColor;
out		vec4	DyeTexel;

vec2 square_vertices[] =
{
	{ 0.0, 0.0 },
	{ 0.0, 1.0 },
	{ 1.0, 1.0 },
	{ 1.0, 0.0 }
};

vec4 edge_vertex( uint x, uint y )
{
	vec4 point;
	point.x = float(double(x) / dqtr);
	point.y = float(double(y) / dqtr);
	point.xy *= fnum_uniforms.WinScale.xy * fnum_uniforms.RegScale.xy;
	point.xy += fnum_uniforms.RegPoint.xy;
	point.z   = fnum_uniforms.RegPoint.z;
	point.w	  = 1.0;
	return point;
}

void emit_vertex( vec4 point )
{
	gl_Position = point;
	DyeColor = vec4( 1.0, 1.0, 1.0, 1.0 );
	DyeTexel = vec4( 1.0, 1.0, 1.0, 1.0 );
	EmitVertex();
}

void emit_point( uint v, uint vertices )
{
	double aim = double(v);
	double max = double(vertices);
	uint rotate = uint((aim / max) * dcap);
	uint linear = rotate % uqtr;

	if ( dint_uniforms.FlatLine != 0 )
		emit_vertex( edge_vertex( linear, uqtr - linear ) );
	else
	{
		uint curved = linear + (linear / 3);
		if ( linear < uoct )
			emit_vertex( edge_vertex( curved, uqtr - linear ) );
		else
			emit_vertex( edge_vertex( linear, uqtr - curved ) );
	}
}

void emit_square_half( bool left )
{
	uint i = uint(left);
	emit_vertex( vec4( square_vertices[i++], 0.0, 1.0 ) );
	emit_vertex( vec4( square_vertices[i++], 0.0, 1.0 ) );
	emit_vertex( vec4( square_vertices[i++], 0.0, 1.0 ) );
}

void main()
{
	uint v, vertices = dint_uniforms.VtxCount, stop;
	vec4 center = vec4( 0.0, 0.0, 0.0, 1.0 );

	if ( vertices < 2 )
		vertices = 2;
	stop = vertices - 1;

	for ( v = 0; v < stop; ++v )
	{
		if ( vertices == 4 )
		{
			emit_square_half(false);
			EndPrimitive();
			emit_square_half(true);
			EndPrimitive();
		}
		else
		{
			emit_vertex( center );
			emit_point( v, vertices );
			emit_point( v + 1, vertices );
			EndPrimitive();
		}
	}
}

same.glsl

#ifndef SHARED_H
#define SHARED_H

#if defined(GL_SPIRV) || defined(GL_core_profile) || \
	defined(GL_compatibility_profile) || defined(GL_es_profile)
#define IS_OPENGL
#endif

#if defined(IS_OPENGL) || defined(VULKAN)
/* Mappings to CGLM union names */
#define uvec2s	uvec2
#define uvec3s	uvec3
#define uvec4s	uvec4
#define ivec2s	ivec2
#define ivec3s	ivec3
#define ivec4s	ivec4
#define vec2s	vec2
#define vec3s	vec3
#define vec4s	vec4
#define dvec2s	dvec2
#define dvec3s	dvec3
#define dvec4s	dvec4
#else
#include <cglm/struct.h>
#include <cglm/cglm.h>
#include <cglm/call.h>
#define uniform typedef struct
#endif

uniform UINTS { uint uunused; } uint_uniforms;

#define SHARED_UINT_NAMES "uunused"
#define SHARED_UINT_TYPES VFXTYPE_UINT
#define SHARED_UINT_COUNT (1)

uniform DINTS
{
	int		FlatLine;
	int		VtxCount;
	ivec2s	WinPoint;
	ivec3s	WinSpace;
} dint_uniforms;

#define SHARED_DINT_NAMES \
	"VtxCount", "FlatLine", "WinPoint", "WinSpace"
#define SHARED_DINT_TYPES \
	VFXTYPE_DINT, VFXTYPE_DINT, VFXTYPE_IVEC2, VFXTYPE_IVEC3
#define SHARED_DINT_COUNT (1+1+2+3)

uniform FNUMS
{
	float	funused;
	vec3s	WinScale;
	vec3s	RegScale;
	vec3s	RegPoint;
	/* Light emitted */
	vec3s	RegEmits;
	/* Light taken before ray bounces */
	vec3s	RegTakes;
} fnum_uniforms;

#define SHARED_FNUM_NAMES \
	"funused", "WinScale", "RegScale", "RegPoint", "RegEmits", "RegTakes"
#define SHARED_FNUM_TYPES \
	VFXTYPE_FNUM, \
	VFXTYPE_FVEC3, VFXTYPE_FVEC3, VFXTYPE_FVEC3, VFXTYPE_FVEC3, VFXTYPE_FVEC3
#define SHARED_FNUM_COUNT (1+3+3+3+3+3)

uniform DNUMS { double dunused; } dnum_uniforms;

#define SHARED_DNUM_NAMES "dunused"
#define SHARED_DNUM_TYPES VFXTYPE_DNUM
#define SHARED_DNUM_COUNT (1)

#ifndef IS_OPENGL
#undef uniform
#endif

#endif

Colour Shader:

#version 440

in vec4 DyeColor;
/* We use a vec4 so we can store our information in 1 cache, we can just use
 * the extra values for something else, like say the index of the texel */
in vec4 DyeTexel;

uniform sampler2D Texture;

out vec4 UseColor;

void main()
{
	vec4 ImgColor = texture( Texture, DyeTexel.xy );
	UseColor = vec4(0.5,0.5,0.5,1.0) + DyeColor * ImgColor;
}

if it’s an attribute it should be:

in vec4 NulPoint;

That fixed it, now I just need to know why my triangles aren’t appearing, been trying to make them
appear with just facing the screen, I think I forgot to make a call to the instanced draw instead of the standard draw, remind me again what the function/s where for instance drawing? In the mean time I’ll check I have something that can trigger instance drawing, probably just add a variable to my draw function that’ll switch from normal/elements to instance as long as the count is not 0

Edit: Well it turns out the reason for the lack of triangles on screen wasn’t just down to the lack of calling glDrawArraysInstanced(), since this might be down to how I wrapped the API I can only wrack my brains on this one… unless someone feels like taking a look?

It’ll be only the VFXCFG & VFXBUF that you would need to look at… I think, they are currently just wrappers for glGenArrays() & glGenBuffers() and their related calls, later I’ll add texture support to the VFXBUF but for now you can just think of it as equivalent to plain buffers, their related files are src/viewfx/vfxcfg.c, src/viewfx/vfxbuf.c, src/viewfx/gl/opengl_vfxcfg.c & src/viewfx/gl/opengl_vfxbuf.c

Edit 2: Assuming anyone was looking with me I added some printf calls to check the values I’m sending, here’s my full output:

make debug=1 run
...
cd ../../bin && ./check_extra.d.clang.elf
Creating program '[vfxapp.flat]'
gave shader path index 3
Bound shader 'shaders/null.glsl' as point shader
gave shader path index 3
gave shader path index 4
gave shader path index 5
gave shader path index 6
gave shader path index 7
Bound shader 'shaders/flat.glsl' as basic shader
gave shader path index 3
Bound shader 'shaders/frag.glsl' as color shader
Linking program...
source = GL_DEBUG_SOURCE_SHADER_COMPILER, fromid = 1 (GL_ID_UNKOWN), report = Shader Stats: SGPRS: 24 VGPRS: 8 Code Size: 64 LDS: 0 Scratch: 0 Max Waves: 8 Spilled SGPRs: 0 Spilled VGPRs: 0 PrivMem VGPRs: 0
source = GL_DEBUG_SOURCE_SHADER_COMPILER, defect = GL_DEBUG_TYPE_OTHER, weight = GL_DEBUG_SEVERITY_NOTIFICATION, fromid = 1 (GL_ID_UNKOWN)
report = Shader Stats: SGPRS: 24 VGPRS: 8 Code Size: 64 LDS: 0 Scratch: 0 Max Waves: 8 Spilled SGPRs: 0 Spilled VGPRs: 0 PrivMem VGPRs: 0
Testing program...
'NulPoint' expects 4 members
'UINTS' expects 1 members
'DINTS' expects 7 members
'FNUMS' expects 16 members
'DNUMS' expects 1 members
dints =
{
	VtxCount = 4
	FlatLine = 1
	WinPoint.x = 711
	WinPoint.y = 229
	WinSpace.w = 480
	WinSpace.h = 640
}
fnums =
{
	WinScale.x = 1.000000
	WinScale.y = 0.750000
	RegScale.x = 1.000000
	RegScale.y = 1.000000
	RegPoint.x = 0.000000
	RegPoint.y = 0.000000
	RegPoint.z = 0.000000
	RegPoint.w = 1.000000
}
nulls =
{
	{ -0.750000, -0.750000, 0.000000, 0.000000 }
	{ -0.750000, 0.750000, 0.000000, 0.000000 }
	{ 0.750000, -0.750000, 0.000000, 0.000000 }
	{ 0.750000, 0.750000, 0.000000, 0.000000 }
}
source = GL_DEBUG_SOURCE_SHADER_COMPILER, fromid = 1 (GL_ID_UNKOWN), report = Shader Stats: SGPRS: 24 VGPRS: 8 Code Size: 152 LDS: 0 Scratch: 0 Max Waves: 8 Spilled SGPRs: 0 Spilled VGPRs: 0 PrivMem VGPRs: 0
source = GL_DEBUG_SOURCE_SHADER_COMPILER, defect = GL_DEBUG_TYPE_OTHER, weight = GL_DEBUG_SEVERITY_NOTIFICATION, fromid = 1 (GL_ID_UNKOWN)
report = Shader Stats: SGPRS: 24 VGPRS: 8 Code Size: 152 LDS: 0 Scratch: 0 Max Waves: 8 Spilled SGPRs: 0 Spilled VGPRs: 0 PrivMem VGPRs: 0
source = GL_DEBUG_SOURCE_SHADER_COMPILER, fromid = 1 (GL_ID_UNKOWN), report = Shader Stats: SGPRS: 16 VGPRS: 24 Code Size: 136 LDS: 0 Scratch: 0 Max Waves: 8 Spilled SGPRs: 0 Spilled VGPRs: 0 PrivMem VGPRs: 0
source = GL_DEBUG_SOURCE_SHADER_COMPILER, defect = GL_DEBUG_TYPE_OTHER, weight = GL_DEBUG_SEVERITY_NOTIFICATION, fromid = 1 (GL_ID_UNKOWN)
report = Shader Stats: SGPRS: 16 VGPRS: 24 Code Size: 136 LDS: 0 Scratch: 0 Max Waves: 8 Spilled SGPRs: 0 Spilled VGPRs: 0 PrivMem VGPRs: 0
source = GL_DEBUG_SOURCE_SHADER_COMPILER, fromid = 1 (GL_ID_UNKOWN), report = Shader Stats: SGPRS: 56 VGPRS: 12 Code Size: 3216 LDS: 0 Scratch: 0 Max Waves: 8 Spilled SGPRs: 0 Spilled VGPRs: 0 PrivMem VGPRs: 0
source = GL_DEBUG_SOURCE_SHADER_COMPILER, defect = GL_DEBUG_TYPE_OTHER, weight = GL_DEBUG_SEVERITY_NOTIFICATION, fromid = 1 (GL_ID_UNKOWN)
report = Shader Stats: SGPRS: 56 VGPRS: 12 Code Size: 3216 LDS: 0 Scratch: 0 Max Waves: 8 Spilled SGPRs: 0 Spilled VGPRs: 0 PrivMem VGPRs: 0

Edit 3: Forgot I had set some arbitrary points to test with, even after using an #if statement to switch between those & 0 I still don’t have anything on screen

Was going to edit my previous post but apparantly times up on that, anyways just in case someone was trying to examine my code to find out what I was doing wrong to get no shapes on screen, I did some considerable cleanups so now the files that matter (test/extra/create.c, src/extra/viewfx/vfxbuf.c & src/extra/viewfx/gl/opengl_vfxbuf.c) for examining are easier to read, especially the create.c one.

https://gitlab.com/awsdert/dragonbuilder/-/tree/d4a91db3ab72d1056f39e7da9a65f24f15a19f57

Still haven’t found the reason though :expressionless:

Well I found one thing I forgot, the glEnable* calls, still not fixed, is there an option built into glew or general opengl that would log the calls? For the most part I know what’s being called and in what order but there must be something I’ve not noticed because the calls are buried under the wrappers, I can just wrap the calls in a macro that prints them in debug mode but I’d like to avoid that effort if I don’t need to do so.

Edit: Since I couldn’t find any built-in logging features nor any libraries that would do it for me I defaulted to a macro that takes an argument format parameter that I could then pass to fprintf, here’s the results (with duplicates & build info omitted):

make debug=1 run
...
cd ../../../../bin && ./check_extra.d.clang.elf
Creating program '[vfxapp.flat]'
Bound '/mnt/MEDIA/HOME/gitlab/dragonbuilder/bin/shaders/spec.glsl' as point shader
Bound '/mnt/MEDIA/HOME/gitlab/dragonbuilder/bin/shaders/frag.glsl' as color shader
Linking program...
Testing program...
'(null)' expects 1 members
'UINTS' expects 2 members
'DINTS' expects 2 members
'FNUMS' expects 5 members
'DNUMS' expects 1 members
glBindBuffer( 34962, 1 )
glBufferData( 34962, 96, 0x55a93ac91b60, 35044 )
var->loc = glGetAttribLocation( 1, 'NulPoint' )
glBindBuffer( 34963, 2 )
glBufferData( 34963, 24, 0x55a93ac9a8f0, 35044 )
glBindBuffer( 35345, 3 )
glBufferData( 35345, 8, 0x55a93ac9b5b0, 35048 )
var->loc = glGetUniformBlockIndex( 1, 'UINTS' )
glBindBuffer( 35345, 4 )
glBufferData( 35345, 20, 0x55a93ac9c6a0, 35048 )
var->loc = glGetUniformBlockIndex( 1, 'DINTS' )
glBindBuffer( 35345, 5 )
glBufferData( 35345, 60, 0x55a93ac9d7e0, 35048 )
var->loc = glGetUniformBlockIndex( 1, 'FNUMS' )
glBindBuffer( 35345, 6 )
glBufferData( 35345, 8, 0x55a93ac9e880, 35048 )
var->loc = glGetUniformBlockIndex( 1, 'DNUMS' )
glBindBuffer( 35345, 3 )
glBufferData( 35345, 8, 0x55a93ac9b5b0, 35048 )
glBindBuffer( 35345, 4 )
glBufferData( 35345, 20, 0x55a93ac9c6a0, 35048 )
glBindBuffer( 35345, 5 )
glBufferData( 35345, 60, 0x55a93ac9d7e0, 35048 )
glBindBuffer( 35345, 6 )
glBufferData( 35345, 8, 0x55a93ac9e880, 35048 )
glBindVertexArray( 1 )
...
glBindVertexArray( 1 )

Looking at it like this I see that somehow the draw call is being ignored or just outright failing because that has the calls for linking variables and buffers to the given vertex array, in case there was someone trying to look still (or at all), here’s the section of code that should be executing but appears to not be doing so:

EXTRA_EXP dint drawVfxCfg( VFXCFG *vfxcfg, VFXDRAW draw, uint instances )
{
	VOIDS *Details = vfxcfg->vfxvars;
	void **vfxvars = SeekVoidsArray( Details );
	VFXBUF *vfxbuf = vfxcfg->vfxbuf;
	VFXVAR *vfxvar;
	uint i;

	linkVfxCfg( vfxcfg );

	if ( vfxbuf )
	{
		if ( Details->count < 1 )
			return drawVfxBuf( vfxcfg, vfxbuf, draw, instances );
		linkVfxBuf( vfxcfg, vfxbuf );
	}

	if ( vfxbuf->kind == VFXKIND_SHARED_INPUT )
	{
		for ( i = 1; i < Details->count; ++i )
		{
			vfxvar = vfxvars[i];
			if ( !vfxvar )
				continue;
			openVfxVar( vfxcfg, vfxvar );
			linkVfxVar( vfxcfg, vfxvar );
		}

		drawVfxBuf( vfxcfg, vfxbuf, draw, instances );

		for ( i = 1; i < Details->count; ++i )
		{
			vfxvar = vfxvars[i];
			if ( !vfxvar )
				continue;
			shutVfxVar( vfxcfg, vfxvar );
		}
	}

	return 0;
}

Edit 2: Added some, if not all, of the calls I forgot, however I’m running into a strange issue where
valid VFXTYPEs are somehow returning an empty VFXDEF object when the shouldn’t - wrapped code gets the empty object but not the general code of the shared library upon which that wrapped code relies on to get the objects in the 1st place - I’m going to consult another forum for this problem but I’ll add a link here in case there actually was someone curios enough or in the mood to help problems not directly related to opengl

Edit 3: Here’s the link:

After a lot of debugging & bug fixing plus plenty of api changes I’ve come back to my lack of triangles, I started by adding some debug only printf statements to check what was actually being fed into the opengl functions, some errors I managed to fix but others I could not from lack of understanding, here’s my filtered output, perhaps someone here can help me make sense of where I’m going wrong, I’d like to start with the uniform calls as they take up a lot of output:

make debug=1 run
...
cd ../../../../bin && ./check_extra.d.cc.elf
Opened module 'libvfxglfw.d.cc.so'
Opened module 'libvfxgl.d.cc.so'
Creating program '[vfxapp.flat]'
Bound './dragonbuilder/bin/shaders/spec.glsl' as point shader
Bound './dragonbuilder/bin/shaders/frag.glsl' as color shader
Linking program...
Testing program...
'(null)' expects 1 members
'UINTS' expects 2 members
'DINTS' expects 2 members
'FNUMS' expects 5 members
'DNUMS' expects 1 members
=============================================================[0] '(null)' vec4, name count = 1
glBindBuffer( 34962, 1 )
glBufferData( 34962, 96, 0x55c554124760, 35044 )
	[0][0] 'NulPoint' uint
var->loc = glGetAttribLocation( 1, 'NulPoint' )
glBindBuffer( 34963, 2 )
glBufferData( 34963, 24, 0x55c55412d5c0, 35044 )
glBindVertexArray( 1 )
glVertexArrayElementBuffer( 1, 2 )
glVertexAttribPointer( 0, 1, 5125, 0, 4, (nil) )
=============================================================[1] 'UINTS' uint, name count = 2
glBindBuffer( 35345, 3 )
glBufferData( 35345, 8, 0x55c55412e2d0, 35048 )
var->loc = glGetUniformBlockIndex( 1, 'UINTS' )
	[1][0] 'VtxCount' uint
	[1][1] 'FlatLine' uint
=============================================================[2] 'DINTS' int, name count = 2
glBindBuffer( 35345, 4 )
glBufferData( 35345, 20, 0x55c554127850, 35048 )
var->loc = glGetUniformBlockIndex( 1, 'DINTS' )
	[2][0] 'WinPoint' ivec2
	[2][1] 'WinSpace' ivec3
=============================================================[3] 'FNUMS' float, name count = 5
glBindBuffer( 35345, 5 )
glBufferData( 35345, 60, 0x55c554128490, 35048 )
var->loc = glGetUniformBlockIndex( 1, 'FNUMS' )
	[3][0] 'WinScale' vec3
	[3][1] 'RegScale' vec3
	[3][2] 'RegPoint' vec3
	[3][3] 'RegEmits' vec3
	[3][4] 'RegTakes' vec3
=============================================================[4] 'DNUMS' double, name count = 1
glBindBuffer( 35345, 6 )
glBufferData( 35345, 8, 0x55c554130a80, 35048 )
var->loc = glGetUniformBlockIndex( 1, 'DNUMS' )
	[4][0] 'dunused' double
==================Entering draw loop=====================
glBindBuffer( 35345, 3 )
glBufferData( 35345, 8, 0x55c55412e2d0, 35048 )
glBindVertexArray( 2 )
glBindBuffer( 35345, 3 )
glBindBuffer( 35345, 3 )
glUniform1uiv( 1, 1, 0x55c55412e2d0 )
source = GL_DEBUG_SOURCE_API, defect = GL_DEBUG_TYPE_ERROR, weight = GL_DEBUG_SEVERITY_HIGH, fromid = 2 (GL_ID_UNKOWN)
report = GL_INVALID_OPERATION in glUniform1("FNUMS.WinScale"@1 has 3 components, not 1)
glBindBuffer( 35345, 3 )
glUniform1uiv( 1, 1, 0x55c55412e2d0 )
source = GL_DEBUG_SOURCE_API, defect = GL_DEBUG_TYPE_ERROR, weight = GL_DEBUG_SEVERITY_HIGH, fromid = 2 (GL_ID_UNKOWN)
report = GL_INVALID_OPERATION in glUniform1("FNUMS.WinScale"@1 has 3 components, not 1)
glBindBuffer( 35345, 3 )
glUniform1uiv( 1, 1, 0x55c55412e2d0 )
source = GL_DEBUG_SOURCE_API, defect = GL_DEBUG_TYPE_ERROR, weight = GL_DEBUG_SEVERITY_HIGH, fromid = 2 (GL_ID_UNKOWN)
report = GL_INVALID_OPERATION in glUniform1("FNUMS.WinScale"@1 has 3 components, not 1)
glDrawArraysInstanced( 5, 0, 2, 4 )
glBindBuffer( 35345, 4 )
glBufferData( 35345, 20, 0x55c554127850, 35048 )
glBindVertexArray( 3 )
glBindBuffer( 35345, 4 )
glBindBuffer( 35345, 4 )
glUniform1iv( 0, 1, 0x55c554127850 )
source = GL_DEBUG_SOURCE_API, defect = GL_DEBUG_TYPE_ERROR, weight = GL_DEBUG_SEVERITY_HIGH, fromid = 2 (GL_ID_UNKOWN)
report = GL_INVALID_OPERATION in glUniform1("DNUMS.dunused"@0 is double, not int)
glBindBuffer( 35345, 4 )
glUniform2iv( 0, 4, 0x55c554127850 )
source = GL_DEBUG_SOURCE_API, defect = GL_DEBUG_TYPE_ERROR, weight = GL_DEBUG_SEVERITY_HIGH, fromid = 2 (GL_ID_UNKOWN)
report = GL_INVALID_OPERATION in glUniform(count = 4 for non-array "DNUMS.dunused"@0)
glBindBuffer( 35345, 4 )
glUniform3iv( 0, 9, 0x55c554127850 )
source = GL_DEBUG_SOURCE_API, defect = GL_DEBUG_TYPE_ERROR, weight = GL_DEBUG_SEVERITY_HIGH, fromid = 2 (GL_ID_UNKOWN)
report = GL_INVALID_OPERATION in glUniform(count = 9 for non-array "DNUMS.dunused"@0)
glDrawArraysInstanced( 5, 0, 5, 4 )
glBindBuffer( 35345, 5 )
glBufferData( 35345, 60, 0x55c554128490, 35048 )
glBindVertexArray( 4 )
glBindBuffer( 35345, 5 )
glBindBuffer( 35345, 5 )
glUniform1fv( 3, 1, 0x55c554128490 )
source = GL_DEBUG_SOURCE_API, defect = GL_DEBUG_TYPE_ERROR, weight = GL_DEBUG_SEVERITY_HIGH, fromid = 2 (GL_ID_UNKOWN)
report = GL_INVALID_OPERATION in glUniform1("FNUMS.RegPoint"@3 has 3 components, not 1)
glBindBuffer( 35345, 5 )
glUniform3fv( 3, 9, 0x55c554128490 )
source = GL_DEBUG_SOURCE_API, defect = GL_DEBUG_TYPE_ERROR, weight = GL_DEBUG_SEVERITY_HIGH, fromid = 2 (GL_ID_UNKOWN)
report = GL_INVALID_OPERATION in glUniform(count = 9 for non-array "FNUMS.RegPoint"@3)
glBindBuffer( 35345, 5 )
glUniform3fv( 3, 9, 0x55c554128490 )
source = GL_DEBUG_SOURCE_API, defect = GL_DEBUG_TYPE_ERROR, weight = GL_DEBUG_SEVERITY_HIGH, fromid = 2 (GL_ID_UNKOWN)
report = GL_INVALID_OPERATION in glUniform(count = 9 for non-array "FNUMS.RegPoint"@3)
glBindBuffer( 35345, 5 )
glUniform3fv( 3, 9, 0x55c554128490 )
source = GL_DEBUG_SOURCE_API, defect = GL_DEBUG_TYPE_ERROR, weight = GL_DEBUG_SEVERITY_HIGH, fromid = 2 (GL_ID_UNKOWN)
report = GL_INVALID_OPERATION in glUniform(count = 9 for non-array "FNUMS.RegPoint"@3)
glBindBuffer( 35345, 5 )
glUniform3fv( 3, 9, 0x55c554128490 )
source = GL_DEBUG_SOURCE_API, defect = GL_DEBUG_TYPE_ERROR, weight = GL_DEBUG_SEVERITY_HIGH, fromid = 2 (GL_ID_UNKOWN)
report = GL_INVALID_OPERATION in glUniform(count = 9 for non-array "FNUMS.RegPoint"@3)
glBindBuffer( 35345, 5 )
glUniform3fv( 3, 9, 0x55c554128490 )
source = GL_DEBUG_SOURCE_API, defect = GL_DEBUG_TYPE_ERROR, weight = GL_DEBUG_SEVERITY_HIGH, fromid = 2 (GL_ID_UNKOWN)
report = GL_INVALID_OPERATION in glUniform(count = 9 for non-array "FNUMS.RegPoint"@3)
glDrawArraysInstanced( 5, 0, 15, 4 )
glBindBuffer( 35345, 6 )
glBufferData( 35345, 8, 0x55c554130a80, 35048 )
glBindVertexArray( 5 )
glBindBuffer( 35345, 6 )
glBindBuffer( 35345, 6 )
glUniform1dv( 2, 1, 0x55c554130a80 )
source = GL_DEBUG_SOURCE_API, defect = GL_DEBUG_TYPE_ERROR, weight = GL_DEBUG_SEVERITY_HIGH, fromid = 2 (GL_ID_UNKOWN)
report = GL_INVALID_OPERATION in glUniform1("FNUMS.RegScale"@2 has 3 components, not 1)
glBindBuffer( 35345, 6 )
glUniform1dv( 2, 1, 0x55c554130a80 )
source = GL_DEBUG_SOURCE_API, defect = GL_DEBUG_TYPE_ERROR, weight = GL_DEBUG_SEVERITY_HIGH, fromid = 2 (GL_ID_UNKOWN)
report = GL_INVALID_OPERATION in glUniform1("FNUMS.RegScale"@2 has 3 components, not 1)
glDrawArraysInstanced( 5, 0, 1, 4 )
------------------------------------------------------
...
------------------------------------------------------
Compilation finished successfully.

Edit: Here’s a link to the relevant code for the above output:

I’ve made quite a few changes, some things to fix bugs, some things to split code off into it’s own more abstract sections, some things to make visualising the shader tree easier, and also an interrupt in the debugging function opengl calls to help track the source of errors, I’m still getting errors with the uniforms but now the program at least stops on the 1st one and prints the opengl calls leading up to said call with the path & line to those calls added also so if someone still feels like helping then you can download the entire project here:

And just run either “make test” or “make gede”, I haven’t gotten round to setting up gdb debugging so test just runs the debugging executable as is, gede you would have to install if it’s not already, it’s a GUI for gdb and it’s the best GUI I’ve experienced out of all the GUIs I’ve tried, the gede target will build all the executables & libraries and run the chosen trial executable’s debug version under gede, I recommended going with “make test > test_goal.txt” first if you’re gonna use gede as gede still has some issues with the output box, not easy to scroll up, but navigating the call stack is much easier with gede than with gdb which is why I still use it.

I’m gonna make myself something to eat whilst hoping someone here is feeling helpful enough to look and see what I’m doing wrong (still in single threaded mode atm - barring what opengl launches that is), since I’ve yet to work it out myself

Finally found a useful guide that actually EXPLAINS UNIFORM STRUCTS, not once in all the opengl guides I’ve found did they ever explain how to fill a uniform struct member, they just declared it but completely skipped by the explanation of how to fill it.

Yes, not once in all the tutorials do they ever explain how to fill in a UBO. They all just skipped it.

Oh, and as a bonus, that video contains misinformation. vec2 is always aligned to 8 bytes, but his example has it misaligned, starting at byte 4. vec3 is always aligned to 16 bytes, but he also has it misaligned, starting at byte 12.

So, maybe don’t try to scold the OpenGL community for not delivering information properly by showing off a video that contains flagrant errors.

For starters I’m not concerned with his incorrect offsets, I’m concerned with the exact call process of filling the struct, now that I know what I was actually looking for, yes I can see it’s included as a barely noticeable footnote, great job camouflaging the most important information of filling a uniform struct, great way to help developers jump into opengl (please note the sarcasm), I’ll stick to recommending guides (whether they have errors or not) that actually explain things clearly.

The video spends well over 10% of its 6-minute runtime on size and alignment rules of std140 layout. If that is a “barely noticeable footnote” to you, then perhaps you should re-evaluate how you define that concept.

Great job ignoring all of the tutorials I listed which explain the exact same thing, only without the errors.

Explaining the wrong stuff clearly is the most effective way to misinform people.

That 10% doesn’t matter, the vid got straight to the point at the start which is what I watched before making my post, as for the errors if a developer can’t work out offsets and the like for themselves then they’re not ready for graphics programming anyways, sure if I noticed those details I didn’t care about then I would’ve mentioned them but my point stands that unclear guides, no matter how accurate, are less helpful than clear guides even if those guides have errors in them. It’s like that wikileaks issue that john oliver did a interview for, few understood the severity of it until he brought up dick pics getting caught up in it, even though dick pics clearly aren’t the target, they still got the people’s attention, presentation matters a lot more than accuracy when you’re trying to convey something.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.