opengl-es

No OpenGL context found in the current thread

萝らか妹 提交于 2021-02-20 06:29:31
问题 I am using LibGDX to make a game. I want to simultaneously load/unload assets on the fly as needed. However, waiting for assets to load in the main thread causes lag. In order to remedy this, I've created a background thread that monitors which assets need to be loaded (textures, sounds, etc.) and loads/unloads them appropriately. Unfortunately, I get the following error when calling AssetManager.update() from that thread. com.badlogic.gdx.utils.GdxRuntimeException: java.lang.RuntimeException

How to pass non interpolated data OpenGL ES (GLSL)

我是研究僧i 提交于 2021-02-19 03:57:07
问题 I'm trying to pass simple FLOAT value from vertex to fragment shader. How can I pass it "as is" without interpolation? On desktop I could use flat varying to disable interpolation, is there something similar in openGL es or the only way is through texture? 回答1: GLSL ES does currently not support the flat keyword, so the only way is to use the same float value in all the triangle vertices. The same answer was given here: In opengl es 2, is there a way to prevent interpolation of varyings 回答2:

Draw edges of a polygon with OpenGL shaders

痞子三分冷 提交于 2021-02-17 22:27:45
问题 I was wondering if it was possible to draw the edges of a rendered polygon with a specific color using a fragment shader, as in this example picture: Or should I just render those separately? 回答1: See work related on this page: http://web.archive.org/web/20120527185124/http://cgg-journal.com/2008-2/06/index.html A vertex shader should render polygons where the distance to each edge is colored. The difference between coloring each "cell" is explained in much detail. 来源: https://stackoverflow

Is there a way to draw a circle with the fragment shader at the position of a point from the vertex shader?

╄→尐↘猪︶ㄣ 提交于 2021-02-16 05:25:44
问题 So i am drawing a Point at a certain ... well ... point of the screen that is then moving around. My Vertex Shader looks like this. private final String vertexShaderCode = "attribute vec4 vPosition;" + "uniform mat4 Projection; \n" + "uniform mat4 ModelView; \n" + "void main() {" + " gl_Position = Projection * ModelView * vPosition;" + " gl_PointSize = 900.0; " + "}"; What i am trying to achive is to then render a circle around the position of this one vertice. For that i am using the

Is there a way to draw a circle with the fragment shader at the position of a point from the vertex shader?

帅比萌擦擦* 提交于 2021-02-16 05:24:40
问题 So i am drawing a Point at a certain ... well ... point of the screen that is then moving around. My Vertex Shader looks like this. private final String vertexShaderCode = "attribute vec4 vPosition;" + "uniform mat4 Projection; \n" + "uniform mat4 ModelView; \n" + "void main() {" + " gl_Position = Projection * ModelView * vPosition;" + " gl_PointSize = 900.0; " + "}"; What i am trying to achive is to then render a circle around the position of this one vertice. For that i am using the

Read the depth buffer of OpenGL ES on Android

笑着哭i 提交于 2021-02-11 15:14:44
问题 I am trying to read the depth buffer in OpenGL ES on Android, but all the values are zero. Can someone explain why is that. public void onSurfaceChanged(GL10 unused, int width, int height) { // Adjust the viewport based on geometry changes, // such as screen rotation GLES20.glClearColor(0.0f, 0.0f, 1.0f, 1.0f); GLES20.glClearDepthf(1.0f); GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); GLES20.glEnable(GLES20.GL_DEPTH_TEST); GLES20.glDepthMask( false ); GLES20

WebGL context is redrawn completely for no apparent reason

我是研究僧i 提交于 2021-02-10 20:14:05
问题 I'm experimenting with WebGL and it seems to me that I've missing something very basic but still can not find in docs and examples what exactly. So imagine I want to draw a rectangle, id do something like this: let points = rectangle(20, 20, 100, 100) gl.bufferData(WebGLRenderingContext.ARRAY_BUFFER, convertFloat32(points), WebGLRenderingContext.STATIC_DRAW) gl.drawArrays(WebGLRenderingContext.LINE_STRIP, 0, points.length) This works. I see a rectangle drawn an cannot be more happier. Same

WebGL context is redrawn completely for no apparent reason

老子叫甜甜 提交于 2021-02-10 20:12:49
问题 I'm experimenting with WebGL and it seems to me that I've missing something very basic but still can not find in docs and examples what exactly. So imagine I want to draw a rectangle, id do something like this: let points = rectangle(20, 20, 100, 100) gl.bufferData(WebGLRenderingContext.ARRAY_BUFFER, convertFloat32(points), WebGLRenderingContext.STATIC_DRAW) gl.drawArrays(WebGLRenderingContext.LINE_STRIP, 0, points.length) This works. I see a rectangle drawn an cannot be more happier. Same

3D CAD to OpenGL

旧城冷巷雨未停 提交于 2021-02-10 13:35:51
问题 I was wondering if anyone knew of a program that can take a 3D drawing of an object and then convert it into the required OpenGL points and normals. Basically I have an AutoCAD drawing of that I want to be able to display in a program I am creating for iPhone. Any suggestions? 回答1: If you have AutoCAD itself, you could export the object into a mesh format, like STL. Reading STL files is straightforward. If you don't have AutoCAD you may also try FreeCAD, which is based on OpenCascade, which

3D CAD to OpenGL

懵懂的女人 提交于 2021-02-10 13:35:27
问题 I was wondering if anyone knew of a program that can take a 3D drawing of an object and then convert it into the required OpenGL points and normals. Basically I have an AutoCAD drawing of that I want to be able to display in a program I am creating for iPhone. Any suggestions? 回答1: If you have AutoCAD itself, you could export the object into a mesh format, like STL. Reading STL files is straightforward. If you don't have AutoCAD you may also try FreeCAD, which is based on OpenCascade, which