opengl-es

mat3 attribute in WebGL

拜拜、爱过 提交于 2019-12-06 13:40:58
I'm attempting to use the ANGLE_instanced_arrays extension in WebGL to render multiple instances of an object with different mat3 transformation matrices. This is the code related to the buffer for my matrices: //setup this.shaderProgram.transformAttribute = gl.getAttribLocation(this.shaderProgram, "transform"); ext.vertexAttribDivisorANGLE(this.shaderProgram.transformAttribute, 1); this.transformBuffer = gl.createBuffer(); //each render gl.enableVertexAttribArray(this.shaderProgram.transformAttribute); gl.bindBuffer(gl.ARRAY_BUFFER, this.transformBuffer); gl.bufferData(gl.ARRAY_BUFFER, new

converting 2D mouse coordinates to 3D space in OpenGL ES

吃可爱长大的小学妹 提交于 2019-12-06 13:36:25
I want to convert mouse's current X and Y coordinates into the 3D space I have drawn in the viewport. I need to do this on the OpenGL ES platform. I found following possible solutions implemented in OpenGL, but none fits what I am looking for. I found NeHe's tutorial on doing exactly this, but in traditional OpenGL way. It uses gluUnProject. http://nehe.gamedev.net/data/articles/article.asp?article=13 Although gluUnProject is not available in OpenGL ES, its implementation seems simple enough to port back. But before calling it, we need to call glReadPixels with GL_DEPTH_COMPONENT and that is

ios : Displaying a simple 3D model with GLEssentials sample code

爷,独闯天下 提交于 2019-12-06 13:30:05
My goal is to display a simple 3D model and apply a texture on it. I've downloaded the GLEssentials ios sample project to learn how to develop this (i'm new in ios OpenGL-ES API) But the example model is a .model file, which I never heard about and which never appear in model bank websites . What is this kind of file? is the sample code compatible with other common model types (.obj, .c2d, .3ds)? is it a good idea to start from this project? Ricardo RendonCepeda Have a look at this question: How to convert Blender blend (or obj) file to Qualcom Vuforia .h file In my answer, I describe a script

Android opengl modify vertex array after draw call

假如想象 提交于 2019-12-06 13:20:58
In opengl, is it bad practice or not recommended to modify the vertex array after I have drawn it? It's not bad practice if you modify the vertex array when you draw it as ordinary vertex array. It's bad practice to modify the vertex array if you use vertex buffer objects in your draw method. That's because you have to reupload it to your VRAM once it is edited. 来源: https://stackoverflow.com/questions/4703550/android-opengl-modify-vertex-array-after-draw-call

Explain how OpenGL ES background images work

北慕城南 提交于 2019-12-06 12:31:01
Could someone please explain how you render background images on an OpenGL ES view? From the basics of setting up the OpenGL environment. I'm a newbie to OpenGL here. I'm seeing a few questions/ answers on stackoverflow about creating background images, but I'm trying to modify existing code at the moment (Apple's GLPaint in particular), and I'm not sure what is needed and what is not. Having tried the solutions, with no success, I thought I should take a step back and actually try and understand what is going on. Mindlessly hacking hasn't gotten me far =( Are there any simple apps that show

how to load android camera frame into opengl es texture via ndk?

…衆ロ難τιáo~ 提交于 2019-12-06 12:12:00
问题 I've been studying opengl es recently and trying to access the camera on android platform. All I need to do is to load camera data frame by frame through ndk and then load it into GL texture for further process. Is there any help or suggestion? It is highly appreciated if there is sample code! thank you! 回答1: Send the camera output to a SurfaceTexture. Each frame will be available as an "external" GLES texture. This is significantly more efficient than receiving camera frames in a buffer and

Iphone pixel distortion while zooming OpenGL ES content for Paint app

半世苍凉 提交于 2019-12-06 12:00:40
I have a strange problem with openGL ES. I’m working on a paint app for iphone [taking reference from GLPaint app] .In my code I'm using an imageView which contain outline image on which I am puting [CAEAGLLayer] paintView for filling colors. I am filling colors in outline image by drawings lines onscreen based on where the user touches. I'm using the "renderLineFromPoint" function to draw a line between two points using "touchesMoved" for getting starting point and ending point. - (void) renderLineFromPoint:(CGPoint)start toPoint:(CGPoint)end{ // Drawings a line onscreen based on where the

android: GLWallpaperService causing green screen

南楼画角 提交于 2019-12-06 11:56:27
问题 I am trying to create a live wallpaper using opengl (<2.0). I imported and tried to run Robert Green's GLWallpaperService and Example here (using Eclipse SDK). My phone is a Huwei Ascend Android 2.1. I already know it can run other opengl LWPs. When I run the package, it just produces a solid green screen, and no shapes or anything. Ive researched it alot and still cant figure out why this is happening. I read a few times that the namespaces have to be changed to my package. But still no luck

Get the actual amount of OpenGL texture memory an iOS app uses

有些话、适合烂在心里 提交于 2019-12-06 11:43:40
问题 There are a couple of questions in SO similar to this one, but none of them seem to explain a definitive approach for getting the actual OpenGL texture memory used by an iOS app, on the device. I know how to manually calculate how much memory my textures will use when uploaded to OpenGL. I want to know if I can get the exact OpenGL used memory amount from the device. I would like to avoid looking at the Real Memory and Virtual Memory columns in the Memory Monitor widget on Instruments (my

Usage of gluUnProject

社会主义新天地 提交于 2019-12-06 11:39:37
问题 i'm using gluUnProject coverting sreen coordinates to world coordinates, but unfortunetaly i get to small value as a return. It converts (0,0) to about (-0.80,0.40), but it should convert to about (4,2)... The code: ((GL11) gl).glGetIntegerv(GL11.GL_VIEWPORT, viewport, 0); ((GL11) gl).glGetFloatv(GL11.GL_MODELVIEW_MATRIX, modelViewMatrix, 0); ((GL11) gl).glGetFloatv(GL11.GL_PROJECTION_MATRIX, projectionMatrix, 0); GLU.gluUnProject(main.x, main.y, 1, modelViewMatrix, 0, projectionMatrix, 0,