opengl-es

What are the normals for 3d cube as used in OpenGL ES?

二次信任 提交于 2019-12-09 05:44:46
问题 I have a cube defined as : float vertices[] = { //Vertices according to faces -1.0f, -1.0f, 1.0f, //Vertex 0 1.0f, -1.0f, 1.0f, //v1 -1.0f, 1.0f, 1.0f, //v2 1.0f, 1.0f, 1.0f, //v3 1.0f, -1.0f, 1.0f, //... 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1

Use of undeclared identifier 'gl_InstanceID'

て烟熏妆下的殇ゞ 提交于 2019-12-09 04:03:29
Hi everyone, i have been trying Instanced drawing in OpenGLES2.0, in IOS platform. My rendering code glEnableVertexAttribArray(...); glVertexAttribPointer(...) glDrawElementsInstancedEXT(GL_TRIANGLES,IndicesCount, GL_UNSIGNED_SHORT, 0, 5); And my Vertex Shader attribute vec4 VertPosition; uniform mat4 mvpMatrix[600]; void main() { gl_Position = (mvpMatrix[gl_InstanceID]) * VertPosition; } I'm getting ERROR: Use of undeclared identifier 'gl_InstanceID' my glsl version is 1.0, if version is the issue then how can i upgrade ? Any other way to use "gl_InstanceID" in GLSL ? BDL gl_InstanceID is

Android GPU profiling - OpenGL Live Wallpaper is slow

人走茶凉 提交于 2019-12-09 03:41:05
问题 I'm developing a Live Wallpaper using OpenGL ES 3.0. I've set up according to the excellent tutorial at http://www.learnopengles.com/how-to-use-opengl-es-2-in-an-android-live-wallpaper/, adapting GLSurfaceView and using it inside the Live Wallpaper. I have a decent knowledge of OpenGL/GLSL best practices, and I've set up a simple rendering pipeline where the draw loop is as tight as possible. No re-allocations, using one static VBO for non-changing data, a dynamic VBO for updates, using only

How much more complex is it to draw simple curves, lines and circles in OpenGL ES rather than in Quartz 2D?

☆樱花仙子☆ 提交于 2019-12-09 01:29:51
问题 Is OpenGL ES really so much faster? Why? And is it really so horrible complicated to draw such simple things in OpenGL ES compared to drawing these in Quartz 2D? For example, I have a UIView subclass with -drawRect: implemented, where I draw some lines, curves and circles. Just simple paths, with some shadow. What would I do in OpenGL ES? Isn't there this nice EAGLView layer thing? One thing that comes to mind is how do touch events go into OpenGL ES? Maybe that's the complex thing about it?

Getting a Maya Model into the iPhone

流过昼夜 提交于 2019-12-09 01:12:06
问题 What is the best way to do this? Googling has shown me a bunch of ways, but what is the current best? I'd be happy enough to just get the model exported from Maya and rendered on the iPhone screen, but I'd be stoked if there was a way to render it, then support pinch to zoom, etc. Thanks a lot, just finished my first 3D modeling class today and I'm stoked! 回答1: I just finished writing a full featured model viewer and manipulator for iPhone and iPad. Basically, I just wrote my own file parser

How to render multiple solid cut planes?

戏子无情 提交于 2019-12-08 19:56:27
I'm rendering some cut planes to do solid capped clipping using stencils in OpenGL. Each cut plane works fine by itself, but I want to be able to create multiple cut planes at the same time. The problem I'm running into is when I cut an object with a second cut plane, in certain view orientations there are no back faces to use to create a stencil to draw the capping plane. I know there must be some way to work with multiple stencil buffers to get what I want, but I just can't think of the right way to do this. I figure it will probably involve saving the stencil buffer for each clipping plane

Displaying text (like score) which changes on each frame

点点圈 提交于 2019-12-08 17:47:12
问题 Is there any easy way to display simple white text without any textures on the right top corner which changes on each frame in the class which implements Renderer, in onDrawFrame method? It's 2D, so there is no need to make any transformations, I believe. I've found many tutorials, but they all seem just too complex with too much code. Maybe it could be done just with a few lines of code? If that's not possible, what's the easiest way to do it without modifying too much of existing code?

Drawing Stippled Lines using OpenGL-ES

浪尽此生 提交于 2019-12-08 17:00:46
问题 I have an application that draws 3-d map view marked up lines that show various features. I am porting the map over to an OpenGL-ES architecture, but am having a bit of trouble working out how to display dashed lines. Doing a lot of googling, I've found many references to the idea that drawing dashed lines and polygons were removed from OpenGL-ES as they can be easily emulated using textures triangles. That's great, but I can't find anyone that actually does this emulation and/or has a

2D example with OpenGL

折月煮酒 提交于 2019-12-08 16:22:58
问题 I am looking for a very simple tutorial to use OpenGL only for 2D drawing. My problem is that I want to draw, with OpenGl a bitmap having its pixels. Thank you in advance, Ouael 回答1: The glbuffer for the Android NDK was useful for me. This answer also has many tutorials linked. 回答2: Get any 3d example and just set the z coordinate to zero. e.g. if you have coordinates like (2,3,1) change it to (2,3) or (2,3,0). 来源: https://stackoverflow.com/questions/5220105/2d-example-with-opengl

Textures are not displayed on the sphere for Samsung Galaxy SL

一世执手 提交于 2019-12-08 14:00:28
问题 I am studying the Rajawali framework for Android. I tried their first basic tutorial which is as follows: public class RRenderer extends RajawaliRenderer { private DirectionalLight mLight; private BaseObject3D mSphere; public RRenderer(Context context) { super(context); setFrameRate(60); } protected void initScene() { mLight = new DirectionalLight(1f, 0.2f, 1.0f); // set the direction mLight.setColor(1.0f, 1.0f, 1.0f); mLight.setPower(2); Bitmap bg = BitmapFactory.decodeResource(mContext