opengl-es

Lighting and OpenGL ES

随声附和 提交于 2019-12-23 02:48:05
问题 I'm working on getting a simple lighting right on my OpenGL ES iPhone scene. I'm displaying a simple object centered on the origin, and using an arcball to rotate it by touching the screen. All this works nicely, except I try to add one fixed light (fixed w.r.t. eye position) and it is badly screwed: the whole object (an icosahedron in this example) is lit uniformly, i.e. it all appears in the same color. I have simplified my code as much as possible so it's standalone and still reproduces

OpenGL 2.0 Drawing with Monodroid (using OpenTK)

孤人 提交于 2019-12-23 02:36:57
问题 I'm attempting to setup a cross platform application that uses OpenTK-1.0 to draw some basic 3D objects using the programmable pipeline approach in OpenGL ES 2.0. I have the iOS side of the application working perfectly but the Android facing application keeps hitting calling unimplemented OpenGL ES API errors. I believe this is happening because the Android side of the application is not being setup properly to target OpenGL ES 2.0. I've updated the AndroidManifest.xml with the appropriate

In opengl, How can I get relation between pixels and gl.gltranslatef(floatx,y,z)?

て烟熏妆下的殇ゞ 提交于 2019-12-22 18:25:01
问题 I am trying to learn opengl stuff on Android. In the gl.gltranslatef(x,y,z) call, I am shifting my texture by some units in the +ve x direction. But I am unable to find the number of pixels does 1 unit of x belong to? Here is what I am doing: I call gl.glviewport(0,0,width,height); // This will set my rectangle with 0,0 as lowerleft corner and then extend it to accommodate width and height. Then I call to gl.glfrustrum(-5,5,-7,7,3,7); // I am little confused how this call is using the

CALayer OpenGL(-ES) texture memory usage

夙愿已清 提交于 2019-12-22 18:17:18
问题 I have an iPhone app that uses too much texture memory. I am trying to figure out which of the app's CALayers uses too much texture memory. Unfortunately, I cannot figure out how much texture memory a specific CALayer is using. Are there any good tricks I can use ? 来源: https://stackoverflow.com/questions/8214884/calayer-opengl-es-texture-memory-usage

interpolated texture coordinates

余生长醉 提交于 2019-12-22 18:14:42
问题 I am working on an OpenGL ES fluid simulation which uses texture maps to hold grid values. I need to iterate thru the grid that mimics the following loop: for (int r = 0; r < 128; r++) for (int c = 0; c < 128; c++) process grid element at (c,r) To iterate through the grid I am simply filling a quadrilateral which causes my fragment program to be invoked for each fragment. The texture coordinates (0,0), (1,0), (0,1), (1,1) are associated with the vertices (-1,-1), (+1,-1), (-1,+1), (+1,+1) and

Rendering to depth texture - unclarities about usage of GL_OES_depth_texture

旧时模样 提交于 2019-12-22 18:03:17
问题 I'm trying to replace OpenGL's gl_FragDepth feature which is missing in OpenGL ES 2.0. I need a way to set the depth in the fragment shader, because setting it in the vertex shader is not accurate enough for my purpose. AFAIK the only way to do that is by having a render-to-texture framebuffer on which a first rendering pass is done. This depth texture stores the depth values for each pixel on the screen. Then, the depth texture is attached in the final rendering pass, so the final renderer

how to convert AVFrame to texture used by glTexImage2D?

做~自己de王妃 提交于 2019-12-22 17:59:21
问题 as you know that AVFrame has 2 property:pFrame->data, pFrame->linesize. After i read frame from video /sdcard/test.mp4 (android platform), and convert to RGB AVFrame vice: img_convert_ctx = sws_getContext(pCodecCtx->width, pCodecCtx->height, pCodecCtx->pix_fmt, target_width, target_height, PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL); if(img_convert_ctx == NULL) { LOGE("could not initialize conversion context\n"); return; } sws_scale(img_convert_ctx, (const uint8_t* const*)pFrame->data,

Android opengl modify vertex array after draw call

我们两清 提交于 2019-12-22 17:46:12
问题 In opengl, is it bad practice or not recommended to modify the vertex array after I have drawn it? 回答1: 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

How do you represent a normal or texture coordinate using GLshorts?

纵饮孤独 提交于 2019-12-22 14:14:18
问题 A lot of suggestions on improving the performance in iPhone games revolve around sending less data to the GPU. The obvious suggestion is to use GLshorts instead of GLfloat wherever possible, such as for vertices, normals, or texture coordinates. What are the specifics when using a GLshort for a normal or a texture coordinate? Is it possible to represent a GLfloat texture coordinate of 0.5 when using a GLshort? If so, how do you do that? Would it just be SHRT_MAX/2? That is, does the range of

OpenGL ES: Rotating 3d model around itself

喜欢而已 提交于 2019-12-22 14:12:13
问题 I'm playing with OpenGL ES on iPhone and I'm trying to rotate a model by panning with the finger. I discovered the open source app Molecules that let's you do that and I'm looking at that code, but when it comes to rotate a model of mine I'm able to rotate it only around a point distant in the space (like it was in orbit as a satellite and I am the fixed planet). Any suggestion on what can be wrong? I can post the code later , maybe on demand (many lines) For the most part refer to Molecules