Thanks, Thokra.
From the point of view of easy-to-understand code, my main concern now, I guess separate buffers/uniforms for separate objects is the best. I can see why though if you're after...
Type: Posts; User: sam_thedancer
Thanks, Thokra.
From the point of view of easy-to-understand code, my main concern now, I guess separate buffers/uniforms for separate objects is the best. I can see why though if you're after...
I am just learning to code shaders so performance is not an issue for me at this time. So, it's simply a coding question: if uniforms are different for a bunch of objects can they be packed into a...
Thanks again, Alfonse.
I was actually confused by your initial response but that was because I was missing the point that glUniformSubroutine() takes as parameter an array indexed by subroutine...
Thanks for the response, Alfonse.
I see your point but how about if obj1 and obj2 are, additionally, transformed differently, i.e., the modelview matrix is MV1 for obj1 and MV2 for obj2? In this...
Thokra,
I have a question for you. You say
"For the first case, where the logic is identical, you don't need branching in any way in the shader code because, well, the logic is identical. Just...
Thank you, Alfonse.
However, I can't find the command glSubroutineUniforms() in the 4.x docs. Can you say again how to set a uniform?
Thanks, tonyo_au.
I think I see what you mean and there's a bit in the RB which seems to indicate something similar. But I have a follow-up question in that case.
So, a subroutine can be of...
Greetings:
I am learning shader subroutines and wrote a toy program along the lines of one in the shading language cookbook (I also referred to the recent red book edn.). The program seems to run...
As always, thokra, thank you for a clear and comprehensive reply. Shader subroutines are clearly what was missing from my list.
This topic is actually a follow-on of an earlier posting of mine "Generating pipelines..." where I learned from thokra's responses how to generate pipelines in 4.3. The reason to post a new thread is...
Thokra, thank you again.
It works! Thanks a million.
Can I ask though why this redeclaration is needed: after all gl_PerVertex is a built-in so why does a shader need to be "told" about it again? And one more: if it's out...
Hi Thokra:
The fragment shader and pipeline don't generate errors. The only one is from the vertex shader as below:
Vertex info
-----------
0(12) : error C7592: ARB_separate_shader_objects...
Hi Thokra:
Really appreciate if you took a look. I am working in Win7/Visual C++ 2010. The code compiles ok but I just get a blank screen. The triangle is not drawn.
Thanks,
Sam
Main program
...
Thanks a million, Thokra.
I am going to try then to write a minimal program setting up a pipeline to draw a triangle. If it doesn't work I hope you won't mind taking a look.
Greetings:
I am using core 4.3. Masochistic maybe but your help would be appreciated with the following:-)
I have two different geometric objects that need to be transformed differently. I know I...
Thanks, nightmareci.
Thanks, Dark Photon.
But I am curious about 4.3 core. Does one have to code up spheres, toruses, etc. by hand? Or is there some other library which might help (e.g., glm for math)?
Greetings:
What I see with 4.3 is that objects should be encapsulated in VAOs with the vertex position/color etc. data buffered. So how does something like glutWireTorus() (where we don't "see" the...
Thanks, Alfonse, that clears it up. I really appreciate the quick response.
Greetings:
I had an understanding that a vertex shader must write gl_Position and a fragment shader must write gl_FragColor. But looking at some recent books (OpenGL 4+) it seems that only the first...
Thanks, Nowhere-01.
Actually I was being dumb. I had omitted
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image[0]->sizeX, image[0]->sizeY, 0,
GL_RGB, GL_UNSIGNED_BYTE, image[0]->data);...
Greetings:
The code below works fine if I uncomment gluBuild2DMipmaps() and comment out glGenerateMipmap(). But the way it is, trying to use glGenerateMipmap() to generate mipmaps, doesn't work. It...
Thanks, Nowhere-01!
Hi Nowhere,
Thanks for the response. Attached are grabs of what's drawn for a texture size 512x512 and then scaled to 480x480. Below is the part of the code that loads the image:
Sam
struct...