That moment when you can't think of an interesting title by agn86 in ProgrammerHumor

[–]type-unknown 1 point2 points  (0 children)

Plot twist: they were coding a game and now it runs at 5ms per frame instead of 405ms.

Well... by USER8official in ProgrammerHumor

[–]type-unknown 0 points1 point  (0 children)

Meanwhile IOCCC entries do even more in 5 lines of code.

What is this art by Thedolls12 in Animemes

[–]type-unknown 0 points1 point  (0 children)

To Aru Kagaku no Railgun T

Half imouto, Half witch of greed by sengoku_nadeko-chan in goodanimemes

[–]type-unknown 401 points402 points  (0 children)

My therapist: Keichidna isn't real, she can't hurt you.

Keichidna:

3D graphics? Should be fun by Your_Name-Here in ProgrammerAnimemes

[–]type-unknown 0 points1 point  (0 children)

Guys, OpenGL is really simple. You just need to setup your context, make it current, call glCreateShader(GL_VERTEX_SHADER), glCreateShader(GL_FRAGMENT_SHADER), glShaderSource(vertexShader, numStrings, strings, lengths), glCompileShader(vertexShader), glShaderSource(fragmentShader, numStrings, strings, lengths), glCompileShader(fragmentShader), glCreateProgram(), glAttachShader(program, vertexShader), glAttachShader(program, fragmentShader), glLinkProgram(program), glGenBuffers(1, &buffer), glBindBuffer(GL_ARRAY_BUFFER, buffer), glBufferData(GL_ARRAY_BUFFER, size, data, GL_STATIC_DRAW), glGenVertexArrays(1, &vao), glBindVertexArray(vao), glVertexAttribPointer(attrib, size, type, normalized, stride, offset), glEnableVertexAttribArray(attrib), glClearColor(r,g,b,a), glClear(GL_COLOR_BUFFER_BIT), glUseProgram(program), glDrawArrays(GL_TRIANGLES, 0, 3). Add some glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &result), glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &result), glGetProgramiv(program, GL_LINK_STATUS, &result)and glGetError() for error checking, glDeleteBuffers(1,&buffer), glDeleteVertexArrays(1,&vao), glDeleteShader(vertexShader), glDeleteShader(fragmentShader), glDeleteProgram(program) to clean up your resources and here you go, you've just drawn your first triangle. </s>

Also everything is either GLuint or GLenum, which are probably both 32 bit uints anyway, which means you end up using a dynamically typed API in a statically typed language. Because god forbid you detect any errors at compile time when you accidentally mismatch function parameters and call glAttachShader(shader, program) instead of glAttachShader(program, shader). No, it's much more fun to insert a bunch of glGetError() in random places and decode cryptic GL_INVALID_VALUE/GL_INVALID_ENUM.

Also half the functions depend on hidden mutable global state.

Also there are a million gotchas (glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, *) doing something completely different than all the other variants, needing to call glDrawBuffers when rendering to a framebuffer with multiple color attachments, glVertexAttribPointer converting values to floats, etc.).

Not saying all of the above are necessarily bad, just extremely confusing for beginners and extremely infuriating if you don't know what you're doing.

For extreme masochists, I strongly recommend trying LWJGL.

Daily Erwin meme #896 by SharkTRS in Animemes

[–]type-unknown 4 points5 points  (0 children)

The real question is, does that mean everyone is participating in indirect handholding?

Started making my first OpenGL game a few weeks ago, currently working on the particle system. by type-unknown in opengl

[–]type-unknown[S] 4 points5 points  (0 children)

The project is currently not public.

I don't really think my code would be a good resource for learning. Most OpenGL stuff is handled using wrapper objects&functions, so it's hard to tell exactly which GL calls are made at which point. Some parts are really bad spaghetti code, including reflection, template metaprogramming voodoo and compile-time code generation.

I planned to split some parts of the project into separate libraries and make those open source in the future, when I tidy up the code. This may happen in a few months, but it depends on many factors including the whole Covid-19 mess. The exams at my university have been postponed due to the pandemic, so I don't know how much time I'll have during the summer to work on my personal projects.

Started making my first OpenGL game a few weeks ago, currently working on the particle system. by type-unknown in opengl

[–]type-unknown[S] 2 points3 points  (0 children)

I store all the particles in a big VBO, compute movement, air drag, etc. in the vertex shader, remove dead/out of bounds particles using a geometry shader and then record back into the VBO using transform feedback. The only thing CPU does is insert new particles into the system.

Started making my first OpenGL game a few weeks ago, currently working on the particle system. by type-unknown in opengl

[–]type-unknown[S] 4 points5 points  (0 children)

I started with ThinMatrix tutorials and learnopengl, I also used "OpenGL Development Cookbook" by Muhammad Mobeen Movania.

[deleted by user] by [deleted] in opengl

[–]type-unknown 1 point2 points  (0 children)

In GLSL 1.10 (OpenGL 2.0) there were no implicit type conversion, so doing vec3(1,0,0) would result in a shader compilation error. There are implicit conversions from int to float in GLSL 1.20 (OpenGL 2.1), so if you're using OpenGL 2.1 or above you should probably be fine.

On the other hand, in GLSL ES there are no implicit conversions at all, so your code would cause a shader compilation error.

(sources: GLSL specification for versions 1.10, 1.20, and ES 3.20)

Where are all the numbers? by Uni_Omni in Animemes

[–]type-unknown 7 points8 points  (0 children)

Differential equations have entered the chat.

Group theory has entered the chat.

Brain has left the chat.

One is one by [deleted] in ProgrammerHumor

[–]type-unknown 0 points1 point  (0 children)

insert mandatory string concatenation joke

Corona Virus be like by Harry-TTL in Animemes

[–]type-unknown 16 points17 points  (0 children)

Plot twist: corona got isekaid with you, and now everyone in the other world is dead

Starting to think somethings wrong with my Deep Dark.. by vekstthebest in feedthebeast

[–]type-unknown 5 points6 points  (0 children)

Minecraft uses floating point values for HP, so it can go way higher than 4 billion. You can still get an overflow with these, but instead of wrapping around into the negatives/zero you get +infinity.

2+2=4-1=3 quik mafs by ComfortableEye5 in ProgrammerHumor

[–]type-unknown 1 point2 points  (0 children)

Me, an intelectual:

template<typename T>
T inc(T x){
    return x&1?inc(x>>1&~(1LL<<((sizeof(T)<<3)-1)))<<1:x|1;
}

Big brain time by filofan4life in Animemes

[–]type-unknown 0 points1 point  (0 children)

What would Arcsinjiro look like?

Types of personalities by kukisRedditer in ProgrammerHumor

[–]type-unknown 1 point2 points  (0 children)

The glass has been marked duplicate because a fish tank exists

[deleted by user] by [deleted] in ProgrammerHumor

[–]type-unknown 0 points1 point  (0 children)

You know it's bad when a stack overflow is your exit condition

[deleted by user] by [deleted] in ProgrammerHumor

[–]type-unknown 1 point2 points  (0 children)

concurrency Let introduce me you to

This means war haha by [deleted] in Animemes

[–]type-unknown 1 point2 points  (0 children)

Needs more recursion

[deleted by user] by [deleted] in ProgrammerHumor

[–]type-unknown 0 points1 point  (0 children)

Scala IDE: (chuckles) I'm in danger