Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Guillaume Jacquemin
@williamjcm
(For example, you can call Primitives::circle2D(6) to get a hexagon.)
zhangfq-chemistry
@zhangfq-chemistry
@williamjcm Clever! Do you use glm to render the dashed line?
Guillaume Jacquemin
@williamjcm
No, I don't use GLM.
zhangfq-chemistry
@zhangfq-chemistry
Dear all, how to make a cylinder based on Primitive::capsule, in which the radius of two hemisphere caps is the same as the main cylinder? My one after scale is like a thorn prick
zhangfq-chemistry
@zhangfq-chemistry
Another question: how to fill the empty space around text ?
void View3dWidget::renderText3D(string s, Vector3 xyz , Color3 c)
{
    Float _scale=0.04f;
    Text::Renderer3D render3d {*_fontText, _cacheText, 1.0f, Text::Alignment::MiddleCenter};
    render3d.reserve(2,GL::BufferUsage::DynamicDraw,GL::BufferUsage::StaticDraw);
    render3d.render(s);

    Matrix4 scaleMatrix=Matrix4::scaling(Vector3(_scale,_scale*width()/height(),1.0));
    Vector3 out = (camera().projectionMatrix()*cameraObject().absoluteTransformationMatrix().inverted()).transformPoint(xyz);

    _shaderText.setTransformationProjectionMatrix(Matrix4::translation(out)*scaleMatrix)
            .setColor(c)
            .draw(render3d.mesh());
}
image.png
Vladimír Vondruš
@mosra
you mean around O? i suppose it's because of the depth buffer? you have to render the text last, after the spheres, to avoid this

cylinder based on Primitive::capsule

don't scale it but pass the desired half-length to the function :)

I have two frame buffers. I have done this for test:
clearColor(0, Color4(index == 0 ? 1.0f : 0.0f, 1.0f, 0.0f, 0.25f))

But only the green appears, which is the last one

@FoNz99089892_twitter what do you mean by "green is the last one"?

zhangfq-chemistry
@zhangfq-chemistry
@mosra Thanks! the same as your told
@mosra Do not work as can be seen
void View3dWidget::renderCylinder(vector3  v0, vector3  v1,  Color3  c,  float radius)
{
    vector3 v=v1-v0;
    GL::Mesh cylinder_ = MeshTools::compile(Primitives::capsule3DSolid(30,60,10,v.length()*0.5));
    Matrix4 scaleMatrix=Matrix4::scaling(Vector3(radius,1.0,radius));
image.png
zhangfq-chemistry
@zhangfq-chemistry
All the caps protrude outside with sharp end
Fo Nz
@FoNz99089892_twitter
I mean, only the framebuffer with the green background appears. It's color should blend with the previous one, which has yellow background. It seems that, during the blit operation, alpha component is always 1.0. Surely I am missing something.
I try to dig up the problem later, because I know I'm giving you too little details. I try to export my framebuffers to a png. I should see transparent background.
I'll reach you later. In the meantime, if you have an advice, just say it.
Vladimír Vondruš
@mosra
@zhangfq-chemistry yeah no, you can only apply uniform scaling (same on each axis) to it ... so the capsule needs to get v.length()*0.5f/radius and then scale by Vector3(radius) i think?
Vladimír Vondruš
@mosra

It seems that, during the blit operation, alpha component is always 1.0.

ah! yes, blit is just a plain pixel copy operation, no blending done

@FoNz99089892_twitter to perform blending you have to use a shader, render a fullscreen triangle with the Flat shader for example
Fo Nz
@FoNz99089892_twitter
Anyway, I have no problem doing this quad on screen and attaching these two buffers.
Fo Nz
@FoNz99089892_twitter
Thanks for the answer
zhangfq-chemistry
@zhangfq-chemistry
@mosra Thanks!
zhangfq-chemistry
@zhangfq-chemistry
Dear all, how to build quadrilateral /pentagon mesh? Can I simply add more Vector3 to the example of triangle to accomplish it?
Vladimír Vondruš
@mosra
you could abuse the circle primitive for this
but yes, easiest in general is to build it from scratch, triangle by triangle
zhangfq-chemistry
@zhangfq-chemistry
Thanks!
zhangfq-chemistry
@zhangfq-chemistry
@mosra The triangle I rendered disappears after rotation of 180 degree. jvannugteren told me one method to draw it twice times, clockwise /counterclockwise . Is there any better method to tackle the problem?
Vladimír Vondruš
@mosra
flat shader, right? i suppose this is due to face culling, do you have it enabled?
Innokentiy Alaytsev
@Innokentiy-Alaytsev
Disable backface culling?
Vladimír Vondruš
@mosra
Renderer::Feature::FaceCulling, usually the examples have it set, so it's highly probable you have it too
i'd leave it enabled for most of the drawing (it improves performance), but disable it when you render the labels that might get flipped
zhangfq-chemistry
@zhangfq-chemistry
Thanks, it works when Renderer::Feature::FaceCulling is disable
zhangfq-chemistry
@zhangfq-chemistry
The label text on the top of the sphere do not change size when scrolling middle button, how to link it to zoom() of arcBall?
//render directly in paitGL()
void View3dWidget::renderText3D(QString s, Vector3 xyz , Color3 c)
{
    Float _scale=0.04f;
    Text::Renderer3D render3d {*_fontText, _cacheText, 1.0f, Text::Alignment::MiddleCenter};
    render3d.reserve(6,GL::BufferUsage::DynamicDraw,GL::BufferUsage::StaticDraw);
    render3d.render(s.toStdString());

    Matrix4 scaleMatrix=Matrix4::scaling(Vector3(_scale,_scale*width()/height(),1.0));
    Vector3 out = (camera().projectionMatrix()*cameraObject().absoluteTransformationMatrix().inverted()).transformPoint(xyz);

    _shaderText.setTransformationProjectionMatrix(Matrix4::translation(out)*scaleMatrix)
            .setColor(c)
            .draw(render3d.mesh());
}
image.png
Vladimír Vondruš
@mosra
i don't remember how arcball works anymore :sweat_smile:
zhangfq-chemistry
@zhangfq-chemistry
When I wrap it to object3d,the text is changed when zoom, but it cannot face to the camera.
So, I doubt the projection matrix is not very good
jvannugteren
@jvannugteren
The arcballcamera exposes its internal camera object through .camera() function. Maybe you can use that to set the text size?
Igal Alkon
@alkavan
@mosra thanks for merging the GCC 11 fix to master =)
hsdk123
@hsdk123
Hi all, what would be the recommended way to install sdl for building for ios?
zhangfq-chemistry
@zhangfq-chemistry
Hi, anybody know how to use marching-cube algorithms based on magnum ?
zhangfq-chemistry
@zhangfq-chemistry
To reconstruction surface
Igal Alkon
@alkavan
@hsdk123 homebrew?
Igal Alkon
@alkavan
Um.... If I want to draw Primitives::cubeWireframe() in color, (Shaders::FlatGL3D{Shaders::FlatGL3D::Flag::VertexColor}) I have to also use Shaders::FlatGL3D::Flag::InstancedTransformation ?
Guillaume Jacquemin
@williamjcm
According to what I can see, cubeWireframe() doesn't generate vertex colour data.
Instead of creating the shader with the VertexColor flag, you'd have to call setColor() on the shader instead.
Igal Alkon
@alkavan
@williamjcm thanks :)
zhangfq-chemistry
@zhangfq-chemistry
@alkavan I use marching-cube to generate molecular orbital
Vladimír Vondruš
@mosra
@hsdk123 given that SDL supports CMake subprojects now, i'd use that (if it works with CMake) ... in the past (6 years ago) i built it externally with the provided iOS Xcode project and it was very painful, i hope CMake is capable of doing the same nowadays