Search Results

Search found 2513 results on 101 pages for 'opengl 3'.

Page 69/101 | < Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >

  • Android source code not working, reading frame buffer through glReadPixels

    - by Muhammad Ali Rajput
    Hi, I am new to Android development and have an assignment to read frame buffer data after a specified interval of time. I have come up with the following code: public class mainActivity extends Activity { Bitmap mSavedBM; private EGL10 egl; private EGLDisplay display; private EGLConfig config; private EGLSurface surface; private EGLContext eglContext; private GL11 gl; protected int width, height; //Called when the activity is first created. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // get the screen width and height DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); int screenWidth = dm.widthPixels; int screenHeight = dm.heightPixels; String SCREENSHOT_DIR = "/screenshots"; initGLFr(); //GlView initialized. savePixels( 0, 10, screenWidth, screenHeight, gl); //this gets the screen to the mSavedBM. saveBitmap(mSavedBM, SCREENSHOT_DIR, "capturedImage"); //Now we need to save the bitmap (the screen capture) to some location. setContentView(R.layout.main); //This displays the content on the screen } private void initGLFr() { egl = (EGL10) EGLContext.getEGL(); display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); int[] ver = new int[2]; egl.eglInitialize(display, ver); int[] configSpec = {EGL10.EGL_NONE}; EGLConfig[] configOut = new EGLConfig[1]; int[] nConfig = new int[1]; egl.eglChooseConfig(display, configSpec, configOut, 1, nConfig); config = configOut[0]; eglContext = egl.eglCreateContext(display, config, EGL10.EGL_NO_CONTEXT, null); surface = egl.eglCreateWindowSurface(display, config, SurfaceHolder.SURFACE_TYPE_GPU, null); egl.eglMakeCurrent(display, surface, surface, eglContext); gl = (GL11) eglContext.getGL(); } public void savePixels(int x, int y, int w, int h, GL10 gl) { if (gl == null) return; synchronized (this) { if (mSavedBM != null) { mSavedBM.recycle(); mSavedBM = null; } } int b[] = new int[w * (y + h)]; int bt[] = new int[w * h]; IntBuffer ib = IntBuffer.wrap(b); ib.position(0); gl.glReadPixels(x, 0, w, y + h, GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,ib); for (int i = 0, k = 0; i < h; i++, k++) { //OpenGLbitmap is incompatible with Android bitmap //and so, some corrections need to be done. for (int j = 0; j < w; j++) { int pix = b[i * w + j]; int pb = (pix >> 16) & 0xff; int pr = (pix << 16) & 0x00ff0000; int pix1 = (pix & 0xff00ff00) | pr | pb; bt[(h - k - 1) * w + j] = pix1; } } Bitmap sb = Bitmap.createBitmap(bt, w, h, Bitmap.Config.ARGB_8888); synchronized (this) { mSavedBM = sb; } } static String saveBitmap(Bitmap bitmap, String dir, String baseName) { try { File sdcard = Environment.getExternalStorageDirectory(); File pictureDir = new File(sdcard, dir); pictureDir.mkdirs(); File f = null; for (int i = 1; i < 200; ++i) { String name = baseName + i + ".png"; f = new File(pictureDir, name); if (!f.exists()) { break; } } if (!f.exists()) { String name = f.getAbsolutePath(); FileOutputStream fos = new FileOutputStream(name); bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos); fos.flush(); fos.close(); return name; } } catch (Exception e) { } finally { //if (fos != null) { // fos.close(); // } } return null; } } Also, if some one can direct me to better way to read the framebuffer it would be great. I am using Android 2.2 and virtual device of API level 8. I have gone through many previous discussions and have found that we can not know read frame buffer directly throuh the "/dev/graphics/fb0". Thanks, Muhammad Ali

    Read the article

  • iphone: how to do Page turning

    - by srnm12
    hi frnds, I am facing the problem from a month and didn't find anything from google.. I am using UIView for pdf display. there is no problem with pdf but problem is with transition. I have to turn each page of pdf with realistic page turn exp. I search, dig a lot about that but i didn't get anything that how to do that. I don't want to use any API'S like codeflake or any other. all i want to do this by my own programming. First i read that this can be done using cocos2d or CAAnimation but i want to know how? b'coz realistic page i think so is completely 3d concept. Let me know guys how to do thay?? here's the example video: http://www.youtube.com/watch?v=oknMWvRO2XE I want animation just like in video....

    Read the article

  • High CPU Usage with WebGL?

    - by shoosh
    I'm checking out the nightly builds of Firefox and Chromium with support of WebGL with a few demos and tutorials and I can't help but wonder about the extremely high CPU load they cause. A simple demo like this one runs at a sustained 60% of my dual core. The large version of this one maxes out the CPU to 100% and has some visible frame loss. Chromium seems to be slightly better than firefox but not by much. I'm pretty sure that if these were desktop application the CPU load would be negligible. So what's going on here? what is it doing? Running the simple scripts of these can't be that demanding. Is it the extra layer of security or something?

    Read the article

  • How can I successfully perform hidden line removal after pass through FBO?

    - by Brett
    Hi All, I'm trying to perform hidden line removal using polygon offset fill. The code works perfectly if I render directly to the window buffer but fails to draw the lines when passed through a FBO as shown below The code I use to draw the objects void drawCubes (GLboolean removeHiddenLines) { glLineWidth(2.0); glPushMatrix(); camera.ApplyCameraTransform(); for(int i = 0; i < 50; i ++){ glPushMatrix(); cube[i].updatePerspective(); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glColor3f(1.0,1.0,1.0); cube[i].draw(); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); if(removeHiddenLines){ glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(1.0, 1.0); glColor3f(1.0, 0.0, 0.0); //fill polygons for hidden line removal cube[i].draw(); glDisable(GL_POLYGON_OFFSET_FILL); } glPopMatrix(); } glPopMatrix(); } For this example, the first pass involves rendering to both the window buffer and a FBO. void firstPass() { glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glViewport(0, 0, fboWidth, fboHeight); glEnable(GL_DEPTH_TEST); glDisable(GL_TEXTURE_2D); drawParticleView(GL_TRUE); glDisable(GL_DEPTH_TEST); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebufferID[0]); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glViewport(0, 0, fboWidth, fboHeight); glEnable(GL_DEPTH_TEST); glDisable(GL_TEXTURE_2D); drawParticleView(GL_TRUE); glDisable(GL_DEPTH_TEST); } Second pass renders FBO back to window buffer. void secondPass() { glEnable(GL_TEXTURE_2D); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glBindTexture(GL_TEXTURE_2D, renderTextureID[0]); glViewport(fboWidth, 0, fboWidth, fboHeight); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glBegin(GL_QUADS); glTexCoord2i(0, 0); glVertex2f(-1.0f, -1.0f); glTexCoord2i(1, 0); glVertex2f(1.0f, -1.0f); glTexCoord2i(1, 1); glVertex2f(1.0f, 1.0f); glTexCoord2i(0, 1); glVertex2f(-1.0f, 1.0f); glEnd(); glDisable(GL_TEXTURE_2D); } I don't understand why the two views wouldn't be the same? Am I missing something (obviously I am)? Thanks

    Read the article

  • iPhone Game Developers - What does your toolchain look like?

    - by slf
    For example: source control: git + adobe drive 3d: google sketchup - *.dae - blender - *.obj 2d: photoshop/illustrator - *.png audio: audacity - *.caf code: ArgoUML, Xcode, Textmate test: OCUnit build: rake, Xcode Feel free to mention any other tools that you think are awesome :) Changed to Community Wiki

    Read the article

  • Why I add the CGPoint in the NSMultable Array?

    - by Tattat
    I want to store my CGPoint to the NSMultable Array, so , I have method like this: [self.points addObject:CGPointMake(x, y)]; But I got the error, it said that : Incompatible type for argument 1 of "addObject". So, I check out the API, (void)addObject:(id)anObject anObject The object to add to the end of the receiver's content. This value must not be nil. So, I think the "CGPointMake" can make a Object, but it can't be assigned. What happens?

    Read the article

  • Why when I render a scene with a revolving camera objects that you'd expect to appear behind others

    - by seaworthy
    Hello, I am rendering a scene in which I have two spheres. I am revolving a camera around one of them. What happens is counter-intuitive. When the camera goes around the sphere the other gets in front of it when you'd expect it to be behind. So it appears as though the spheres aren't revolving around each other and the one the should go around is always upfront. Please help. Here is the code that renders the scene: glLoadIdentity(); [self positionCamera]; glutSolidSphere(2, 12,12); glPushMatrix(); glTranslatef(5, 0, 0); glutSolidSphere(0.5, 12,12); glPopMatrix(); glFlush(); This block is part of a class that gets called on using. [NSTimer scheduledTimerWithTimeInterval:DEFAULT_ANIMATION_INTERVAL target:self selector:@selector(drawRect) userInfo:nil repeats:YES]; And -(void)positionCamera{} Contains math do camera revolution and gluLookAt()

    Read the article

  • GLTessellator crashing

    - by user146780
    I'v followed a tutorial to get the GLU tesselator working. It woulds except the interpolation for colors of new points causes a crash (error reading from memory...) This is my callback where it crashes: void CALLBACK combineCallback(GLdouble coords[3], GLdouble *vertex_data[4], GLfloat weight[4], GLdouble **dataOut) { GLdouble *vertex; int i; vertex = (GLdouble *) malloc(6 * sizeof(GLdouble)); vertex[0] = coords[0]; vertex[1] = coords[1]; vertex[2] = coords[2]; //crashes here **for (int i = 3; i < 6; i++) { vertex[i] = weight[0] * vertex_data[0][i] + weight[1] * vertex_data[1][i] + weight[2] * vertex_data[2][i] + weight[3] * vertex_data[3][i]; }** //crashes here *dataOut = vertex; } I looked at memory when it crashes but can't put my finger on exactly what triggers it. I followed this tutorial: http://www.flipcode.com/archives/Polygon_Tessellation_In_OpenGL.shtml Thanks

    Read the article

  • Is it possible to restore a previous GL framebuffer?

    - by Rob
    Hi there, I'm working on an iPhone app that lets the user draw using GL. I used the GLPaint sample code project as a firm foundation, but now I want to add the ability for the user to load one of their previous drawings and continue working on it. I know how to get the framebuffer contents and save it as a UIImage. Is there a way for me to take the UIImage and tell GL to draw that? Any help is much appreciated.

    Read the article

  • Visualize the depth buffer

    - by Thanatos
    I'm attempting to visualize the depth buffer for debugging purposes, by drawing it on top of the actual rendering when a key is pressed. It's mostly working, but the resulting image appears to be zoomed in. (It's not just the original image, in an odd grayscale) Why is it not the same size as the color buffer? This is what I'm using the view the depth buffer: void get_gl_size(int &width, int &height) { int iv[4]; glGetIntegerv(GL_VIEWPORT, iv); width = iv[2]; height = iv[3]; } void visualize_depth_buffer() { int width, height; get_gl_size(width, height); float *data = new float[width * height]; glReadPixels(0, 0, width, height, GL_DEPTH_COMPONENT, GL_FLOAT, data); glDrawPixels(width, height, GL_LUMINANCE, GL_FLOAT, data); delete [] data; }

    Read the article

  • Does this code follow the definition of recursion?

    - by dekz
    Hi All, I have a piece of code which I am doubting it as a implementation of recursion by its definition. My understanding is that the code must call itself, the exact same function. I also question whether writing the code this way adds additional overhead which can be seen with the use of recursion. What are your thoughts? class dhObject { public: dhObject** children; int numChildren; GLdouble linkLength; //ai GLdouble theta; //angle of rot about the z axis GLdouble twist; //about the x axis GLdouble displacement; // displacement from the end point of prev along z GLdouble thetaMax; GLdouble thetaMin; GLdouble thetaInc; GLdouble direction; dhObject(ifstream &fin) { fin >> numChildren >> linkLength >> theta >> twist >> displacement >> thetaMax >> thetaMin; //std::cout << numChildren << std::endl; direction = 1; thetaInc = 1.0; if (numChildren > 0) { children = new dhObject*[numChildren]; for(int i = 0; i < numChildren; ++i) { children[i] = new dhObject(fin); } } } void traverse(void) { glPushMatrix(); //draw move initial and draw transform(); draw(); //draw children for(int i = 0; i < numChildren; ++i) { children[i]->traverse(); } glPopMatrix(); } void update(void) { //Update the animation, if it has finished all animation go backwards if (theta <= thetaMin) { thetaInc = 1.0; } else if (theta >= thetaMax) { thetaInc = -1.0; } theta += thetaInc; //std::cout << thetaMin << " " << theta << " " << thetaMax << std::endl; for(int i = 0; i < numChildren; ++i) { children[i]->update(); } } void draw(void) { glPushMatrix(); glColor3f (0.0f,0.0f,1.0f); glutSolidCube(0.1); glPopMatrix(); } void transform(void) { //Move in the correct way, R, T, T, R glRotatef(theta, 0, 0, 1.0); glTranslatef(0,0,displacement); glTranslatef(linkLength, 0,0); glRotatef(twist, 1.0,0.0,0.0); } };

    Read the article

  • Problem with glaux.h locating

    - by rodnower
    Hello, I try to compile code, that beggins with: #include<stdlib.h> #include<GL/gl.h> #include<glaux.h> with command: cc -o test test.c -I/usr/local/include -L/usr/local/lib -lMesaaux -lMesatk -lMesaGL -lXext -lX11 -lm But one of errors I got is: test.c:3:18: error: glaux.h: No such file or directory Then I try: yum provides glaux.h but yum find anything. Before all I installed Mesa with: yum install mesa* So, can anyone tell me from where I can get the header file? Thank you for ahead.

    Read the article

  • Why does UIImageView "darken"/saturate PNG images, and can I stop it?

    - by Ben
    I have a PNG file in a UIImageView, and next to that I have an EAGLView which displays the continuation of that same image (long story) as a texture, carved from the same original PNG. The point is, that these images, which should match up flawlessly, actually have somewhat differing color saturation. Normally I'd blame my handling of the PNG texture load in GL, but when I hold Preview (with the PNG) up to the iPhone simulator, it's GL that's spot on, and the UIImageView that's wrong! It's taken the image and made it ever-so-slightly more saturated. The image view is opaque with 100% alpha. I verified this on a clean UIImageView with another PNG file when put next to Preview. Anyone know what's up?

    Read the article

  • uniform generation of points on 3D box

    - by Myx
    Hello: I would like to generate random points on a 3D box defined by its (minx, miny, minz) and (maxx, maxy, maxz) corners. I was thinking of generating a random point inside of the box and then somehow projecting it onto one of the box sides. However, I don't have explicit plane information for the box sides and this seems like it will not produce a uniform distribution of points since if some sides of the box are bigger than others, those sides should have more points generated on them. Any suggestions are appreciated. Thanks.

    Read the article

  • Python: OSX Library for fast full screen jpg/png display

    - by Parand
    Frustrated by lack of a simple ACDSee equivalent for OS X, I'm looking to hack one up for myself. I'm looking for a gui library that accommodates: Full screen image display High quality image fit-to-screen (for display) Low memory usage Fast display Reasonable learning curve (the simpler the better) Looks like there are several choices, so which is the best? Here are some I've run across: PyOpenGL PyGame PyQT wxpython I don't have any particular experience with any of these, nor any strong desire to become an expert - I'm looking for the simplest solution. What do you recommend? [Update] For those not familiar with ACDSee, here's what it does that I care about: Simple list/thubmnail display of images in a directory Sort by name/size/type Ability to view images full screen Single-key delete while viewing full screen Move to next/previous image while viewing full screen Ability to select a group of images for: move to / copy to directory delete resize ACDSee has a bunch of niceties as well, such as remembering directories you've moved images to in the past, remembering your resize settings, displaying the total size of the images you've selected, etc. I've tried most of the options I could find (including Xee) and none of them quite get there. Please keep in mind that this is a programming/library question, not a criticism of any of the existing tools.

    Read the article

  • using a texture mesh and wireframe mesh in threejs

    - by Andy Poes
    I'm trying to draw a wireframe mesh and a textured mesh in threeJS but when I have both added to my scene the textured mesh doesn't display. Code below: I'm having trouble creating two meshes that share the same geometry where one of the materials is wireframe and the other is a texture. If one of the materials is wireframe and the other is just a color fill it works fine- but as soon as I make the second material a texture it stops working. If I comment out scene.add( wireMesh ); then the textured mesh shows up. var wireMat = new THREE.MeshBasicMaterial( { color:0x00FFFF, wireframe: true, transparent: true, overdraw:true } ); var wireMesh = new THREE.Mesh(geometry, wireMat); scene.add( wireMesh ); var texture = texture = THREE.ImageUtils.loadTexture( 'textures/world.jpg' ); var imageMat = new THREE.MeshBasicMaterial( {color:0xffffff, map: texture } ); var fillMesh = new THREE.Mesh(geometry, imageMat); scene.add( fillMesh );

    Read the article

  • GLEW + VS2010 error

    - by Egon
    Hi folks, I am running into this issue and don't know what to do ? 'abc.exe': Loaded 'D:\Windows\SysWOW64\nvoglv32.dll', Cannot find or open the PDB file earlier I was getting a whole bunch of errors, but the microsoft symbols source set the issue for all of them except this one file : nvoglv32.dll ; does anybody know how I can resolve this issue or get my hands on the file "nvoglv32.pdb" ? Thanks -A

    Read the article

  • Alternative of touchesMoved in Unity3D

    - by Arman
    - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [[event allTouches] anyObject]; CGPoint location = [touch locationInView:touch.view]; CGPoint xLocation = CGPointMake(location.x,racquet_yellow.center.y); racquet_yellow.center = xLocation; } The above event move recquet_yellow(UIImageView) with mouse pointer, or when I move thumb on iPhone screen, I have 3D Object in Unity3D how can I move my object like recquet_yellow. Kindly guide me.

    Read the article

  • Display object in just a certain viewport

    - by PSilo
    Hi I got 4 viewports and one large that I can switch between now I got an object namely the camera and the cameras target position that I show with rendering a sphere at those locations. I want to show the cameras position in 3 of my viewports but not in the last which is the camera display but at the moment I got an all or nothing scenario. void display(int what) { if(what==5){ glMatrixMode(GL_MODELVIEW); glLoadIdentity(); camControll();} if(what==1){ glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(75,15,-5,0,5,-5,0,1,0);} if(what==2){ glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(0,110,0,0,0,0,1,0,0);} if(what==3){ glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f, float(320) / float(240), 0.1f, 100.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); camControll();} if(what==4){ glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(185,75,25,0,28,0,0,1,0);} //glMatrixMode(GL_MODELVIEW); //glLoadIdentity(); ////gluLookAt(cos(shared.time) * shared.distance, 10, sin(shared.time) * shared.distance, 0, 0, 0, 0, 1, 0); ////ca.orbitYaw(0.05); //ca.lookAt(); glClearColor(0, 0, 0, 1); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); drawScene(); // scene that all views should render drawCamera(); / camera position that only certain views should render glutSwapBuffers(); } I'm thinking that perhaps I could do one sweep for first the 3 viewports and then call glutSwapBuffers() and then do the other viewport without the camera position but some stuttering I previously had was traced to glutSwapBuffers() being called for each viewport so I guess there has to be another way only that I cant figure it out.

    Read the article

  • NSOpenGLView resize on window resize

    - by ADAM
    I have a class called ModelView which inherits from NSOpenGLView. When my program runs i attach the ModelView as follows to the main window. - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application ModelView *glView; NSRect glViewRect = CGRectMake(0.0f, 0.0f, window.frame.size.width, window.frame.size.height); glView = [[ModelView alloc] initWithFrame: glViewRect]; [[window contentView] addSubview:glView]; } In my ModelView class i have a reshape function which is firing every time the window resizes - (void)reshape { [super setNeedsDisplay:YES]; [[self openGLContext] update]; NSLog(@"reshap function called"); } I want to get the main window width so i can resize the ModelView but i cant find how to get the window width from the ModelView class I am reasonably new to cocoa/objective-c Any help appreciated

    Read the article

  • Help using GLOrtho

    - by user146780
    I resize my window like this: RECT clientRect; GetClientRect(mainWindow,&clientRect); glShadeModel(GL_SMOOTH); MoveWindow(framehWnd, toolWidth, tabHeight, ((clientRect.right - clientRect.left) - toolWidth) - rightRemainder , (clientRect.bottom - clientRect.top) - tabHeight - paramHeight, false); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho (0, ((clientRect.right - clientRect.left) - toolWidth) - rightRemainder , (clientRect.bottom - clientRect.top) - tabHeight - paramHeight , 0, 0, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); This works fine except for one thing. Lets say I create a square at 0,0 to 100, 100. I'd like if I resize that it always stays at the top left but right now if I resize it gets pushed up or down instead of staying at the top left. What should I modify? Thanks *I just realized what really would need to happen is for the context to resize, but i'm not sure how to do this without throwing out the OGL context and re initing it.

    Read the article

  • Vertex array with GLUTessellator

    - by user146780
    I notice that every tutorial on setting up the GLUTesselator and its callbacks, use GlBegin, GlEnd and a vertex callback which uses glVertex. It seems to me like this makes it run in immediate mode right? That seems to me as inefficient. How could I set it up to use a vertex array? Could I just use the output from the vertex callback and then generate a vertex array from this data then submit it like I might usually do it? Or is there another, better way of doing this? Thanks

    Read the article

< Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >