#πͺ -progaming
1 messages Β· Page 83 of 1
π
Java clases can have association, inheritance, dependency, composition, etc these are ways that created objects interact with other objects
yeah
Sounds like something someone very bored made up
can we have a dynamic version of javascript called javascriptscript
It's literally java API
isnt that literally all of object oriented programming
^
java.applet.Applet api my beloved
I love oop so much
wait so then @royal nymph why have generics at all are they literally just like "type hints" in python
I deal in programming, not bored people's fantasies
means you don't have to cast everywhere
It's programming πππ
oh i think i see
without generics you need to do this
List list = new ArrayList();
String thing = (String) list.get(0);
π
they are still meaningful and better than using Object aka any type that you always have to cast
I believe it's essentially syntax sugar for that
to be fair it kinda makes sense that its fake because java is a dynamic language
just like how typescript types are fake
java does not allow duck typing
only for generics (kinda) 
as soon as you try to get any data it fails though
you don't even have to assign it
i don't think type confusion is really possible in java without extreme hackery
i don't think reflection will allow you to pass in the wrong type
i think to break java's memory safety you would need unsafe
I've accidentally passed invalid types to interface-typed parameters in bytecode
It's not caught until you try to call a method
but it still wouldn't break the memory safety, you would get an exception
Yep
yeah that it can't
is this with methodhandles
but reflection can cause a lot of other cursed stuff
you can write final fields with reflection
But writing to static final fields of primitive/String type does nothing
Since they're inlined
using reflection on the reflection api to trick it that it's not final
but java 9 broke
also with usafe you can do shit like instantiate classes without calling their constructor
but once you're using unsafe you're down the deep end anyway 
yes
ReflectUtils.java: Lines 235-253
public static void setFinalField(@NonNull Class<?> clazz, @Nullable Object instance, @NonNull String fieldName, @Nullable Object v) throws NoSuchFieldException, IllegalAccessException {
if (accessFlagsFields == null) {
try {
accessFlagsFields = Field.class.getDeclaredField("accessFlags");
} catch (ReflectiveOperationException ignored) {
try {
accessFlagsFields = Field.class.getDeclaredField("modifiers");
} catch (ReflectiveOperationException ex) {
throw new RuntimeException("Failed to retrieve accessFlags/modifiers field", ex);
}
}
accessFlagsFields.setAccessible(true);
}
var field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
accessFlagsFields.set(field, field.getModifiers() & ~Modifier.FINAL);
field.set(instance, v);
}
i thought java 9 broke this
this is for androd
wait is android s tuck on java 8
you mean jdk I assume
java has no relevance in this
jre and jdk
the runtime is what matters
Android doesn't use jdk
idk much about jdk
jdk is cringe and restricts reflective access to internals

Openjdk is an implementation
isn't there hotspot and j9 and stuff
idk i have expert vague understanding of java
wtf is Class<?>
Same as Class<Object> but less type safe
isn't ? short for ? extends Object
so it accepts anything other than Object
or is that wrong
Class is the parent type of all classes (the class itself, not its instances)

Why are java classes instances of a generic Class class
<> is generic
Uh, what
<?> is like any generic
wait that has to be wrong
i swear i had issues where i could not put an <Object> value into a <?> value
π
the Class class is like the metaclass for classes

actually not even that
it's hard to explain lol
Yes, java.lang.Class is final
String.class is an instance of java.lang.Class
not a subclass
the type is Class<String> though
i am kinda rusty but i think that's right
Class<String> is a subtype of Class<?>, but not a subclass
i wouldn't consider it a subtype so much as a type which fits into it (assignable type)
Yes, that's what subtype means
Class<String> is like a reflective representation of the String class
Class<String> stringClass = String.class;
you can use it to query information about the class, look up methods, constructors, etc
it allows you to write dynamic code for example
as in call methods from strings

load classes from strings
ClassLoader.defineClass my beloved
wait so why is it generic when generics are fake
it allows things to be typed
Generics pretend to be real
insane behavior
nah you have to
/run
public class Main {
public static void main(String[] args) {
"".__proto__.toInt = Integer::parse;
System.out.println("4".toInt());
}
}
java pro tip
@winged mantle I only received java(15.0.2) error output
file0.code.java:3: error: cannot find symbol
"".__proto__.toInt = Integer::parse;
^
symbol: variable __proto__
location: class String
file0.code.java:3: error: method reference not expected here
"".__proto__.toInt = Integer::parse;
^
file0.code.java:4: error: cannot find symbol
System.out.println("4".toInt());
^
symbol: method toInt()
location: class String
3 errors
error: compilation failed
actually you don't have to cast yeah
v you should take an iq test
why
java iq test
Am I that stupid..
i remember somebody being wrong about c++ and i ended up making like 4 example programs to show each time they got something wrong
so ```java
void foo(Class<?> clazz) {}
is synonymous with
```java
void foo<T>(Class<T> clazz) {}
```???

<T> void foo(Class<T> clazz) {}
close enough idk java syntax lol
you don't write generics like that
but is the concept right
:german:
that's not how u declare generics in java π€

also yeah in usage they're the same but they are still different
so ```java
void foo(Class<?> clazz) {}
is synonymous with
```java
<T> void foo(Class<T> clazz) {}
```???
can you readd the german emote
i swear it was here
somebody sent when i said i was using openbox wm with no panel
they're not really synonymous no but in this case the method is called the same
the first method isn't generic at all
does java have covariance
wait so ? is only a placeholder in arguments?
Yes, List<? extends Foo> is covariant while List<? super Foo> is contravariant
? is like a generic wildcard
but isnt <T> with no constraints also a generic wildcard???
why does ? need to exist
no it isn't
so you don't need to add a generic param to the method?
T is a generic type
How would you declare a List<T> in a non-generic function
you can use ? anywhere
hmm i see
List<?> list = idgafWhatsInThisList();
ok that makes sense
how does it differ from List<OBject> this has always confused me
im thinking of this from a static typing standpoint but i forgot java doesnt actually care about the inner type of generics
cause you have to cast to List<Object> don't u?
i think you do
i swear this did not work last time itried
/run ```java
import java.util.*;
List<Object> list = new ArrayList<Integer>();
@royal nymph I only received java(15.0.2) error output
file0.code.java:4: error: incompatible types: ArrayList<Integer> cannot be converted to List<Object>
List<Object> list = new ArrayList<Integer>();
^
1 error
error: compilation failed
yeah see
you have to cast to List<Object>
Here is your java(15.0.2) output @winged mantle
15.0.2
/run
import java.util.*;
List<?> list = new ArrayList<Integer>();
cause that's not safe
Your java(15.0.2) code ran without output @valid jetty
ohh
ok that makes sense
trueee
i get it now
Object is like any in typescript (but you have to cast to get to it)
? is like unknown
yeah
cause you can assign anything to object
List<Object> list = intList;
list.add("Hi");
the second line is valid
if the cast was allowed this code would pass but fail at runtime
wouldn't it be valid with ? too though
no
I think
/run ```java
import java.util.*;
List<?> list = new ArrayList<Integer>();
list.add("hi");
/run
List<Integer> intList = Arrays.asList(1, 2, 3, 4);
List<?> list = intList;
list.add("hi");
System.out.println("bazinga");
@royal nymph I only received java(15.0.2) error output
file0.code.java:5: error: incompatible types: String cannot be converted to CAP#1
list.add("hi");
^
where CAP#1 is a fresh type-variable:
CAP#1 extends Object from capture of ?
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
error: compilation failed
@winged mantle I only received java(15.0.2) error output
file0.code.java:2: error: cannot find symbol
List<Integer> intList = Arrays.asList(1, 2, 3, 4);
^
symbol: class List
location: class temp
file0.code.java:2: error: cannot find symbol
List<Integer> intList = Arrays.asList(1, 2, 3, 4);
^
symbol: variable Arrays
location: class temp
file0.code.java:3: error: cannot find symbol
List<?> list = intList;
^
symbol: class List
location: class temp
3 errors
error: compilation failed
CAP#1
my beloved
yeah it doesn't let u do it
i swear i never saw an error saying CAP
i think it was more verbose
idk
i useed eclipse ide for years

i remember now getting errors about captures
/run ```java
import java.util.*;
List<Object> list = (List) new ArrayList<Integer>();
list.add("hi");
@royal nymph I only received java(15.0.2) error output
Note: file0.code.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
fuire
yeah see that works
that's because you're duck typing
yes but this is why you have to explicitly cast to List<Object> xd
i understnad now
List<?> is safe, List<Object> isn't
@hoary sluice do you know about higher ranked trait bounds
The Dark Arts of Advanced and Unsafe Rust Programming
lol I am remembering this java project I made
(I was trying to create a fully fledged piece of software when i was like 15
)
it comes with solarized dark theme...
wait did i really create a http library too
i can believe that you manually typed out every single http code's name
who said manually
this is where vim-like shortcuts rock
i was using eclipse ide
this was during lockdown
i used to do that too lol
i was probably like 13 or 14 back then
i just use whatEverThisIs
camelCase
camelCase
i made so many webapps with xss
i basically just did fs.readFileSync("filename.html").replace("$CONTENT", content).replace("$USERNAME", usernamew)
objc_CursedCaseAkaMixedCase
this is where ai is goated
these days my github followers fluctuate between 99 and 100 i don't get it
back then i had no followers
when somebody followed me i felt like stalking was a more appropriate word
or just copy paste a table from Wikipedia or smth and use ide shortcuts to turn it into code

@winged mantle I used ai to refactor venapp code to jsx
copiloter
HORROR
i would do it manually or use a jscript with regex
i remember one time using xdotool to export many images from gimp

i love this bug
Good ol' cve-rs
would a good architecture for a jason parser be to have a function to read the next token and it returns a union of boolean, number, string, array start, array end, object start, object end, comma
or is that dumb
a fucking what parser?
jason parser
i mean json
pov: jason parser
ugh it feels weird that comma would be token that's all
The specific list of tokens varies from parser to parser though
tsoding π
Depends on how zerocopy you want to be
or maybe you'd then tokenise that separately
The obvious way would be "Foo\nBar" as ```
StrStart,
StrChunk("Foo"),
StrEsc('\n'),
StrChunk("Bar"),
StrEnd,
you should be doing whitespace trimming in your lexer anyway lol
whitespace denotes separation but should be removed when actually parsing
what if json had significant whitespace
wait
so toml
pon
jon
i already had the jon idea
parse syntax like
new Map() {{ put("key", "value"); }}
that would be so fire
wait can you do Map.of
chloe moment
MAD cuz jealous
how do i access
gave you perms
Sure, manually implemented vtables are pretty common
our resident idiot <3
struct InputSource {
char (*read)();
}
rosie is like 12
and then make a FILE based InputSource which implements buffering
and String which just moves cursor

you arent in the server smh
what serverβ
β
evil
β
β
η΅΅εΈ[η«ART]
β 15:48
β
i forwarded the message from another server π
Roie π»
i know π
click here: [π No Access]
η΅΅εΈ[η«ART]
β 15:48
β
maybe i should call this lib jay instead
people might think i'm weird for being obsessed with jason citron
Emoji not found. The emoji set chosen might not have this emote as an image.
Emoji not found. The emoji set chosen might not have this emote as an image.
horror
vprune by bots 3
guh why is before: 2021 barely doing anything
i wanna filter ai slop
searching about tokenization has loads of ai results
watch the tsoding combinators video
Twitch: https://www.twitch.tv/tsoding
GitHub Repo: https://github.com/tsoding/haskell-json
My Haskell Setup: https://www.youtube.com/watch?v=5p2Aq3bRuL0
Unusual video this time. This is a slightly edited recording of my Twitch stream. Initially I planned to make a regular video on this topic, but quickly realized that it's just way too much mat...
why not split number into tokens
why not have exponent as token 
i have already written a json parser before i just did not conceptualise and separate the process of tokenisation
What would be the benefit
whaty's the benefit of tokenisation for something as simple as json

the point is numbers have separate parts
the negative sign
the exponent
What would be the benefit of that, other than making parsing harder?
well. it feels weird to do this for strings but not numbers
but fair
i guess at the tokenisation stage you need to recognise escapes in strings
with numbers you can just read until the next char which is not relevent
thank you for all the advice
is it bad to do barrel file in c
oh wait
Do you need special woodworking tools for making barrels??
just separate .c files
i mean like json.h file which includes all headers
like barrel file in js
file which does nothing apart from reexport
c modules support when
cpp modules are fire
it just occured to me that in c i don't think you can bind functions

Can't do much without a self yeah
thank
welp i made gemini shit itself
even AI cant handle service workers
telling it, try again or 12 orphans will die fixes the problem
sorry
c would be so much better if strings were like this
struct str {
int len;
char *d;
}

Rust says hi
this would basically be like string slice
whatβs stopping you from just making this
Or std::string_view
at first i thought of
struct str {
int start;
int len;
char *d;
}
but srting slices aren't generally aware of the whole string, are they?
roieeee
and that also would be annoying
If you did that you'd need to store the original length as well
not..really?
That'd be messy and useless
you would need to do d + start
create a new str struct with the offset pointer
and a len-start len
i think just length and string is fine
wait how does string_view in cpp work
what if the source string gets deleted
makes sense
string_view is like &str where string is String
i was thinking you could add to reference counter.. but c++ strings are like unique_ptrs
if you know rust
The standard doesn't guarantee that
Some std::string implementations do indeed refcount I think
i think qstring does
i have mainly programmed with qt

why is there no | NULL type in C
(this is a joke)
π
π
but the problem with using your own strings in the stdlib does not support
That's ok, c++ stdlib is crap anyway
C
C barely has a stdlib
@valid jetty what is starting nginx on my server
#define str_to_cstr(x) (str_append(x, '\0'), x.d)
mutates...
do you have systemd? it could be that
why is there no man entry for bufsiz
Wtf is bufsiz
you mean i can't just use man as C google
it's your siz of your buf innit
yop it was a service
buffer size
nice
lol public exec endpoint
https://horizon3.ai/attack-research/disclosures/unsafe-at-any-speed-abusing-python-exec-for-unauth-rce-in-langflow-ai/
nah its way more than that
that endpoint is giga sanitised, they just overlooked that python decorators can run code
because python
don't use ai garbage and that won't happen
again if you read the code for more than a quarter of a second then you'd see its not ai garbage
no im calling langflow as a product garbage
they had to work around dogshit problems in python with dogshit python solutions
just because python's ast doesnt process imports correctly
woeful
the fact is has comments is a red flag
a real experienced programmer human would write this confusing code with no comments

i have no idea if this is undefined behaviour 
maybe i should just allocate buffer separately
wtf is this
@valid jetty we need to hold a who knows more italian brainrot animals competition
@valid jetty im scared, i vibe fixed my parser and it works now
on monday i will wake up and my parser will have exploded
woohoo you can remove the parens now
shiftLeft x n = x * 2 ** n
shiftRight x n = x / 2 ** n
shiftRight (shiftLeft 2 8) 8
instead of
shiftLeft x n = x * 2 ** n
shiftRight x n = x / 2 ** n
(shiftRight (shiftLeft 2 8)) 8
@fleet cedar @valid jetty i remember some language had a parser that had significant whitespace for unary -, so foo - x would be a binary op and foo -x would be passing -x to the function foo
is that
or 
Haskell does that with an optional feature flag
apparently like all of the popular functional languages do that
isnt it the default?
i cant find a lot of info on it
I can't find anything about whether that's on by default though
yea should i do this
genops.c: Lines 326-349
if (_IO_vtable_offset (fp) == 0 && _IO_fwide (fp, -1) != -1)
return EOF;
if (fp->_mode == 0)
_IO_fwide (fp, -1);
if (_IO_in_put_mode (fp))
if (_IO_switch_to_get_mode (fp) == EOF)
return EOF;
if (fp->_IO_read_ptr < fp->_IO_read_end)
return *(unsigned char *) fp->_IO_read_ptr++;
if (_IO_in_backup (fp))
{
_IO_switch_to_main_get_area (fp);
if (fp->_IO_read_ptr < fp->_IO_read_end)
return *(unsigned char *) fp->_IO_read_ptr++;
}
if (_IO_have_markers (fp))
{
if (save_for_backup (fp, fp->_IO_read_end))
return EOF;
}
else if (_IO_have_backup (fp))
_IO_free_backup_area (fp);
return _IO_UFLOW (fp);
Please light that on fire
i think i will just use fread
im so glad im using rust
i barely have an understanding of threading maybe i should learn it more sometime

does anyone truly understand threads
or do they just pretend to
Wanna see something cursed?
elle had that when i first started working on it
yes
because it was easier to parse
/run ```java
\u0053\u0079\u0073\u0074e\u006d\u002e\u006fu\u0074\u002e\u0070\u0072\u0069\u006e\u0074\u006c\u006e\u0028\u0022\u0048e\u006c\u006c\u006f\u002c\u0020\u0057\u006f\u0072\u006cd\u0021\u0022\u0029\u003b
Here is your java(15.0.2) output @fleet cedar
Hello, World!
its not about easier parsing it just removes the requirement for () for unary epr
expr
is that not making it easier to parse
does this bot run strings through eval(f"\"{str}\"")
no cause sometimes its just ambiguous
foo x (-3)
other way around
No, bot isn't doing anything weird
That's just regular java
foo (x - 3)
no
i would win
Bot does add public static void main though
well ok i didnt specify that you dont have an F35
itβs so cool
itβs basically
generic lifetimes but on steroids
to put it simply, you can define an Fn trait item on a trait impl, and that trait item may take an argument which has a lifetime, but youβll only know that lifetime when calling the function, even though the lifetime has to be somehow specified trait wide for than Fn trait item
i use literally 0 lifetimes anywhere besides impl debug and display
so the solution is that higher rank trait bounds
this sounds super niche
you have a for<'a> Fn(&'a i32) and you can specify this lifetime trait-wide rather
for any trait 'a, that is the Fn trait item that type T is
this is just not an english sentence
itβll just infer the lifetime that youβre talking about at the call site
@fleet cedar can you explain this simpler lmao
itβs an advanced concept itβs kinda hard to explain simply
iβll try to explain via code examples when i get home
iβm currently out at the front of my school at 9pm ππ
I have never written a hrtb in my life
i think im mainly having trouble understanding this because ive never seen the syntax for<'a> for normal lifetimes either
but itβs still a cool concept to know
this just sounds extremely useless
@valid jetty omg hiii
oh its literally just Fn(&'a str) where 'a is predefined in the trait vs Fn(&'a str) for all 'a
ok
fn foo(x: &i32) { dbg!(x); }
fn main() {
let cb: for<'a> Fn(&'a i32) = foo;
{
let tmp = 3;
cb(&tmp); // lifetime &'a
}
{
let tmp = 4;
cb(&tmp); // lifetime &'b
}
}
``` itβs a way to concretely type this
what is cb
(yes itβs not just useful in traits)
callback, just a placeholder name
yea i understand it
ππ
thats.. exactly what i said
.
oh was steroids the joke here
is it on steroids because hrt or is it on steroids because its somehow better than just generic
both
how is it not just a normal generic
normal generic lifetimes are generic function-wide or trait-wide and this just lets you specify that some type is generic over ANY generic lifetimes
itβs like a level above generic lifetimes
because instead of saying you have an 'a for the duration of the function or trait, youβre saying you have a lifetime you donβt know yet but will when you call the function
itβs really hard to explain this lmao
its not
instead of it being generic on the trait its generic on the function
The trait bound itself is generic
its literally just β'a
Yes
yeah thatβs a good way to put it
Hence why it uses for keyword
yep
^
for all analogy
What would be the difference
wait are they equivalent in this case
well itβs like βfor all 'a that this Fn trait item is called withβ
which is essentially βfor anyβ as far as the type system is concerned
It's just a for all
tbh i donβt know the formal difference but iβm sure mathematicians had nothing better to do than prove that they are different
This seems to depend on the context: "For all xβX P(x)
" is the same as "For any xβX P(x)" On the other hand "If for any xβX P(x), then Q" means that the existence of at least one xβX with P(x) implies Q, so P(x) doesn't need to hold for all xβX to imply Q.
One of them is a mathematical term, the other is not
"For any" is an english phrase, not math
who defines that
Convention
im gonna put for any in a proof and you cant do anything about it
anything can be a mathematical term if you use it in a paper and people cite it enough
there seems to be many interpretations of for <insert word referencing every element> https://math.stackexchange.com/questions/430646/difference-between-for-any-and-for-all
i could call the theory of everything βski bidi ri zzβ (idk if those words are filtered) in my next paper and if people cite it in future papers itβs now a mathematical term
i wil make the elementary arithmetic operators the following: + - tralaleroTralala / ** %
I remember in some uni lecture the professor redefined the symbol 4, just to show he could
lol
lmao
iβm sure βfor anyβ is definitely used throughout mathematical papers though
iβm willing to bet money that there are papers that use the exact phrase βfor anyβ
im willing to bet money that the sky is blue sometimes
Since most papers are written in english, that seems exquisitely likely
also you dont have any money
Did you plunder her
yop
@valid jetty huiii
https://pastebin.com/n1z19Vb5 docker compose file for vencloud + valkey + behind traefik
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
holy π https://chatgpt.com/codex
Introducing Codex: a cloud-based software engineering agent that can work on many tasks in parallel, powered by codex-1. With Codex, developers can simultaneously deploy multiple agents to independently handle coding tasks such as writing features, answering questions about your codebase, fixing bugs, and proposing pull requests for review.
guys does this make me a good dev? im removing more code than im adding!1!1!!!
Does anyone know how to OpenGL cuz I can't figure out deferred lighting
https://pastebin.com/KdrRLuTi here's my best attempt (only displays black, hiding anything rendered before)
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Have you tried rendering out the separate layers into the window?
how do
because I'm currently trying to render them all to the window
Essential debugging
I know the G-buffer is fine at least
but trying to render only the ambient lights is still black (and still erases all drawn content)
No I mean like, can you render the gbuffers to the window to debug it?
Without the actual lighting passes
I'm on the train and the 4G is dying
kotlin game engine??

gigabased
I mean it'll only show the gPosition as color but that part works fine
So what part is busted?
either the way I set up my gbuffer backing textures or the way I bind them to the light shader or the light shaders or the blending or the
Also, do you have a debug output wired up yet?
I don't know anything opengl so half of this is just LLM stuff
Like, for debug error message
Oh, nvm
I mean I can run it with renderdoc
wdym?
Heretic.
I didnt know opengl did error messages other than just printing to stdout
Go purchase the OpenGL Superbible 7th edition right now.
Opengl can give you asynchronous debug output for errors
Or general messages
it doesn't crash or report to stdout rn tho, when there's a problem it usually does
How is it even printing to stdout
Get the OpenGL Superbible and just read it
Find a pdf if you're unable to afford a physical copy

Just read it and follow the examples provided there
but all opengl docs are written as if you understand opengl already
idk what a vertex or renderbuffer or framebuffer or other stuff is
Because you opened the unfunny docs
Anyway if you don't know what a vertex is I think you're cooked
I know it's different from a fragment at least
cuz they both have different shaders
There's a lot of stuff but likr
If you make it using AI then it will uh
Explode
I can help explain terms but I will not fix code
ok whats a g buffer, depth buffer, render buffer, draw buffer, frame buffer
and the like differences
and how does opengl know which one to use
A gbuffer is an abstract concept, it's a "geometry buffer" and what you usually draw the geometry onto in the middle stages of a deferred renderer
A framebuffer is a container which describes a buffer onto which you render. It has textures and renderbuffer attachments.
Renderbuffers are special "write-only" textures, you need to blit (manually copy) stuff from them if you ever want to read.
But, they are useful for depth testing.
A depth buffer is a greyscale image that is used to store depth. Depth here means how close or far away from the camera something is.
How does opengl know which to use? Framebuffers are used to describe what you're gonna draw onto etc, but the rest is more when you decide to use em

So in a deferred renderer, you create a set of textures. These are your gbuffers. You take these textures and you attach em to a framebuffer. That's your rendertarget.
You can now render stuff with the shader to these textures if you bind that framebuffer beforehand.
Once you're done rendering stuff to it and want to light up the scene, you bind these textures as samplers and another framebuffer for the output for the light or whatever.
Once you're done with the lighting, you bind the window framebuffer (framebuffer zero is the window one usually), and render the final output there.
Generally the way a deferred renderer works
ok I think that's what I do (except I draw light passes all to window framebuffer directly with gl blending on)
That also works
but then why no work
Works if everything is correct
Peek this
I'm assuming you're using LWJGL3 bindings with Kotlin, and that should have bindings for this included
This will let you route all errors to stdout, with stacktraces
There's some stuff during model loading:```
33350 33361 131185 33387 Buffer detailed info: Buffer object 160 (bound to GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB (0), GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB (1), GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB (2), and GL_ARRAY_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations.
33350 33361 131185 33387 Buffer detailed info: Buffer object 161 (bound to GL_ELEMENT_ARRAY_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations.
But nothing during each draw step
i wish this would work :(
executable/.. does not seem to resolve to the directory the executable is in
nvidia drivers on windows detected lmao
argv[0] is just a random string that's conventionally a path to the executable
There was some systemd tool or something that had a security vulnerability because it assumed argc >= 1
it pretty much always is
i guess i will allow any path to be passed in
this is just an example executable
to test the lib
enough to allow relying on it (unless youre systemd ig)
On linux the exe path can be found somewhere in auxv I think, or readlink(/proc/self/exe)
On windows there's some api for it but I don't know it by heart
realistically the only way for argv[0] to not be the path is if you purposefully make it not the path, and if the software only uses the path for usage then theres no problem with it
(in the makefile)
based
idk how you would make it generate a dll tbh
just dont
how would makefiles even work on windows
just dont support windows
or what if the distro doesn't have a mkdir command for example
if a windows user wants to use my software they can either switch to linux or pay me to port it to windows
why are you using mkdir for that
you mean in the makefile?
you just dont use windows its as easy as that
if someone uses a distro so obscure that it doesnt have mkdir preinstalled they can either install/alias mkdir or make it themselves, this isnt something you have to worry about
developers who develop on linux and then say "sorry cant fix windows issues" are so annoying
still what about windoze
Is this the shader ur using to render the initial geometry?
i would first think you'd build in wsl
cry about it
but then you'd still be building a so
i was forced to use windows for an internship last year
genuine torture
I'm more of a I don't look for bugs on windows but if someone reports one I'll take a look kind of guy
so i imagine there's some ports of make to windows which also have some port of sh and coreutils

should be illegal
the prism launcher modrinth pack export was broken for some time because i never tested on windows
companies who force operating systems are insane
yop
its a war
they force me to use windows
i make linux only software
like imagine getting some job and you never used windows or macos before and they just expect you to learn to use it within 2 weeks

in the name of "corporate security"
use freebsd
their threat model is "someone who got fired and is angry will publish the code from their linux computer, if we give him a windows machine we can lock it before firing him"
no thats the fragment shader for the ambient light shader, the geometry shader is:
can't you lock down linux machine too...
its one of those "digital transformation" companies that contract services for random companies, some of which require nda
digital renovation
easier to bypass
if a company doesnt allow you to use your own laptop or your own os theyre generally evil and should not be worked for
epic
so dump the output this framebuffer onto the screen, or to an image or whatever
to validate their outputs
why dont you import it from a file
I will eventualllyβ’οΈ
I already did, and I know it's correct (color is the gPosition value iirc)
And the normals?

how do I show those
layout (location = 0) out vec4 gPosition;
layout (location = 1) out vec4 gNormal;
layout (location = 2) out vec4 gAlbedoSpec;
layout (location = 3) out vec4 gTangent;
layout (location = 4) out vec4 gBitangent;
Whatever texture is in loc 1
@valid jetty https://youtu.be/xP5-iIeKXE8
A video of Conway's Game of Life, emulated in Conway's Game of Life.
The Life pattern is the OTCA Metapixel: http://www.conwaylife.com/wiki/OTCA_metapixel - for more information, see http://otcametapixel.blogspot.com.au/
The life simulator used is Golly - http://golly.sourceforge.net/ which has a built-in script to generate these metapixel gri...
If lighting is broken, validate the TBN values. So Normals/Tangent/Bitangent
so I just swap location=0 and location=1?
if you have render doc you should be able to just, find that texture and render it
one sec
And the T and B ones look different?
but the model data shouldn't matter because the ambient shader should essentially just be a solid color
T and B?
Tangent/Bitangent
ah
anyway, send over the fragment shader for the actual render output then
yep, this looks correct.
I mean the pastebin has all the fragment shaders
it's in this yucky blob
@Language("GLSL")
private const val LIGHT_VTX_SHADER = """
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aTexCoords;
out vec2 TexCoords;
void main() {
TexCoords = aTexCoords;
gl_Position = vec4(aPos, 1.0);
}
"""
private val ambientLightShader = Shader(LIGHT_VTX_SHADER, """
#version 330 core
uniform vec3 ambientColor;
uniform sampler2D gAlbedoSpec;
in vec2 TexCoords;
out vec4 FragColor;
void main() {
vec3 albedo = texture(gAlbedoSpec, TexCoords).rgb;
FragColor = vec4(ambientColor * albedo, 1.0);
}
""".trimIndent())
val ambientLights = lights.filter { it.type == Light.LightType.AMBIENT }
val ambientColor = ambientLights.fold(Vector3.ZERO) { acc, light ->
acc + light.color * light.intensity
}
ambientLightShader.use()
ambientLightShader.setUniform("ambientColor", ambientColor)
ambientLightShader.setUniform("gAlbedoSpec", 2)
renderFullScreenQuad()
So the vertex shader is just a passthrough meant to be used with a fullscreen pass
Have you tried on the ambientLightShader FragColor = vec4(1.0, 0.0, 0.0, 1.0) ?
Should make the whole screen red.
Just validates that you're doing the full-screen pass at all
Next I would:
FragColor = vec4(1.0, 0.0, 0.0, 1.0);
FragColor.rg = TexCoords;
Nope. that's what i expected to see
but it should also be rendering the stuff I rendered before, no?
cuz I have blend enabled
You're doing a full-screen pass with red and alpha one, most blend functions will just treat it as full opaque
glEnable(GL_BLEND);
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_ONE, GL_ONE);
// render to gBuffer
// bind textures
// ambient light pass
oh
how do I fix that

Learn OpenGL . com provides good and clear modern 3.3+ OpenGL tutorials with clear examples. A great resource to learn modern OpenGL aimed at beginners.
This example uses glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Without setting the blend equation

But yeah, validate that this shows you the expected UVs
but that requires stuff to have an alpha
Yeah?
Ok, your UVs are perfect.
but the magenta floor (regular render pass) has no alpha and the car model (deferred lighting render pass) has no alpha
My question is why do you intend there to be alpha to begin with?
wdym?
i saw this, this is insane
Why do you need blending enabled?
because wont every light shader overwrite all old data otherwise
Oh, you're trying to mix the color data from multiple shaders?
well
yeah
thats how deferred lighting works isnt it
one pass from ambient, one from each directional and one from each point
- all the data that was rendered before the gbuffer/light passes (e.g. skybox, debug objects, etc)
Deferred gives you a lot of freedom, but mixing is generally done in post
Like with lights, the power of deferred is that you can do the lights all in one big go
how does that work in one big go?
because best I could find with a single shader is a hardcoded limit on lights
Do you know how deferred is different from forward?
but modern game engines support up to millions of lights
deferred is doing it on the 2d view based on the depth data and stuff iirc?
and forward is doing it as part of the vertex/fragment shader for the object I believe
that's what I understood from the wiki page at least
and because you're dealing with a simpler view deferred is faster (and can do any number of lights)
Forward is "what you see is what you get" lighting. Both can do "any number of lights", but the optimization strategies and pros/cons differ.
Like with forward, you light the geometry as it's being rendered.
With deferred, you split the info about the geometry into 'gbuffers' and 'do it later'

The "one big go" has to do with you being able to treat the gbuffers as all the geometry as a set of textures.
So a single lighting pass can do all the lighting at once.
gbuffers -> (big fat lighting shader) -> window
Is the simplest
ic
wait but then how does the big shader know how many lights there are and what types of lights, without hardcoding a limit
I thought the point of deferred lighting was to not have a limit
There is always a limit. Deferred is just one of the ways of having a higher limit.
ic
also wait
if you have everything as a texture
how do you deal with reflective surfaces
cuz you'd need to know what's behind a wall in order for a mirror showing what's behind it to work
Screen space trickery
or is that where you cheat and put a camera in the mirror, then render that camera output as texture on the mirror
What's behind that wall? You've discovered one of the limits of rasterized rendering

Raytraced, or one of the tricks to get around it to fake it.
Depends on performance targets
If you wanted to have "no limit" you can technically do the similar multi-pass you were suggesting, but then you need to have a seperate "luminance" gbuffer.
But you should still have a "hard-coded" limit per pass, so each pass can do more than one light at a time.
surely modern gpus can do 4k@60 raytraced tho, we've had RTX GPUs for like 6 years

void main() {
vec3 albedo = texture(gAlbedoSpec, TexCoords).rgb;
FragColor = vec4(albedo, 1.0);
}
Anyway with this and disabling blending, you should at least see "something" on the screen.
gAlbedoSpec comes from ```
vec4 diffuse = material.diffuse * VertexColor;
if (hasDiffuseMap) {
diffuse *= texture(diffuseMap, TexCoords);
}
// Specular color
vec4 specular = material.specular;
if (hasSpecularMap) {
specular *= texture(specularMap, TexCoords);
}
// Store diffuse and specular components
gAlbedoSpec.rgb = diffuse.rgb;
gAlbedoSpec.a = specular.r; // Store specular intensity in alpha
hmm yeah gAlbedoSpec is black
set gAlbedoSpec.rgb = diffuse.rgb; to gAlbedoSpec.rgb = vec3(1.0, 0.0, 0.0); for more red debudge
so diffuse.rgb is wrong
yOp
You can go back and undo the changes made to the other shader, and mayhaps your funny blend modes are correct after all
material.diffuse is set to Color(value=[153, 153, 153, 255])
so that should be fine
so does that mean VertexColor is wrong?
Up here you have 3 variables controlling the diffuse out:
VertexColor, material.diffuse and texture(diffuseMap, TexCoords)
Validate each
out vec3 FragPos;
out vec4 Color;
out vec3 Normal;
out vec2 TexCoords;
out vec3 Tangent;
out vec3 Bitangent;
// ---
in vec3 FragPos;
in vec4 VertexColor;
in vec3 Normal;
in vec2 TexCoords;
in vec3 Tangent;
in vec3 Bitangent;
```order of in/out values seems fine
disabled the diffuse map for that test
ok figured it out
now why is a light thats above it and pointing up still lighting it up from below

i tested this code on a 1gib file and it worked perfectly 
idk if it should stop on null but that's invalid in json anyway π€·ββοΈ
i have identified a "problem" with splitting strings into multiple tokens
you would need to have context of what the previous token was
@valid jetty https://youtu.be/7sl0e9yKwTk
This is a draft! I made this months ago but never got art to finish it. I figured I may as well upload it for fun.
see i knew this would happen
what hes doing is very smart but also very dangerous
the thing is, the first thing i want to implement is syntax highlighting
put in json string, outputs ansi highlighted string
and it's kinda useful for token parsing to be relaxed and not care about the previous token
so even invalid json gets highlighted 
What are your goals for your parser
mainly learning
Performance? Ergonomics? Zerocooy? Resilience?
i can use it in my c discord bot!
simplicity
i guess
but some versatility because it will push me further

I think I will just make string one token like most parsers
If you want simplicity, step 1 is to not write your own json parser
π
it's mainly for learning
i just might use this library if i do other c projects
and say... not having a whole hashtable impl would make it easier and more lightweight
tode insane
tode insane
@hoary sluice you will not believe how hard this was but
self-referential structs are now possible
as long as you refer to a pointer
so you can do this
struct A {
Foo *a
}
struct B {
Foo *b
}
struct Foo {
A *x,
B *y
}
``` without forward declaring
which means that this is now cleaner than ever
enum AstNodeKind {
Literal,
BinOp,
Funcall,
Return,
Declare
}
struct Literal {
TokenKind kind,
TokenValue value,
}
struct BinOp {
Box<AstNode> left,
Box<AstNode> right,
string op,
}
struct FunctionCall {
ObjectString name,
AstNode[] args,
}
struct Return {
Box<AstNode> value,
}
struct Declare {
ObjectString type,
ObjectString name,
Box<AstNode> value,
}
struct AstNode {
AstNodeKind tag,
@unused Box<Literal> as_literal,
@unused Box<BinOp> as_binop,
@unused Box<FunctionCall> as_funcall,
@unused Box<Return> as_return,
@unused Box<Declare> as_declare,
}
the old(er) version is so much more insane lmao
struct AstNode {
u32 tag;
void *as_literal;
void *as_binop;
void *as_funcall;
void *as_return;
void *as_declare;
};
const ASTNODE_LITERAL = 0;
const ASTNODE_BINOP = 1;
const ASTNODE_FUNCALL = 2;
const ASTNODE_RETURN = 3;
const ASTNODE_DECLARE = 4;
struct Literal {
string kind;
ValueKind *value;
};
struct BinOp {
AstNode *left;
AstNode *right;
string op;
};
struct FunctionCall {
ObjectString *name;
AstNode *[] args;
};
struct Return {
AstNode *value;
};
struct Declare {
ObjectString *type;
ObjectString *name;
AstNode *value;
};
struct AstNode {
u32 tag;
Literal *as_literal;
BinOp *as_binop;
FunctionCall *as_funcall;
Return *as_return;
Declare *as_declare;
};
im not sure how to approach this better than to do it the way i did
basically before i parse the real structs, in an earlier parser pass, i collect all structs enums and namespaces into the struct and enum pools
which, to allow for self-referential formatting, also means i need to forward declare the formatting function (if the user didnt specify it shouldnt be generated)
that means the number of functions for each struct effectively doubles
even though only 1 is generated
@valid jetty woo finally
yay !!!
also i notice that when i run fac 49 this is the error:
and with fac 50 its a stack overflow
ig cause the stack is big enough to compute 49!
tail call recursion time?
this is like planned for 2026 levels of optimization
also is the mod.rs file meant to house only mod, pub use and type or can i put my entire parser in there
RUSTFLAGS="-C link-arg=-Wl,-z,stack-size=16777216" cargo build --release
or something
no idea
anyone else hear that ominous bell tolling????π€£π€£π€£ no?? just me??????ππππππ
i loove c
147 days until mizu5
ulimit -s
i read that as omnibus bell trolling
oh its 8mb
nvm
yop
make ints internally i128 when
they are
when rust makes i256
Quite frankly, even if the choice of Java were to do nothing but keep the Kotlin, Nix and Rust developers out, that in itself would be a huge reason to use Java
or just use bigint tbh
toad when he finds out about java devs that use kotlin, nix and rust
mod.rs, if you have one, is exactly the same as any other module
π€£π€£π€£ eagerly when he fidns oytu tthat z??? because the uses rust
i dont understand this sentence
is the answer to my question yes or no
rosie explosion
It contains the contents of the module
the contents of the module being the entire module or only the mod statements?
SMART IDEA
Depends on if you want the module to contain things or only submodules
instead of storing 2fa backup codes in obvious places put them in comments in project source code
so if malware tries to find 2fa backup codes it will fail
pretty sure mod.rs is what is exported to outside the module - everything else is internal
but i might remember wrong
i last did rust in dec



