opengl-es

Using OpenCV solvePnP for Augmented Reality in OpenGL

情到浓时终转凉″ 提交于 2019-12-10 21:42:42
问题 I'm trying to build an Augmented Reality application in Android using BoofCV (OpenCV alternative for Java) and OpenGL ES 2.0. I have a marker which I can get the image points of and "world to cam" transformation using BoofCV's solvePnP function. I want to be able to draw the marker in 3D using OpenGL. Here's what I have so far: On every frame of the camera, I call solvePnP Se3_F64 worldToCam = MathUtils.worldToCam(__qrWorldPoints, imagePoints); mGLAssetSurfaceView.setWorldToCam(worldToCam);

3D Model with Diffuse AND Normalmap texture

隐身守侯 提交于 2019-12-10 20:51:22
问题 I want to load a 3D model with a diffuse texture and a normal map using the asset loader of libgdx. As far as I figured out the fbx (and the converted g3dj/g3db) format can contain a diffuse texture, as I could see in the fbx-conv example. (knight.g3db) How do I add a normal map texture to it? Do I have to write my own shader for that or is there a simplified method for that? (like for the diffuse texture) 回答1: Normal map is supported from FBX all the way up to the DefaultShader class. So if

OpenGL ES displaying HUD display has no color on top of textured 3D objects

流过昼夜 提交于 2019-12-10 20:44:55
问题 Im a beginner on iphone OS development. I followed jeff's tutorial here about hud display in iphone OS http://iphonedevelopment.blogspot.com/2010/02/drawing-hud-display-in-opengl-es.html The sample works on the accompanying project with the isocahedron as the background of the HUD and the is working as expected with colors and the text. But when I copied the code into my modified project with the textured objects from one of his tutorial series on this one http://iphonedevelopment.blogspot

java opengl: glDrawElements() with >32767 vertices

倾然丶 夕夏残阳落幕 提交于 2019-12-10 20:29:15
问题 this must be simple, but i'm missing it. i have a complex model that has >32767 vertices. now, the indices can only be passed to opengl as type GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT. java has no concept of unsigned, so the unsigned short option maps to simply (signed) short, which is 16 bits, or +32767. when i specify the vertices, i need to pass opengl a short[], where the values in the array point to a vertex in the vertice array. however, if there are >32767 vertices, the value won't fit

OpenGL ES texture mapping

て烟熏妆下的殇ゞ 提交于 2019-12-10 20:24:50
问题 I need to draw circles in my Android application. Actually it is a Pacman game and I need to draw tablets. Since there are many tablets on field I decided to draw each tablet with a single polygon. Here is the illustration of my idea: http://www.advancedigital.ru/ideal_circle_with_only_one_polygon.jpg Vertex coordrs: // (x, y) 0 : -R, R * (Math.sqrt(2) + 1) 1 : -R, -R 2 : R * (Math.sqrt(2) + 1), -R Vertex coords are calculated relative to circle center to place circles with ease later. The

Texture sampling: Calculation of BIAS value from the LOD value

烂漫一生 提交于 2019-12-10 19:54:08
问题 In GL ES 2.0 Functions texture2DLod not available in the fragment Shader. I need to port the GLSL Shader. In GL ES 2.0 I can only use texture2D (sampler2D sampler, vec2 coord, float bias ) Tell me how to calculate the value of a bias equivalent to a known value LOD (level of detail)? //Example GLSL: float lod=u_lod; textureLod(sampler, (uInverseViewMatrix * vec4(r, 0.0)).xy, lod); //I need GL ES 2.0: float lod=u_lod; float bias=? <-----calc bias from lod texture2D(sampler,(uInverseViewMatrix

Using GLU ES in Android

霸气de小男生 提交于 2019-12-10 19:51:43
问题 so I want to draw simple shapes (cylinders, spheres, and cones) in my Android app. Based on this question and answer, it seems like it is possible to port GLU into Android, which has exactly those functions I need. However, I am having trouble getting it to compile. So far I have tried the following: Download glues-1.4-bin-qnx.tar.gz from the glues download page Create a new module ("glues") in my Android project, with the include/ files from the download above and libGLUES_CM.a Include this

Reading from framebuffer GLSL to OpenCV

烈酒焚心 提交于 2019-12-10 19:43:41
问题 I'm just trying to feed a cvMat a texture that is generated by fragment shader, there is nothing appears on the screen, I don't know where is the problem, is this in the driver or glreadPixels.. I just loaded a TGA Image, to a fragment shader, then textured a quad, I wanted to feed that texture to a cvMat, so I used glReadPixesl then genereated a new texture, and drew it on the quad, but nothing appears. Kindly note that the following code is executed at each frame. cv::Mat pixels;

What is the right way to choose an EGL config in Android?

家住魔仙堡 提交于 2019-12-10 19:40:08
问题 I'm using my own GLSurfaceView and have been struggling with crashes related to the EGL config chooser for a while. It seems as though requesting RGB_565 by calling setEGLConfigChooser(5, 6, 5, 0, 16, 0) should be the most supported. However, running this code on the emulator using host GPU I still get a crash, seemingly because my graphics card does not natively support RGB_565. Setting to RGBA_8888 by calling setEGLConfigChooser(8, 8, 8, 8, 16, 0) seems to run fine on my emulator and HTC

OpenGL ES (iPhone) multi-texturing (2D) code

前提是你 提交于 2019-12-10 19:13:23
问题 I have a texture from this PNG: And another from this PNG: They both have the same blend function: glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); I want to see them on one single polygon first. I just couldn't find a simple example of this. Draw them to different polygons works perfect, but I just cannot "merge" them into one texture. Any working sample codelines would be appreciated well. Second problem is to make the specular map's alpha variable. I can see that I have to texture combine