Jump to content

  • Log In with Google      Sign In   
  • Create Account

Chris_F

Member Since 04 Oct 2010
Online Last Active Today, 05:46 PM

Topics I've Started

Particle alpha blending

06 October 2014 - 11:25 AM

I want to render some soft round particles. Currently I'm rendering white quads with an alpha value calculated as:

float alpha = 1.0f - clamp(length(position), 0.0f, 1.0f);

The blending function looks like:

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

But the particles seem to subtract from each other around the outside (dark halo):

 

Attached File  example.jpg   45.17KB   0 downloads


Help with using WGL

24 September 2014 - 05:11 PM

Can someone help me out? I'm looking for a bare minimum example (preferably just one file) for how to set up a core profile context with sRGB framebuffer using WGL.


Odd framebuffer behavior

15 September 2014 - 12:42 AM

I'm using GLFW3 to create a context and I've noticed that the GLFW_SRGB_CAPABLE property seems to have no effect. Regardless of what I set it to, I always get sRGB conversion when GL_FRAMEBUFFER_SRGB is enabled. My understanding is that when GL_FRAMEBUFFER_SRGB is enabled, you get sRGB conversion only if the framebuffer is a sRGB format. To add to the confusion, if I check the GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING I get GL_LINEAR regardless of what I set GLFW_SRGB_CAPABLE to.

 

I'm using a Nvidia GTX 760 with the 340.76 drivers.


Handling VAOs in GL 4.5 with DSA

07 September 2014 - 02:28 PM

In GL_EXT_direct_state_access there was a function named glVertexArrayVertexAttribOffsetEXT. I do not see an equivalent in GL_ARB_direct_state_access. I'm trying to accomplish the following using the new core DSA functions:

GLuint vao = 0;
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers[3]);
glEnableVertexArrayAttribEXT(vao, 0);
glEnableVertexArrayAttribEXT(vao, 1);
glVertexArrayVertexAttribOffsetEXT(vao, buffers[0], 0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glVertexArrayVertexAttribOffsetEXT(vao, buffers[1], 1, 2, GL_FLOAT, GL_FALSE, 0, 0);

I have tried the following, but it does work:

 

GLuint vao = 0;
glCreateVertexArrays(1, &vao);
glVertexArrayElementBuffer(vao, buffers[3]);
glEnableVertexArrayAttrib(vao, 0);
glEnableVertexArrayAttrib(vao, 1);
glVertexArrayVertexBuffer(vao, 0, buffers[0], 0, 0);
glVertexArrayVertexBuffer(vao, 1, buffers[1], 0, 0);
glVertexArrayAttribFormat(vao, 0, 3, GL_FLOAT, GL_FALSE, 0);
glVertexArrayAttribFormat(vao, 1, 2, GL_FLOAT, GL_FALSE, 0);

Issues with new DSA functions in OpenGL 4.5

07 September 2014 - 12:32 PM

Here is the code which seems to be problematic:

GLuint texture = 0;

glCreateTextures(GL_TEXTURE_2D, 1, &texture);
glTextureStorage2D(texture, 10, GL_RGBA8, 512, 512);
glTextureSubImage2D(texture, 0, 0, 0, 512, 512, GL_RGBA, GL_UNSIGNED_BYTE, image_buffer);
glGenerateTextureMipmap(texture);
glBindTextureUnit(GL_TEXTURE0, texture);

Here is the output I am getting:

OpenGL debug: GL_INVALID_VALUE error generated. <unit> must be less than the number of combined texture image units.
OpenGL debug: Texture state usage warning: Texture 0 is base level inconsistent. Check texture size.

PARTNERS