opengl-es

Convert a “normal” rectangle to a set of GLes vectors?

孤街浪徒 提交于 2019-12-24 11:09:12
问题 How would I convert a "normal" rectangle into a set of OpenGL ES vertices. I'm not good at geometry so I have no idea how vertices work, and I want to be able to manipulate rectangles without having to work out the values for the vertices by trial and error. I basically need to convert this structure: typedef struct __nrect { float width; float height; float depth; /* center */ float x; float y; float z; } simple3dRect; To something like this: const GLfloat cubeVertices[6][12] = { { 1,-1, 1,

Record frames displayed on TextureView to mp4

纵饮孤独 提交于 2019-12-24 10:48:01
问题 I managed to write a demo displaying a 3D model on TextureView and the model can move according to the sensors of the phone. The 3D engine is wrote by C++ and what I need to do is giving the SurfaceTexture of TextureView to the 3D engine. The engine calls the function ANativeWindow_fromSurface to retrieve a native window and draw 3D model on it. 3D engine is not the key point I want to talk about in this question. Now I want to record the moving 3d model to a video. One way is using GL

Undo drawing in Paint Application

时光怂恿深爱的人放手 提交于 2019-12-24 10:35:52
问题 I am making a paint application using OpenGl framework and I'm stuck at UNDO/REDO option.. The code I implemented is like this: -(void)undo_called { artbrushAppDelegate *app=(artbrushAppDelegate *)[[UIApplication sharedApplication]delegate]; mbrushscale=app.brushscale; brushimage=app.brush_image; Erase=YES; [self playRayundo]; } -(void)playRayundo { artbrushAppDelegate *app=(artbrushAppDelegate *)[[UIApplication sharedApplication]delegate]; glColor4f(app.r1g, app.b1g, app.g1g, 0); NSLog(@"%f"

WebGL: drawArrays: attribs not setup correctly

我怕爱的太早我们不能终老 提交于 2019-12-24 10:09:45
问题 Here's my vertex shader: attribute vec3 aVertexPosition; attribute vec4 aVertexColor; attribute float type; uniform mat4 uMVMatrix; uniform mat4 uPMatrix; varying vec4 vColor; void main(void) { gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0); vColor = aVertexColor; if(type > 0.0) { } else { } } What I want to do is pretty simple, just capture a float value named type and use it for logic operates. The problem is, when I try to use it in Javascript, the error comes:

iPhone OpenGL ES missing functions should be there - glBlendFuncSeparate etc

天大地大妈咪最大 提交于 2019-12-24 09:39:23
问题 I'm using OpenGL ES 1.1 on the iPhone, and I'd like to use the following functions: glBlendFuncSeparate glBlendColor With their related constants. These didn't exist in early iPhone GL implementations, but according to this page: http://developer.apple.com/iphone/library/releasenotes/General/iPhone30APIDiffs/index.html they should be there in 3.0+, which I'm building for. But I'm getting "implicit definition" warnings. What do I need to do to get those functions? Thanks! 回答1: These functions

OpenGL ES (on iOS): EXC_BAD_ACCESS on glDrawArrays call for sphere drawing

我是研究僧i 提交于 2019-12-24 08:47:21
问题 I'm in need of a procedurally-generated OpenGL ES sphere - I googled around and discovered this OGL code, and decided it looked neat so I'd modify it to be OGLES instead. I eliminated the OGL-only glBegin(), glEnd() and modified the original drawtri and drawsphere to be generatetri and generateSpherePoints. These new functions assign GLfloat values into static arrays for the sphere normals and vertices, meaning I can then call a new function drawSphere() at whim and the points needn't be

Limit touch area to Texture area in libgdx

╄→гoц情女王★ 提交于 2019-12-24 08:28:20
问题 I load textures and convert them to sprites. The image below shows how typical sprite looks like. The shapes varies from sprites to sprite. I wont to move these sprites when user touches just the surface area. Currently I am using rectangle bounds to detect if user touched it or not. This approach is not clean becuase the texture is not a rectangle. As a consequence users can drag it without precisely touching it. The question is how to create a touch area just to represent the texture area

CNC Milling Tool material representation

别来无恙 提交于 2019-12-24 08:15:09
问题 I'm writting CNC simulator for 3-axis milling tool. At first attempt I have represented the material as WxHxD box (W - width, H- height, D - depth) with W and D divisor parameters. So for example W = D = 120, H = 50, W-div = 20, D-div = 20: At each step the mill is removing material and H coordinate at each division point is adjusted simulating material removal: This method is OK for started. But to simulate full precision of milling tool the divisors should have hight values, i.e. for

The LookAt target location doesn't matter if it is z = 0 or z = 1000 or -1000?

旧街凉风 提交于 2019-12-24 07:59:34
问题 I am trying LookAt in OpenGL ES, gluLookAt(512, 384, 2000, 512, 384, 0, 0.0f, 1.0f, 0.0f); The second row is the Target's position... so I wonder, if I change the z from 0 to 1000 or -1000 , shouldn't what is seen different? They turn out to be all the same, why is that? 回答1: From the OpenGL spec for gluLookAt, it states the inputs as: gluLookAt(GLdouble eyeX , GLdouble eyeY , GLdouble eyeZ , GLdouble centerX , GLdouble centerY , GLdouble centerZ , GLdouble upX , GLdouble upY , GLdouble upZ )

Suitability of using Core Animation on iOS vs using Cocos2D and OpenGL ES?

做~自己de王妃 提交于 2019-12-24 07:59:28
问题 I finished a breakout game tutorial in a book, but the ball, which is a 20x20 pixel image, was skipping frames and not moving very smoothly. That is the case on the Simulator as well as on an iPhone 4S (the real thing). The code wasn't using NSTimer (which may be slower), but was using CADisplayLink and UIImageView setFrame to do the animation. Is Core Animation on iOS not very suitable for development animation type of games? Say if it is a game of Invaders (Space Invaders) Breakout (as a