opengl-es

How to draw anti-aliased circle with iPhone OpenGL ES

There are three main ways I know of to draw a simple circle in OpenGL ES, as provided by the iPhone. They are all based on a simple algorithm (the VBO version is below). void circleBufferData(GLenum target, float radius, GLsizei count, GLenum usage) { const int segments = count - 2; const float coefficient = 2.0f * (float) M_PI / ...

How to structure simple Android apps.

I've run into an organizational problem with an application I am working on, on the Android platform. The application uses sensors as input and OpenGL as output. The traditional method is something like organizing the project into an MVC where I have the main activity class load an OpenGL view and a sensor handling class and will then...

Repeated calls to glVertexPointer and glDraw

I'm using OpenGL ES on Android to draw some shapes, so I have some Model classes to load the vertices etc from an .obj file. Each model then has a onDrawFrame() method which is called by the Renderer to place it in the scene. public void onDrawFrame(GL10 gl) { gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnable(GL10.GL_CU...

GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT when trying to attach texture

Hey guys, I get an error "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT" after I try to create a framebuffer that renders to a texture. Here's the code: //Bad code is bad I can't figure out what is wrong, any help is greatly appreciated. If I need to provide more code I'll gladly do so. Fixed it! Working code: glGenTextures(1, &text...

How can I use MailComposerViewController in an OpenGL ES based iPhone app?

I'm adding a "Tell a friend" feature to an OpenGL ES based iPhone app. When the user taps a "button" (something drawn using OpenGL... not something from Interface Builder) I want to present a pre-populated email composer. How can I do this? I'm currently trying to use MailComposerViewController from the Apple sample code. I just don'...

CAEAGLLAYER renderbuffer and UIView animation conflicting

I have a CAEAGLLAYER in a normal UIView created using: + (Class)layerClass { return [CAEAGLLayer class]; } I have a method - (void)renderExistingPointsFromModel That gets points from a database and renders it by presenting the renderbuffer at the end. A parent controller calls this method by: [drawingCanvasView renderExistingPoi...

replace specific color in openGl drawing in xcode?

Hi i building a drawing app that uses openGl. i am new to openGL but managed to build the basic app. I am now working on the ability of the user to save the drawings to camera roll. i have a view that holds an image that the user uses to draw, so it have to be visible but not affected from the drawing canvas. a bove it i have a view...

iPhone OpenGLES texture loading issue with transparency

Hey, I've been using this method (I think I got it from one of Apple's example code projects): - (void)loadTexture:(NSString *)name intoLocation:(GLuint)location { CGImageRef textureImage = [UIImage imageNamed:name].CGImage; if(textureImage == nil) { NSLog(@"Failed to load texture!"); return; } NSInteger texWidth = CGImageG...

Load an OpenGl view in the background. iPhone

I have an OpenGL view that renders a 3D model. It is a basic modification on Apples EAGLView. This view is added to a controller's .view and displayed with presentModalViewController: . I would like to do all of the model loading, and OpenGL state configuration in a background thread at app launch before the user chooses to display the v...

android/opengles alpha textures not semitransparent but binary transparent

Hello, I am drawing some textures with alpha channel, but when they are displayed it looks like the alpha channel is only binary. So a pixel is either transparent or opaque, although in the texture file itself the pixel is half-transparent. The blending is set up like this: gl.glEnable(GL10.GL_BLEND); gl.glBlendFunc(GL10.GL_ONE, GL10....

Making UITableView with cell-sized images smooth scrolled

EVERYTHING WRITTEN HERE ACTUALLY WORKS RIGHT EXEPT FOR [UIImage imageNamed:] METHOD USAGE Implementation I am using model in witch you have a custom UITableViewCell with one custom UIView set up as Cell's backgroundView. Custom UIView contains two Cell-sized images (320x80 px), one of which is 100% transparent to half of the view....

Draw calls take WAY longer when targeting an offscreen renderbuffer (iPhone GL ES)

I'm using OpenGL ES 1.1 to render a large view in an iPhone app. I have a "screenshot"/"save" function, which basically creates a new GL context offscreen, and then takes exactly the same geometry and renders it to the offscreen context. This produces the expected result. Yet for reasons I don't understand, the amount of time (measured ...

Objective-C arrays and class variables

I am porting an Android app I made to iPhone and running into problems with the syntax (I think) I'm basing the project off of the example from http://iphonedevelopment.blogspot.com/2009/04/opengl-es-from-ground-up-part-2-look-at.html I would like to pull out the geometry from the rendering process to keep the code modular but I can'...

Question about variable constructors:

If... vec3 myVec3 = vec3(1.0, 0.0, 0.5); // myVec3 = {1.0, 0.0, 0.5} vec3 temp = vec3(myVec3); // temp = myVec3 vec2 myVec2 = vec2(myVec3); // myVec2 = {myVec3.x, myVec3.y} myVec4 = vec4(myVec2, temp, 0.0); // myVec4 = {myVec2.x, myVec2.y, temp.x, 0.0} Then what does the following represent? myVec4 = vec4(temp, myVec2, 0.0); // myVe...

OpenGL ES 2.0 book, bottom of pg. 95:

I don't get this concept at all: ...you should not use more uniforms or varyings than would exceed the minimum allowed storage sizes after packing. Shouldn't that be 'maximum'? (Or conversely 'less'?) ...

Flame transition effect for iphone image

How would you impelement the following? 1. Image is loaded from a file 2. On Touch the picture burns in flame. 3. Next picture loads from another file. How would you make the flame transition? ...

Texture format for cellular automata in OpenGL ES 2.0

I need some quick advice. I would like to simulate a cellular automata (from A Simple, Efficient Method for Realistic Animation of Clouds) on the GPU. However, I am limited to OpenGL ES 2.0 shaders (in WebGL) which does not support any bitwise operations. Since every cell in this cellular automata represents a boolean value, storing 1 ...

Do the emulated samples from the 'gold' book or from ImgTec work on any of your 64-bit Win 7 machines?

Either the OpenGL_ES_Programming_Guide_v1.0.2 samples or the Imagination Technologies\POWERVR SDK\OGLES2_WINDOWS_PCEMULATION_2.06.26.0649\Binaries\Demos? Either or both above using either AMD's OpenGL ES 2.0 emulator or Imagination Technologies' PVRVFrame emulator? Does anybody see runtime activity other than blank client areas with no...

autocad dxf files displayed in opengl/opengl es

Hey, I'm wondering if there is a way to extract the necessary data out of an autocad .dxf file, so I can visualize the structure in opengl? I've found some old cold snippets for windows written in cpp but since the standard changes I assume 15 yr old code is a little outdated. Also, there is a book about the .dxf file standard but it'...

OpenGL ES color picking on the iPhone

I'm looking into 3D on the iPhone, I have managed to get a 3D cube on the device but would like to add interactivity such as touching one face fires a specific event and an other face a different event. I'd rather steer clear of ray picking as this adds extra complexity that I do not want in my app. I've read up on quite a few color pic...