Search Results

Search found 1784 results on 72 pages for 'depth'.

Page 13/72 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • MiniMax not working properly(for checkers game)

    - by engineer
    I am creating a checkers game but My miniMax is not functioning properly,it is always switching between two positions for its move(index 20 and 17).Here is my code: public double MiniMax(int[] board, int depth, int turn, int red_best, int black_best) { int source; int dest; double MAX_SCORE=-INFINITY,newScore; int MAX_DEPTH=3; int[] newBoard=new int[32]; generateMoves(board,turn); System.arraycopy(board, 0, newBoard, 0, 32); if(depth==MAX_DEPTH) { return Evaluation(turn,board);} for(int z=0;z<possibleMoves.size();z+=2){ source=Integer.parseInt(possibleMoves.elementAt(z).toString()); System.out.println("SOURCE= "+source); dest=Integer.parseInt(possibleMoves.elementAt(z+1).toString());//(int[])possibleMoves.elementAt(z+1); System.out.println("DEST = "+dest); applyMove(newBoard,source,dest); newScore=MiniMax(newBoard,depth+1,opponent(turn),red_best, black_best); if(newScore>MAX_SCORE) {MAX_SCORE=newScore;maxSource=source; maxDest=dest;}//maxSource and maxDest will be used to perform the move. if (MAX_SCORE > black_best) { if (MAX_SCORE >= red_best) break; /* alpha_beta cutoff */ else black_best = (int) MAX_SCORE; //the_score } if (MAX_SCORE < red_best) { if (MAX_SCORE<= black_best) break; /* alpha_beta cutoff */ else red_best = (int) MAX_SCORE; //the_score } }//for ends return MAX_SCORE; } //end minimax I am unable to find out the logical mistake. Any idea what's going wrong?

    Read the article

  • How to focus on one topic? [closed]

    - by Brian
    I have a huge problem while reading computer books. Every couple pages I'll end up googling something I want to learn more about, but then I'll find something on that page that I'll want to learn more about and google that (sometimes programming related, sometime hardware related). Normally after wasting around 3 hours going into different subjects I'll return to the original text only to repeat the process a few pages later. Any advice for sticking to one subject and learning that in-depth? I have tons of programming books I've read half-way through since I'll become interested in other languages/topics (not that I'm not interested in the books I've started). Also, what would be worth focusing on in depth? I've gone into Python in the most depth but for classes I'm learning Java and assembly (ARM and Motorola 68000). Also, I've taken a class on C++. Lately I've been spending most of my time learning about Linux instead of programming though. I'm not sure what would be worth focusing on the most to get a job. In other words, how can you focus on one topic and not let curiosity about everything else get in the way? Thanks in advance, Brian

    Read the article

  • Understanding IDAT chunk of PNG file format

    - by DRapp
    From the sample image below, I have a border in yellow just for display purposes only. The actual .png file is a simple black/white image 3 pixels by 3 pixels. I was originally thinking to try as a 2x2, but that would not help trying to interpret low/hi vs hi/low drawing stream. At least this way, I would have two black, one white from the top, or one white, two black from the bottom.. So I read the chunks of data, get to the IDAT chunk, decode that (zlib) and come up with 12 bytes as follows 00 20 00 40 00 80 So, my question, how does the above get broken down into the 3x3 black and white sample... Also, it is saved in palette format and properly recognizes the bit depth of 1 and color palette of 2... color pallet[0] is RGBA all zeros. Palette1 has RGBA of 255, 255, 255, 0 I'll eventually get into the multiple other depth formats later, just wanted to start with what would expect to be the easiest. Part II. Any guidance on handling the other depth formats would help if anything special to be considered especially regarding alpha channel (which I am already looking for in the palette) that might trip me up.

    Read the article

  • Sorting for 2D Drawing

    - by Nexian
    okie, looked through quite a few similar questions but still feel the need to ask mine specifically (I know, crazy). Anyhoo: I am drawing a game in 2D (isometric) My objects have their own arrays. (i.e. Tiles[], Objects[], Particles[], etc) I want to have a draw[] array to hold anything that will be drawn. Because it is 2D, I assume I must prioritise depth over any other sorting or things will look weird. My game is turn based so Tiles and Objects won't be changing position every frame. However, Particles probably will. So I am thinking I can populate the draw[] array (probably a vector?) with what is on-screen and have it add/remove object, tile & particle references when I pan the screen or when a tile or object is specifically moved. No idea how often I'm going to have to update for particles right now. I want to do this because my game may have many thousands of objects and I want to iterate through as few as possible when drawing. I plan to give each element a depth value to sort by. So, my questions: Does the above method sound like a good way to deal with the actual drawing? What is the most efficient way to sort a vector? Most of the time it wont require efficiency. But for panning the screen it will. And I imagine if I have many particles on screen moving across multiple tiles, it may happen quite often. For reference, my screen will be drawing about 2,800 objects at any one time. When panning, it will be adding/removing about ~200 elements every second, and each new element will need adding in the correct location based on depth.

    Read the article

  • radeon display driver clones monitors while using Xinerama

    - by gregmuellegger
    I'm trying to get my two Radeon HD 4770 cards working with three monitors. Xinerama works so far in the way that I have two fully working monitors were I can move windows from one to the other. My problem now is that my third monitor is a clone of my second monitor (displaying the exact same thing). These monitors are connected to the same graphic card ("Screen Middle" and "Screen Right" in the xorg.conf below). Here is my xorg.conf: Section "ServerLayout" Identifier "ThreeMonitors" Screen "Screen Left" 0 0 Screen "Screen Middle" RightOf "Screen Left" Screen "Screen Right" RightOf "Screen Middle" Option "Xinerama" EndSection Section "Monitor" Identifier "Monitor Left" Option "DPMS" EndSection Section "Monitor" Identifier "Monitor Middle" Option "DPMS" EndSection Section "Monitor" Identifier "Monitor Right" Option "DPMS" EndSection Section "Device" Identifier "Device Left" Driver "radeon" VendorName "ATI Technologies Inc" BoardName "ATI Radeon HD 4770 [RV740]" BusID "PCI:3:0:0" Screen 0 EndSection Section "Screen" Identifier "Screen Left" Device "Device Left" Monitor "Monitor Left" SubSection "Display" Depth 24 EndSubSection EndSection Section "Device" Identifier "Device Middle" Driver "radeon" VendorName "ATI Technologies Inc" BoardName "ATI Radeon HD 4770 [RV740]" BusID "PCI:2:0:0" Screen 0 EndSection Section "Screen" Identifier "Screen Middle" Device "Device Middle" Monitor "Monitor Middle" SubSection "Display" Depth 24 EndSubSection EndSection Section "Device" Identifier "Device Right" Driver "radeon" VendorName "ATI Technologies Inc" BoardName "ATI Radeon HD 4770 [RV740]" BusID "PCI:2:0:1" Screen 1 EndSection Section "Screen" Identifier "Screen Right" Device "Device Right" Monitor "Monitor Right" SubSection "Display" Depth 24 EndSubSection EndSection I'm using a fresh Kubuntu 10.10 installation with propsed-updates enabled since this repo contains a xorg fix for using multiple graphic cards. I hope someone can help me out. Very many thanks!!

    Read the article

  • Multi-screen and Nvidia GT220

    - by Bohors
    Excuse me first for my broken English I have 3 monitors on two Nvidia GT220. Unity 2D works fine after using the proprietary drivers. But no way to use compiz effects. I'm on Ubuntu 11.10 (I also tested for curiosity 12.04 for the same result) I noticed in the "System Settings" / "details" that my graphics card is not recognized (graphics card "unknown") and "View" only returns me my first screen (with the correct resolution) also in unknown. $ lspci | grep VGA 01:00.0 VGA compatible controller: NVIDIA Corporation GT216 [GeForce GT 220] (rev a2) 05:00.0 VGA compatible controller: NVIDIA Corporation GT216 [GeForce GT 220] (rev a2) xorg.conf : Section "ServerLayout" Identifier "Layout0" Screen 0 "Screen0" 0 0 Screen 1 "Screen1" Below "Screen0" Screen 2 "Screen2" RightOf "Screen0" InputDevice "Keyboard0" "CoreKeyboard" InputDevice "Mouse0" "CorePointer" Option "Xinerama" "1" EndSection Section "Files" EndSection Section "InputDevice" # generated from default Identifier "Mouse0" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/psaux" Option "Emulate3Buttons" "no" Option "ZAxisMapping" "4 5" EndSection Section "InputDevice" # generated from default Identifier "Keyboard0" Driver "kbd" EndSection Section "Monitor" # HorizSync source: edid, VertRefresh source: edid Identifier "Monitor0" VendorName "Unknown" ModelName "Acer V243HL" HorizSync 30.0 - 80.0 VertRefresh 55.0 - 75.0 Option "DPMS" EndSection Section "Monitor" # HorizSync source: edid, VertRefresh source: edid Identifier "Monitor1" VendorName "Unknown" ModelName "LG Electronics L1920P" HorizSync 30.0 - 83.0 VertRefresh 56.0 - 75.0 Option "DPMS" EndSection Section "Monitor" # HorizSync source: edid, VertRefresh source: edid Identifier "Monitor2" VendorName "Unknown" ModelName "Acer V243HL" HorizSync 30.0 - 80.0 VertRefresh 55.0 - 75.0 Option "DPMS" EndSection Section "Device" Identifier "Device0" Driver "nvidia" VendorName "NVIDIA Corporation" BoardName "GeForce GT 220" BusID "PCI:1:0:0" EndSection Section "Device" Identifier "Device1" Driver "nvidia" VendorName "NVIDIA Corporation" BoardName "GeForce GT 220" BusID "PCI:5:0:0" Screen 0 EndSection Section "Device" Identifier "Device2" Driver "nvidia" VendorName "NVIDIA Corporation" BoardName "GeForce GT 220" BusID "PCI:5:0:0" Screen 1 EndSection Section "Screen" Identifier "Screen0" Device "Device0" Monitor "Monitor0" DefaultDepth 24 Option "TwinView" "0" Option "TwinViewXineramaInfoOrder" "DFP-0" Option "metamodes" "1920x1080_60_0 +0+0; nvidia-auto-select +0+0" SubSection "Display" Depth 24 EndSubSection EndSection Section "Screen" Identifier "Screen1" Device "Device1" Monitor "Monitor1" DefaultDepth 24 Option "TwinView" "0" Option "metamodes" "CRT: nvidia-auto-select +0+0" SubSection "Display" Depth 24 EndSubSection EndSection Section "Screen" Identifier "Screen2" Device "Device2" Monitor "Monitor2" DefaultDepth 24 Option "TwinView" "0" Option "metamodes" "DFP: nvidia-auto-select +0+0" SubSection "Display" Depth 24 EndSubSection EndSection Section "Extensions" Option "Composite" "Disable" EndSection Have you any idea? thanks

    Read the article

  • How can I render a semi transparent model with OpenGL correctly?

    - by phobitor
    I'm using OpenGL ES 2 and I want to render a simple model with some level of transparency. I'm just starting out with shaders, and I wrote a simple diffuse shader for the model without any issues but I don't know how to add transparency to it. I tried to set my fragment shader's output (gl_FragColor) to a non opaque alpha value but the results weren't too great. It sort of works, but it looks like certain model triangles are only rendered based on the camera position... It's really hard to describe what's wrong so please watch this short video I recorded: http://www.youtube.com/watch?v=s0JqA0rZabE I thought this was a depth testing issue so I tried playing around with enabling/disabling depth testing and back face culling. Enabling back face culling changes the output slightly but the problem in the video is still there. Enabling/disabling depth testing doesn't seem to do anything. Could anyone explain what I'm seeing and how I can add some simple transparency to my model with the shader? I'm not looking for advanced order independent transparency implementations. edit: Vertex Shader: // color varying for fragment shader varying mediump vec3 LightIntensity; varying highp vec3 VertexInModelSpace; void main() { // vec4 LightPosition = vec4(0.0, 0.0, 0.0, 1.0); vec3 LightColor = vec3(1.0, 1.0, 1.0); vec3 DiffuseColor = vec3(1.0, 0.25, 0.0); // find the vector from the given vertex to the light source vec4 vertexInWorldSpace = gl_ModelViewMatrix * vec4(gl_Vertex); vec3 normalInWorldSpace = normalize(gl_NormalMatrix * gl_Normal); vec3 lightDirn = normalize(vec3(LightPosition-vertexInWorldSpace)); // save vertexInWorldSpace VertexInModelSpace = vec3(gl_Vertex); // calculate light intensity LightIntensity = LightColor * DiffuseColor * max(dot(lightDirn,normalInWorldSpace),0.0); // calculate projected vertex position gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; } Fragment Shader: // varying to define color varying vec3 LightIntensity; varying vec3 VertexInModelSpace; void main() { gl_FragColor = vec4(LightIntensity,0.5); }

    Read the article

  • Oracle Internet Directory 11gR1 11.1.1.6 Certified with E-Business Suite

    - by Elke Phelps (Oracle Development)
    Oracle E-Business Suite comes with native user authentication and management capabilities out-of-the-box. If you need more-advanced features, it's also possible to integrate it with Oracle Internet Directory and Oracle Single Sign-On or Oracle Access Manager, which allows you to link the E-Business Suite with third-party tools like Microsoft Active Directory, Windows Kerberos, and CA Netegrity SiteMinder.  For details about third-party integration architectures, see either of these article for EBS 11i and 12: In-Depth: Using Third-Party Identity Managers with E-Business Suite Release 12 In-Depth: Using Third-Party Identity Managers with the E-Business Suite Release 11i Oracle Internet Directory 11.1.1.6 is now certified with Oracle E-Business Suite Release 11i, 12.0 and 12.1.  OID 11.1.1.6 is part of Oracle Fusion Middleware 11g Release 1 Version 11.1.1.6.0, also known as FMW 11g Patchset 5.  Certified E-Business Suite releases are: EBS Release 11i 11.5.10.2 + ATG PH.H RUP 7 and higher EBS Release 12.0.6 and higher EBS Release 12.1.1 and higher Supported Configurations Oracle Internet Directory 11.1.1.5.0 can be integrated with two single sign-on solutions for EBS environments: Oracle Internet Directory and Directory Integration Platform from Fusion Middleware 11gR1 Patchset 5 (11.1.1.6.0) with Oracle Access Manager 10g (10.1.4.3) with an existing Oracle E-Business Suite system (Release 11i or 12.1.x). Oracle Internet Directory and Directory Integration Platform from Fusion Middleware 11gR1 Patchset 5 (11.1.1.6.0) with Oracle Access Manager 11gR1 (11.1.1.5) with an existing Oracle E-Business Suite system (Release 12.0.6 or higher or 12.1.x). Oracle Internet Directory (OID) and Directory Integration Platform (DIP) from Oracle Fusion Middleware 11gR1 Patchset 5  (11.1.1.6.0) with Oracle Single Sign-On Server and Oracle Delegated Administration Services Release 10g (10.1.4.3.0) with an existing Oracle E-Business Suite system (Release 11i, 12.0.6 or 12.1.x) Oracle Access Manager strongly recommended Oracle has two single sign-on solutions: Oracle Single Sign-On Server (OSSO) and Oracle Access Manager (OAM). Oracle strongly recommends that all new single sign-on implementations use Oracle Access Manager. Oracle Access Manager is the preferred solution going forward, and forms the basis of Oracle Fusion Middleware 11g. OSSO is no longer being actively developed and will not be ported to Oracle WebLogic Server. Platform certifications Oracle Internet Directory is certified to run on any operating system for which Oracle WebLogic Server 11g is certified. Refer to the Oracle Fusion Middleware 11g System Requirements for more details.For information on operating systems supported by Oracle Internet Directory and its components, refer to the Oracle Identity and Access Management 11gR1 certification matrix.Integration with Oracle Internet Directory involves components spanning several different suites of Oracle products. There are no restrictions on which platform any particular component may be installed so long as the platform is supported for that component.References Overview of Single Sign-On Integration Options for Oracle E-Business Suite Note 1388152.1 Using the Latest Oracle Internet Directory 11gR1 Patchset with Oracle Single Sign-on and Oracle E-Business Suite (Note 876539.1) Integrating Oracle E-Business Suite with Oracle Access Manager 11g using Oracle E-Business Suite AccessGate (Note 1309013.1) Integrating Oracle E-Business Suite with Oracle Access Manager 10g using Oracle E-Business Suite AccessGate (Note 975182.1) Migrating Oracle Single Sign-On 10gR3 to Oracle Access Manager 11g with Oracle E-Business Suite (Note 1304550.1) Oracle Fusion Middleware Download, Installation & Configuration Readme Oracle Fusion Middleware Installation Guide for Oracle Identity Management 11g Release 1 (11.1.1) (Part Number E12002-09) Oracle Fusion Middleware Upgrade Guide for Oracle Identity Management 11g Release 1 (11.1.1) (Part Number E10129-09) Oracle Fusion Middleware Upgrade Planning Guide 11g Release 1 (11.1.1) (Part Number E10125-06) Oracle Fusion Middleware Patching Guide 11g Release 1 (11.1.1) (Part Number E16793-12) Related Articles Understanding Options for Integrating Oracle Access Manager with E-Business Suite In-Depth: Using Third-Party Identity Managers with E-Business Suite Release 12 In-Depth: Using Third-Party Identity Managers with the E-Business Suite Release 11i Oracle Access Manager 10gR3 Certified with E-Business Suite Portal 11.1.1.4 Certified with E-Business Suite Discoverer 11.1.1.4 Certified with E-Business Suite

    Read the article

  • Unity 3d support for multiple X-screens

    - by stewbond
    I've installed Ubuntu 12.04 this weekend and have had problems getting Unity3d to work with my triple monitor set-up. I've installed the latest nVidia drivers for my 2 nVidia video cards and have used NVIDIA X Server Settings to configure everything. If I stick each monitor on a separate X screen, all but the primary X screen will appear white and the cursor will be a black X. I can start a terminal on this screen but cannot drag other windows to it. If I kill the "Nautilus" process, the white background disappears and I see my desktop background, but my cursor is still an X and I still cannot drag windows to it. If I enable TwinView, I can get one screen on two monitors to work properly, but the white screen remains on my third monitor. In addition, I don't like using TwinView because my full-screen applications get stretched. My current solution is to "Enable Xinerama", use all separate X screens and revert to Unity2d. I'd love a solution to this as Ubuntu 12.10 is not planned to support Unity-2d and prefer the aesthetics of 3d anyways. I can provide Xorg.conf for all configurations and any other suggested diagnostic information. Below is my closest-to-working xorg.conf: # nvidia-settings: X configuration file generated by nvidia-settings # nvidia-settings: version 295.33 (buildd@zirconium) Fri Mar 30 13:38:49 UTC 2012 Section "ServerLayout" Identifier "Layout0" Screen 0 "Screen0" RightOf "Screen2" Screen 1 "Screen1" RightOf "Screen0" Screen 2 "Screen2" 0 0 InputDevice "Keyboard0" "CoreKeyboard" InputDevice "Mouse0" "CorePointer" Option "Xinerama" "1" EndSection Section "Files" EndSection Section "InputDevice" Identifier "Mouse0" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/psaux" Option "Emulate3Buttons" "no" Option "ZAxisMapping" "4 5" EndSection Section "InputDevice" Identifier "Keyboard0" Driver "kbd" EndSection Section "Monitor" Identifier "Monitor0" VendorName "Unknown" ModelName "Microvitec PLC MV191" HorizSync 30.0 - 81.0 VertRefresh 56.0 - 75.0 Option "DPMS" EndSection Section "Monitor" Identifier "Monitor1" VendorName "Unknown" ModelName "CRT-1" HorizSync 28.0 - 55.0 VertRefresh 43.0 - 72.0 Option "DPMS" EndSection Section "Monitor" Identifier "Monitor2" VendorName "Unknown" ModelName "Microvitec PLC MV191" HorizSync 30.0 - 81.0 VertRefresh 56.0 - 75.0 Option "DPMS" EndSection Section "Monitor" Identifier "Monitor3" VendorName "Unknown" ModelName "Microvitec PLC MV191" HorizSync 30.0 - 81.0 VertRefresh 56.0 - 75.0 EndSection Section "Device" Identifier "Device0" Driver "nvidia" VendorName "NVIDIA Corporation" BoardName "GeForce GTS 450" BusID "PCI:1:0:0" Screen 0 EndSection Section "Device" Identifier "Device1" Driver "nvidia" VendorName "NVIDIA Corporation" BoardName "GeForce 9500 GT" BusID "PCI:2:0:0" EndSection Section "Device" Identifier "Device2" Driver "nvidia" VendorName "NVIDIA Corporation" BoardName "GeForce GTS 450" BusID "PCI:1:0:0" Screen 1 EndSection Section "Device" Identifier "Device3" Driver "nvidia" VendorName "NVIDIA Corporation" BoardName "GeForce GTS 450" BusID "PCI:1:0:0" Screen 2 EndSection Section "Screen" Identifier "Screen0" Device "Device0" Monitor "Monitor0" DefaultDepth 24 Option "TwinView" "0" Option "metamodes" "DFP-0: 1280x1024_75 +0+0; DFP-0: 1280x1024 +0+0" SubSection "Display" Depth 24 EndSubSection EndSection Section "Screen" Identifier "Screen1" Device "Device1" Monitor "Monitor1" DefaultDepth 24 Option "TwinView" "0" Option "metamodes" "nvidia-auto-select +0+0" SubSection "Display" Depth 24 EndSubSection EndSection Section "Screen" Identifier "Screen2" Device "Device2" Monitor "Monitor2" DefaultDepth 24 Option "TwinView" "0" Option "metamodes" "DFP-2: 1280x1024_75 +0+0; DFP-2: nvidia-auto-select +0+0" SubSection "Display" Depth 24 EndSubSection EndSection Section "Screen" Identifier "Screen3" Device "Device3" Monitor "Monitor3" DefaultDepth 24 Option "TwinView" "0" Option "metamodes" "DFP-2: nvidia-auto-select +0+0" SubSection "Display" Depth 24 EndSubSection EndSection Section "Extensions" Option "Composite" "Disable" EndSection Other people have had similar issues. I haven't been successful at any of the few suggestions submitted. Can not get Dual Monitors to work on Different GPUs http://askubuntu.com/questions/30412/3-monitors-with-2-video-cards-not-working?rq=1 How to get second display to work alongside primary display? http://askubuntu.com/questions/148007/multiple-monitors-only-work-with-unity-2d/201086#201086 xorg.conf and Unity3D?

    Read the article

  • FrameBuffer Render to texture not working all the way

    - by brainydexter
    I am learning to use Frame Buffer Objects. For this purpose, I chose to render a triangle to a texture and then map that to a quad. When I render the triangle, I clear the color to something blue. So, when I render the texture on the quad from fbo, it only renders everything blue, but doesn't show up the triangle. I can't seem to figure out why this is happening. Can someone please help me out with this ? I'll post the rendering code here, since glCheckFramebufferStatus doesn't complain when I setup the FBO. I've pasted the setup code at the end. Here is my rendering code: void FrameBufferObject::Render(unsigned int elapsedGameTime) { glBindFramebuffer(GL_FRAMEBUFFER, m_FBO); glClearColor(0.0, 0.6, 0.5, 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // adjust viewport and projection matrices to texture dimensions glPushAttrib(GL_VIEWPORT_BIT); glViewport(0,0, m_FBOWidth, m_FBOHeight); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, m_FBOWidth, 0, m_FBOHeight, 1.0, 100.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); DrawTriangle(); glPopAttrib(); // setting FrameBuffer back to window-specified Framebuffer glBindFramebuffer(GL_FRAMEBUFFER, 0); //unbind // back to normal viewport and projection matrix //glViewport(0, 0, 1280, 768); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0, 1.33, 1.0, 1000.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); render(elapsedGameTime); } void FrameBufferObject::DrawTriangle() { glPushMatrix(); glBegin(GL_TRIANGLES); glColor3f(1, 0, 0); glVertex2d(0, 0); glVertex2d(m_FBOWidth, 0); glVertex2d(m_FBOWidth, m_FBOHeight); glEnd(); glPopMatrix(); } void FrameBufferObject::render(unsigned int elapsedTime) { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_TextureID); glPushMatrix(); glTranslated(0, 0, -20); glBegin(GL_QUADS); glColor4f(1, 1, 1, 1); glTexCoord2f(1, 1); glVertex3f(1,1,1); glTexCoord2f(0, 1); glVertex3f(-1,1,1); glTexCoord2f(0, 0); glVertex3f(-1,-1,1); glTexCoord2f(1, 0); glVertex3f(1,-1,1); glEnd(); glPopMatrix(); glBindTexture(GL_TEXTURE_2D, 0); glDisable(GL_TEXTURE_2D); } void FrameBufferObject::Initialize() { // Generate FBO glGenFramebuffers(1, &m_FBO); glBindFramebuffer(GL_FRAMEBUFFER, m_FBO); // Add depth buffer as a renderbuffer to fbo // create depth buffer id glGenRenderbuffers(1, &m_DepthBuffer); glBindRenderbuffer(GL_RENDERBUFFER, m_DepthBuffer); // allocate space to render buffer for depth buffer glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, m_FBOWidth, m_FBOHeight); // attaching renderBuffer to FBO // attach depth buffer to FBO at depth_attachment glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_DepthBuffer); // Adding a texture to fbo // Create a texture glGenTextures(1, &m_TextureID); glBindTexture(GL_TEXTURE_2D, m_TextureID); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_FBOWidth, m_FBOHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); // onlly allocating space glBindTexture(GL_TEXTURE_2D, 0); // attach texture to FBO glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_TextureID, 0); // Check FBO Status if( glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) std::cout << "\n Error:: FrameBufferObject::Initialize() :: FBO loading not complete \n"; // switch back to window system Framebuffer glBindFramebuffer(GL_FRAMEBUFFER, 0); } Thanks!

    Read the article

  • 2D Tile Based Collision Detection

    - by MrPlosion1243
    There are a lot of topics about this and it seems each one addresses a different problem, this topic does the same. I was looking into tile collision detection and found this where David Gouveia explains a great way to get around the person's problem by separating the two axis. So I implemented the solution and it all worked perfectly from all the testes I through at it. Then I implemented more advanced platforming physics and the collision detection broke down. Unfortunately I have not been able to get it to work again which is where you guys come in :)! I will present the code first: public void Update(GameTime gameTime) { if(Input.GetKeyDown(Keys.A)) { velocity.X -= moveAcceleration; } else if(Input.GetKeyDown(Keys.D)) { velocity.X += moveAcceleration; } if(Input.GetKeyDown(Keys.Space)) { if((onGround && isPressable) || (!onGround && airTime <= maxAirTime && isPressable)) { onGround = false; airTime += (float)gameTime.ElapsedGameTime.TotalSeconds; velocity.Y = initialJumpVelocity * (1.0f - (float)Math.Pow(airTime / maxAirTime, Math.PI)); } } else if(Input.GetKeyReleased(Keys.Space)) { isPressable = false; } if(onGround) { velocity.X *= groundDrag; velocity.Y = 0.0f; } else { velocity.X *= airDrag; velocity.Y += gravityAcceleration; } velocity.Y = MathHelper.Clamp(velocity.Y, -maxFallSpeed, maxFallSpeed); velocity.X = MathHelper.Clamp(velocity.X, -maxMoveSpeed, maxMoveSpeed); position += velocity * (float)gameTime.ElapsedGameTime.TotalSeconds; position = new Vector2((float)Math.Round(position.X), (float)Math.Round(position.Y)); if(Math.Round(velocity.X) != 0.0f) { HandleCollisions2(Direction.Horizontal); } if(Math.Round(velocity.Y) != 0.0f) { HandleCollisions2(Direction.Vertical); } } private void HandleCollisions2(Direction direction) { int topTile = (int)Math.Floor((float)Bounds.Top / Tile.PixelTileSize); int bottomTile = (int)Math.Ceiling((float)Bounds.Bottom / Tile.PixelTileSize) - 1; int leftTile = (int)Math.Floor((float)Bounds.Left / Tile.PixelTileSize); int rightTile = (int)Math.Ceiling((float)Bounds.Right / Tile.PixelTileSize) - 1; for(int x = leftTile; x <= rightTile; x++) { for(int y = topTile; y <= bottomTile; y++) { Rectangle tileBounds = new Rectangle(x * Tile.PixelTileSize, y * Tile.PixelTileSize, Tile.PixelTileSize, Tile.PixelTileSize); Vector2 depth; if(Tile.IsSolid(x, y) && Intersects(tileBounds, direction, out depth)) { if(direction == Direction.Horizontal) { position.X += depth.X; } else { onGround = true; isPressable = true; airTime = 0.0f; position.Y += depth.Y; } } } } } From the code you can see when velocity.X is not equal to zero the HandleCollisions() Method is called along the horizontal axis and likewise for the vertical axis. When velocity.X is not equal to zero and velocity.Y is equal to zero it works fine. When velocity.Y is not equal to zero and velocity.X is equal to zero everything also works fine. However when both axis are not equal to zero that's when it doesn't work and I don't know why. I basically teleport to the left side of a tile when both axis are not equal to zero and there is a air block next to me. Hopefully someone can see the problem with this because I sure don't as far as I'm aware nothing has even changed from what I'm doing to what the linked post's solution is doing. Thanks.

    Read the article

  • MS SQL server and Trees

    - by Julian
    Im looking for some way of extrating data form a tree table as defined below. Table Tree Defined as :- TreeID uniqueidentifier TreeParent uniqueidentifier TreeCode varchar(50) TreeDesc varchar(100) Data some (23k rows), Parent Refs back into ID in table The following SQL renders the whole tree (takes arround 2 mins 30) I need to do the following. 1) Render each Tree Node with its LVL 1 parent 2) Render all nodes that have a Description that matches a TreeDesc like 'SomeText%' 3) Render all parent nodes that are for a single tree id. Items 2 and 3 take 2mins30 so this needs to be a lot faster! Item 1, just cant work out how to do it with out killing SQL or taking forever any sugestions would be helpfull Thanks Julian WITH TreeCTE(TreeCode, TreeDesc, depth, TreeParent, TreeID) AS ( -- anchor member SELECT cast('' as varchar(50)) as TreeCode , cast('Trees' as varchar(100)) as TreeDesc, cast('0' as Integer) as depth, cast('00000000-0000-0000-0000-000000000000' as uniqueidentifier) as TreeParent, cast('00000000-0000-0000-0000-000000000000' as uniqueidentifier) as TreeID UNION ALL -- recursive member SELECT s.TreeCode, s.TreeDesc, cte.depth+1, isnull(s.TreeParent, cast('00000000-0000-0000-0000-000000000000' as uniqueidentifier)), isnull(s.TreeID, cast('00000000-0000-0000-0000-000000000000' as uniqueidentifier)) FROM pdTrees AS S JOIN TreeCTE AS cte ON isnull(s.TreeParent, cast('00000000-0000-0000-0000-000000000000' as uniqueidentifier)) = isnull( cte.TreeID , cast('00000000-0000-0000-0000-000000000000' as uniqueidentifier)) ) -- outer query SELECT s.TreeID, s.TreeCode, s.TreeDesc, s.depth, s.TreeParent FROM TreeCTE s

    Read the article

  • d3.js force layout increase linkDistance

    - by user1159833
    How to increase linkDistance without affecting the node alignment, example: http://mbostock.github.com/d3/talk/20110921/force.html when I try to increase the circle radius and linkDistance the it collapse <script type="text/javascript"> var w = 1280, h = 800, z = d3.scale.category20c(); var force = d3.layout.force() .size([w, h]); var svg = d3.select("#chart").append("svg:svg") .attr("width", w) .attr("height", h); svg.append("svg:rect") .attr("width", w) .attr("height", h); d3.json("flare.json", function(root) { var nodes = flatten(root), links = d3.layout.tree().links(nodes); force .nodes(nodes) .links(links) .start(); var link = svg.selectAll("line") .data(links) .enter().insert("svg:line") .style("stroke", "#999") .style("stroke-width", "1px"); var node = svg.selectAll("circle.node") .data(nodes) .enter().append("svg:circle") .attr("r", 4.5) .style("fill", function(d) { return z(d.parent && d.parent.name); }) .style("stroke", "#000") .call(force.drag); force.on("tick", function(e) { link.attr("x1", function(d) { return d.source.x; }) .attr("y1", function(d) { return d.source.y; }) .attr("x2", function(d) { return d.target.x; }) .attr("y2", function(d) { return d.target.y; }); node.attr("cx", function(d) { return d.x; }) .attr("cy", function(d) { return d.y; }); }); }); function flatten(root) { var nodes = []; function recurse(node, depth) { if (node.children) { node.children.forEach(function(child) { child.parent = node; recurse(child, depth + 1); }); } node.depth = depth; nodes.push(node); } recurse(root, 1); return nodes; } </script>

    Read the article

  • Good way to maintain Muliple level selection menu list in J2ME

    - by geoaxis
    Hello, I need a good way to maintain multiple form level data for menue selection. So for example If I have A and B, each might Have 1 2 3 so A A1 A2 A3 B B1 B2 B3 And this can continue for long, so that I could have A - A1 - A1.1 - A1.1.1 -.... I have the following class in place, works ok But I suspect we could have better. I just need to perform selection ni a selection tree like Widget, but each level of selection comes in another form (in J2ME) import java.util.Vector; public class Tag { private String tag; private Vector childTags; private Tag parent; Tag(String tag, Vector childtag) { this.tag = tag; this.childTags= childTags; } public void setChildTags(Vector childTags) { this.childTags = childTags; } public Vector getChildTags() { return this.childTags; } public String getTag() { return this.tag; } public String toString(int depth) { String a =""; if(depth==0) { a = a + this.getTag(); } if(this.getChildTags()!= null) { for(int k=0;k <this.getChildTags().capacity(); k++) { for (int i=0; i<depth; i++ ) { a = a + ("-"); } a = a+ ( ((Tag)this.getChildTags().elementAt(k)).toString(depth++)); } } return a; } }

    Read the article

  • SCOM 2007 versus Zenoss (or other open source)

    - by TheCleaner
    I've taken the liberty to test both SCOM 2007 and Zenoss and found the following: SCOM 2007 Pros: Great MS Windows server monitoring and reporting In-depth configuration and easily integrates into a "MS datacenter" Cons: limited network device monitoring support (without 3rd party plugins) expensive difficult learning curve Zenoss Pros: Open Source (free) decent server monitoring for Windows, great monitoring for Linux decent network device monitoring Cons: not as in-depth as SCOM (for Windows at least) So my question to you folks is this: Given the above, and given that I'm trying to monitor 55 Windows servers, 1 Linux server, 2 ESX servers, and Juniper equipment...which would you recommend?

    Read the article

  • mod-rewrite: Replacing some characters in a url

    - by GeorgeCalm
    Is it possible to replace some forward slashes (/) of a URL to dots (.) in a RewriteRule? It doesn't have to be done exclusively with a RewriteRule, but definitely not with a script. Example 1: INPUT: /document/my/document.html OUTPUT: /document-my.document.html Example 2: INPUT: /document/depth/of/path/can/vary.html OUTPUT: /document-depth.of.path.can.vary.html

    Read the article

  • Command line raw image processing tools in Linux?

    - by ???
    I'm wondering if there is any command to process raw images, for example, cat raw1.img | raw2jpg -w 640 -h 480 -pitch 1024 -pixelformat R8G8B8 and more examples: cat raw1.img raw2.img >y-merge.img tr='transpose -pitch 1024 -depth 24' cat <(cat raw1.img | $tr) <(cat raw2.img | $tr) | transpose -pitch 480 >x-merge.img and something like this: cat gamebitmap.dat | ( w=`readint32` h=`readint32` raw2png -w $w -h $h -depth 24 -pixelformat R8G8B8 ) | png2svg -extractoutline -fuzzy -error 8 -smooth Seems a little tricky, but is it possible? does ImageMagick support such raw formats?

    Read the article

  • Alpha Beta Search

    - by Becky
    I'm making a version of Martian Chess in java with AI and so far I THINK my move searching is semi-working, it seems to work alright for some depths but if I use a depth of 3 it returns a move for the opposite side...now the game is a bit weird because when a piece crosses half of the board, it becomes property of the other player so I think this is part of the problem. I'd be really greatful if someone could look over my code and point out any errors you think are there! (pls note that my evaluation function isn't nearly complete lol) MoveSearch.java public class MoveSearch { private Evaluation evaluate = new Evaluation(); private int blackPlayerScore, whitePlayerScore; public MoveContent bestMove; public MoveSearch(int blackScore, int whiteScore) { blackPlayerScore = blackScore; whitePlayerScore = whiteScore; } private Vector<Position> EvaluateMoves(Board board) { Vector<Position> positions = new Vector<Position>(); for (int i = 0; i < 32; i++) { Piece piece = null; if (!board.chessBoard[i].square.isEmpty()) { // store the piece piece = board.chessBoard[i].square.firstElement(); } // skip empty squares if (piece == null) { continue; } // skip the other players pieces if (piece.pieceColour != board.whosMove) { continue; } // generate valid moves for the piece PieceValidMoves validMoves = new PieceValidMoves(board.chessBoard, i, board.whosMove); validMoves.generateMoves(); // for each valid move for (int j = 0; j < piece.validMoves.size(); j++) { // store it as a position Position move = new Position(); move.startPosition = i; move.endPosition = piece.validMoves.elementAt(j); Piece pieceAttacked = null; if (!board.chessBoard[move.endPosition].square.isEmpty()) { // if the end position is not empty, store the attacked piece pieceAttacked = board.chessBoard[move.endPosition].square.firstElement(); } // if a piece is attacked if (pieceAttacked != null) { // append its value to the move score move.score += pieceAttacked.pieceValue; // if the moving pieces value is less than the value of the attacked piece if (piece.pieceValue < pieceAttacked.pieceValue) { // score extra points move.score += pieceAttacked.pieceValue - piece.pieceValue; } } // add the move to the set of positions positions.add(move); } } return positions; } // EvaluateMoves() private int SideToMoveScore(int score, PieceColour colour) { if (colour == PieceColour.Black){ return -score; } else { return score; } } public int AlphaBeta(Board board, int depth, int alpha, int beta) { //int best = -9999; // if the depth is 0, return the score of the current board if (depth <= 0) { board.printBoard(); System.out.println("Score: " + evaluate.EvaluateBoardScore(board)); System.out.println(""); int boardScore = evaluate.EvaluateBoardScore(board); return SideToMoveScore(boardScore, board.whosMove); } // fill the positions with valid moves Vector<Position> positions = EvaluateMoves(board); // if there are no available positions if (positions.size() == 0) { // and its blacks move if (board.whosMove == PieceColour.Black) { if (blackPlayerScore > whitePlayerScore) { // and they are winning, return a high number return 9999; } else if (whitePlayerScore == blackPlayerScore) { // if its a draw, lower number return 500; } else { // if they are losing, return a very low number return -9999; } } if (board.whosMove == PieceColour.White) { if (whitePlayerScore > blackPlayerScore) { return 9999; } else if (blackPlayerScore == whitePlayerScore) { return 500; } else { return -9999; } } } // for each position for (int i = 0; i < positions.size(); i++) { // store the position Position move = positions.elementAt(i); // temporarily copy the board Board temp = board.copyBoard(board); // make the move temp.makeMove(move.startPosition, move.endPosition); for (int x = 0; x < 32; x++) { if (!temp.chessBoard[x].square.isEmpty()) { PieceValidMoves validMoves = new PieceValidMoves(temp.chessBoard, x, temp.whosMove); validMoves.generateMoves(); } } // repeat the process recursively, decrementing the depth int val = -AlphaBeta(temp, depth - 1, -beta, -alpha); // if the value returned is better than the current best score, replace it if (val >= beta) { // beta cut-off return beta; } if (val > alpha) { alpha = val; bestMove = new MoveContent(alpha, move.startPosition, move.endPosition); } } // return the best score return alpha; } // AlphaBeta() } This is the makeMove method public void makeMove(int startPosition, int endPosition) { // quick reference to selected piece and attacked piece Piece selectedPiece = null; if (!(chessBoard[startPosition].square.isEmpty())) { selectedPiece = chessBoard[startPosition].square.firstElement(); } Piece attackedPiece = null; if (!(chessBoard[endPosition].square.isEmpty())) { attackedPiece = chessBoard[endPosition].square.firstElement(); } // if a piece is taken, amend score if (!(chessBoard[endPosition].square.isEmpty()) && attackedPiece != null) { if (attackedPiece.pieceColour == PieceColour.White) { blackScore = blackScore + attackedPiece.pieceValue; } if (attackedPiece.pieceColour == PieceColour.Black) { whiteScore = whiteScore + attackedPiece.pieceValue; } } // actually move the piece chessBoard[endPosition].square.removeAllElements(); chessBoard[endPosition].addPieceToSquare(selectedPiece); chessBoard[startPosition].square.removeAllElements(); // changing piece colour based on position if (endPosition > 15) { selectedPiece.pieceColour = PieceColour.White; } if (endPosition <= 15) { selectedPiece.pieceColour = PieceColour.Black; } //change to other player if (whosMove == PieceColour.Black) whosMove = PieceColour.White; else if (whosMove == PieceColour.White) whosMove = PieceColour.Black; } // makeMove()

    Read the article

  • Sharepoint - Navigation.QuickLaunch has missing items

    - by linqmonkey
    The following code generates an ASCII art tree view of a sharepoint site structure based on the items in the quick launch menu. But some are missing. From googling i've found suggestions that this may be because QuickLaunch only contains items that have been customised. Any idea how to fix this? I want to use the QuickLaunch items as many of the sites have subsites and pages that need to be displayed in a specific order. RecurseNavigation(SPWeb web) { depth++; foreach (SPNavigationNode node in web.Navigation.QuickLaunch) { Console.Write(new String('-', depth)); Console.WriteLine(node.Title + " ("+node.Url+")"); RecurseNavigation(root.OpenWeb(node.Url)); } depth--; }

    Read the article

  • Cannot pull newly-added top-level directory into sparsely-checked out SVN repository

    - by Tim Keating
    Our SVN repository is quite large, and pulling the whole thing takes some time. When checking out at home, I was pleased to discover the sparse checkout feature; I checked out the whole repository to a depth of 1, then pulled each top-level directory (directly under the trunk) that I needed to a depth of infinity. Until now this has been brilliant. Recently I added a new directory under trunk. When I do a svn up, I get nothing. The TLD I added will not sync. I normally use Tortoise SVN, so I tried doing this from command line. I tried explicitly specifying the name of the directory, adding --depth infinity, adding --force. None of these tricks has worked. What am I missing?

    Read the article

  • CTE to build a list of departments and managers (hierarchical)

    - by Milky Joe
    I need to generate a list of users that are managers, or managers of managers, for company departments. I have two tables; one details the departments and one contains the manager hierarchy (simplified): CREATE TABLE [dbo].[Manager]( [ManagerId] [int], [ParentManagerId] [int]) CREATE TABLE [dbo].[Department]( [DepartmentId] [int], [ManagerId] [int]) Basically, I'm trying to build a CTE that will give me a list of DepartmentIds, together with all ManagerIds that are in the manager hierarchy for that department. So... Say Manager 1 is the Manager for Department 1, and Manager 2 is Manager 1's Manager, and Manager 3 is Manager 2's Manager, I'd like to see: DepartmentId, ManagerId 1, 1 1, 2 1, 3 Basically, managers are able to deal with all of their sub-manager's departments. Building the CTE to return the Manager hierarchy was fairly simple, but I'm struggling to inject the Departments in there: WITH DepartmentManagers AS ( SELECT ManagerId, ParentManagerId, 0 AS Depth From Manager UNION ALL SELECT Manager.ManagerId, Manager.ParentManagerId, DepartmentManagers.Depth + 1 AS Depth FROM Manager INNER JOIN DepartmentManagers ON DepartmentManagers.ManagerId = Manager.ParentManagerId ) Can anyone help?

    Read the article

  • X11 and ARGB visuals: does DefaultDepth() never return 32?

    - by Andy
    Hi, I'm establishing a connection to the X server like this: display = XOpenDisplay(NULL); screen = DefaultScreen(display); depth = DefaultDepth(display, screen); I'm wondering now why "depth" is always set to 24. I would expect that it is only 24 when compositing is turned off, but in fact, it is still 24 even when I turn on compositing. So in order to get a 32-bit ARGB visual I need to call XGetVisualInfo() first with depth set explicitly to 32. Now to my question: Will DefaultDepth() generally never return more than 24 or is it just on my system? (my graphics board is somewhat dated...). I know that it could return 15, 16 or even 8 for a CLUT display but can it return 32? Or do I always have to use XGetVisualInfo() first to get a ARGB 32-bit visual? Thanks, Andy

    Read the article

  • How do I construct a 3D model of a room from 2 stereo cameras? What is the determining factor to an

    - by yasumi
    Currently, I have extracted depth points to construct a 3D model from 2 stereo cameras. The methods I have used are openCV graphCut method and a software from http://sourceforge.net/projects/reconststereo/. However, the generated 3D models are not very accurate, which leads me to question: 1) What is the problem with pixel-based method? 2) Should I change my pixel-based method to feature-based or object-recognition-based method? Is there a best method? 3) Are there any other ways to do such reconstruction? Additionally, the depth extracted comes only from 2 images. What if I am turning the camera 360 degrees to obtain a video? Looking forward to suggestion on how to combine this depth information. Thank you very much :)

    Read the article

  • ETPM/OUAF 2.3.1 Framework Overview - Session 2

    - by Rick Finley
    A number of sessions are planned to review the ETPM (OUAF) 2.3.1 Framework.  These sessions will include an overview of the Navigation, Portals, Zones, Business Objects, Business Services, Algorithms, Scripts, etc.. Session 2 includes a more in depth discusion of Business Objects (BO).  Session 2 specifically covers BO Schema, BO Options, and BO inheritance in more depth.  Click on the link below for Session 2 (52 minutes). To stream the recording:   https://oracletalk.webex.com/oracletalk/ldr.php?AT=pb&SP=MC&rID=70624122&rKey=8a16e59ed3736f1c To download the recording: https://oracletalk.webex.com/oracletalk/lsr.php?AT=dw&SP=MC&rID=70624122&rKey=140a83f63b8fa22a For additional questions, please contact [email protected].

    Read the article

  • Store a formula in a table and use the formula in a javascript/PHP function

    - by Muhaimin Abdul
    I have a MySql database where part of it handles instrument's depth of water. Each instrument has its own formula of calculation how depth the water when the operator collect the reading I stored the formula for each instrument in database/MySql. Example formula: [55-57] this is the simple minus operation, where the number is actually represent the id of a row. How do I represent those number with id of a row and later convert it to javascript readable code. I simply want to do keyup event where everytime user key in something into text field then the other part of HTML would reflect changes based on formula that I fetched from database FYI, I'm using BackboneJS together with RequireJS

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >