Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work for a simple text rendering without a shading program #237

Open
yurivict opened this issue Mar 19, 2021 · 4 comments
Open

Doesn't work for a simple text rendering without a shading program #237

yurivict opened this issue Mar 19, 2021 · 4 comments

Comments

@yurivict
Copy link

I tried to draw a simple 2D OpenGL text and this line https://github.com/rougier/freetype-gl/blob/master/vertex-buffer.c#L396 (glDisableVertexAttribArray( attribute->index );) fails with GL_INVALID_VALUE because index=-1.

This attribute index is hardcoded to be bound to the shader program in https://github.com/rougier/freetype-gl/blob/master/text-buffer.c#L29 (vertex_buffer_new("vertex:3f,tex_coord:2f,color:4f,ashift:1f,agamma:1f" )) but this leaves this index=-1 without such program.

It should be possible to render text without any shading program.

@yurivict
Copy link
Author

@rougier You need to add a "simple" testcase that would paint text in 2D in as simple as possible way, without any bells and whistles like shader programs.

@rougier
Copy link
Owner

rougier commented Mar 19, 2021

I'm not sure to get your point when you say "without shader". Could you post some mokcup user code?

@yurivict
Copy link
Author

There should be a function similar to Qt's QGLWidget::renderText() that accepts a font, a string, and paints text with triangles. This would be the simplest use case of painting text with OpenGL.

https://doc.qt.io/qt-5/qglwidget.html#renderText

@rougier
Copy link
Owner

rougier commented Mar 24, 2021

Ok, I see. This needs to be written and it should not be too difficult provided there is a default font available. Would you be interested in writing such example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants