GithubHelp home page GithubHelp logo

Comments (8)

LovelySanta avatar LovelySanta commented on September 17, 2024 4

Yes, that is the discrepancy I'm referring to. Small correction: it is GetComponentCount() that returns the size, not ShaderDataTypeToOpenGLBaseType.

Fixed my typo, thanks

I don't think we would ever even need to send a mat3 or mat4 as vertex buffer attribute.

It's about correctness... If we wouldn't support it, then we wouldn't add it in the first place...

from hazel.

WhoseTheNerd avatar WhoseTheNerd commented on September 17, 2024

I don't see anything wrong, can you clarify what's wrong about that piece of code?

from hazel.

LovelySanta avatar LovelySanta commented on September 17, 2024

As I'm reading this, these lines will return a component count of 9 and 12 respectivly, which, i think is correct?

case ShaderDataType::Mat3: return 3 * 3;
case ShaderDataType::Mat4: return 4 * 4;

But as the OpenGL specification says for the second parameter:

size:
Specifies the number of components per generic vertex attribute. Must be 1, 2, 3, 4. Additionally, the symbolic constant GL_BGRA is accepted by glVertexAttribPointer. The initial value is 4.

Meaning the return value of the GetComponentCount function (as shown above) will result in an error as it returns a value that is higher than 4? Which in that case would result in an error:

GL_INVALID_VALUE:
Generated if size is not 1, 2, 3, 4 or (for glVertexAttribPointer), GL_BGRA.

As I am not sure, my intuition says it is correct, but the documentation clearly states it's not...

from hazel.

 avatar commented on September 17, 2024

Yes, that is the discrepancy I'm referring to. Small correction: it is GetComponentCount() that returns the size, not ShaderDataTypeToOpenGLBaseType.

from hazel.

philipkatis avatar philipkatis commented on September 17, 2024

I don't think we would ever even need to send a mat3 or mat4 as vertex buffer attribute.

from hazel.

rijenkii avatar rijenkii commented on September 17, 2024

Also, bool can't be a vertex buffer attribute

from hazel.

Puddlestomper avatar Puddlestomper commented on September 17, 2024

I would like to point out this information from the OpenGL specification.

I would also like to point out that Buffer.h is part of our RendererAPI independent code and it might be standard in other APIs to provide the full size (I don't know other APIs so I can't say for sure). In that case this can stay as is and should be handled as a special case on the OpenGL side of the code.

Either way there should probably be specific code on the OpenGL side to handle the case for matrices properly.

from hazel.

LovelySanta avatar LovelySanta commented on September 17, 2024

I would like to point out this information from the OpenGL specification.

I would also like to point out that Buffer.h is part of our RendererAPI independent code and it might be standard in other APIs to provide the full size (I don't know other APIs so I can't say for sure). In that case this can stay as is and should be handled as a special case on the OpenGL side of the code.

Either way there should probably be specific code on the OpenGL side to handle the case for matrices properly.

Yes, the function itself is correct, but it is still an error that OpenGL is using this. So it is still a valid issue, we just need an OpenGL solution for this

from hazel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.