Search Results

Search found 8172 results on 327 pages for 'vector graphics'.

Page 1/327 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • 3D Vector "End Point" Calculation for procedural Vector Graphics

    - by FrostFlame64
    Alright, So I need some help with some Vector Math. I've developing some game Engines that have Procedural Fractal Generation for Some Graphics, such as using Lindenmayer Systems for generating Trees and Plants. L-Systems, are drawn by using Turtle Graphics, which is a form of Vector graphics. I first created a system to draw in 2D Graphics, which works perfectly fine. But now I want to make a 3D equivalent, and I’ve run into an issue. For my 2D Version, I created a Method for quickly determining the “End Point” of a Vector-like movement. Given a starting point (X, Y), a direction (between 0 and 360 degrees), and a distance, the end point is calculated by these formulas: newX = startX + distance * Sin((PI * direction) / 180) newY = startY + distance * Cos((PI * direction) / 180) Now I need something Similarly Equivalent for performing this Calculation in 3D, But I haven’t been able to Google anything that could show me how to do this. I'm flexible enough to get whatever required information is needed for this method calculation, in any reasonable form (Vector3, Quaternion, ect). To summarize: Given a starting point/vector position in 3D space (X, Y, Z), a Direction in 3D space (Vector3, Quaternion, ect), and a Distance, I need to find the “End Point” in 3D Space. Thank you for your time and help.

    Read the article

  • Low graphics performance with Intel HD graphics

    - by neil
    hey, my laptop should be capable of running some games fine but doesn't. Examples are egoboo and tome. http://www.ebuyer.com/product/237739 this is my laptop. I tried the gears test and i only get 60 FPS, on IRC they said thats a big issue and should try the forums. I am using Ubuntu 11.04 and was told I should have the newest drivers. neil@neil-K52F:~$ /usr/lib/nux/unity_support_test --print OpenGL vendor string: Tungsten Graphics, Inc OpenGL renderer string: Mesa DRI Intel(R) Ironlake Mobile GEM 20100330 DEVELOPMENT OpenGL version string: 2.1 Mesa 7.10.2 Not software rendered: yes Not blacklisted: yes GLX fbconfig: yes GLX texture from pixmap: yes GL npot or rect textures: yes GL vertex program: yes GL fragment program: yes GL vertex buffer object: yes GL framebuffer object: yes GL version is 1.4+: yes Unity supported: yes

    Read the article

  • vector iterator not dereferencable at runtime on a vector<vector<vector<A*>*>*>

    - by marouanebj
    Hi, I have this destructor that create error at runtime "vector iterator not dereferencable". The gridMatrix is a std::vector<std::vector<std::vector<AtomsCell< Atom<T> * > * > * > * > I added the typename and also the typedef but I still have the error. I will move for this idea of vect of vect* of vect* to use boost::multi_array I think, but still I want to understand were this is wrong. /// @brief destructor ~AtomsGrid(void) { // free all the memory for all the pointers inside gridMatrix (all except the Atom<T>* ) //typedef typename ::value_type value_type; typedef std::vector<AtomsCell< Atom<T>* >*> std_vectorOfAtomsCell; typedef std::vector<std_vectorOfAtomsCell*> std_vectorOfVectorOfAtomsCell; std_vectorOfAtomsCell* vectorOfAtomsCell; std_vectorOfVectorOfAtomsCell* vectorOfVecOfAtomsCell; typename std_vectorOfVectorOfAtomsCell::iterator itSecond; typename std_vectorOfVectorOfAtomsCell::reverse_iterator reverseItSecond; typename std::vector<std_vectorOfVectorOfAtomsCell*>::iterator itFirst; //typename std::vector<AtomsCell< Atom<T>* >*>* vectorOfAtomsCell; //typename std::vector<std::vector<AtomsCell< Atom<T>* >*>*>* vectorOfVecOfAtomsCell; //typename std::vector<std::vector<AtomsCell< Atom<T>* >*>*>::iterator itSecond; //typename std::vector<std::vector<AtomsCell< Atom<T>* >*>*>::reverse_iterator reverseItSecond; //typename std::vector<std::vector<std::vector<AtomsCell< Atom<T>* >*>*>*>::iterator itFirst; for (itFirst = gridMatrix.begin(); itFirst != gridMatrix.end(); ++itFirst) { vectorOfVecOfAtomsCell = (*itFirst); while (!vectorOfVecOfAtomsCell->empty()) { reverseItSecond = vectorOfVecOfAtomsCell->rbegin(); itSecond = vectorOfVecOfAtomsCell->rbegin().base(); vectorOfAtomsCell = (*itSecond); // ERROR during run: "vector iterator not dereferencable" // I think the ERROR is because I need some typedef typename or template ???!!! // the error seems here event at itFirst //fr_Myit_Utils::vectorElementDeleter(*vectorOfAtomsCell); //vectorOfVecOfAtomsCell->pop_back(); } } fr_Myit_Utils::vectorElementDeleter(gridMatrix); } If someone want the full code that create the error I'm happy to give it but I do not think we can attach file in the forum. BUT still its is not very big so if you want it I can copy past it here. Thanks

    Read the article

  • Calc direction vector based on destination vector and distance from enemy in AS3

    - by Phil
    I'm working on a zombie game in AS3 where I want a character to be able to move away from a zombie depending upon how close the zombie is. The character also has a destination that it's trying to get too on the screen. Ok so I have 2 vectors, one pointing to my destination, and one pointing to the zombie which I then invert to get my "away" vector. I then turn the distance between my character and the zombie into a value between 0 and 1. And then I'm stuck on how to get a resultant vector for my character. How would I use my 0-1 value to calculate how much of the away vector is used and how much of the original destination vector is still left if that makes sense? to end up with 1 direction vector to move my character? So if the zombie is right where my character is, then my direction vector = away vector, and if I'm far away from the zombie than my direction vector = destination vector, but how do I calculate the in-between? Ideally need the answer in AS3.

    Read the article

  • Transform 3d viewport vector to 2d vector

    - by learning_sam
    I am playing around with 3d transformations and came along an issue. I have a 3d vector already within the viewport and need to transform it to a 2d vector. (let's say my screen is 10x10) Does that just straight works like regualar transformation or is something different here? i.e.: I have the vector a = (2, 1, 0) within the viewport and want the 2d vector. Does that works like this and if yes how do I handle the "0" within the 3rd component?

    Read the article

  • How to re-configure graphics from Intel integrated to Intel / ATI switchable?

    - by Bucic
    There are lots of 'how to get switchable graphics to work' guides but I found none on how to configure a system for switchable graphics operation on Ubuntu from the ground up, nor explaining the current driver situation for particular computer models (integrated+discrete combinations). Example: https://help.ubuntu.com/community/HybridGraphics My system being mature and on Intel integrated card also makes things complicated. System information: Ubuntu 12.04 amd64, installed clean with system configured to use only the integrated Intel card Lenovo Thinkpad T500 Intel GMA 4500MHD / ATI Mobility Radeon HD 3650 Current situation: Mature and up-to-date system with no configuration changes to what's given above. I've made a backup image of the system (Clonezilla) so regardless of what's written below let's assume it's our starting point. If something in What I have already tried is not clear you may as well diregard it. What I have already tried: Configuring BIOS to switchable graphics and: Installing Additional Hardware drivers - returned an error. Installing proprietary amd-driver-installer-12.6-legacy-x86.x86_64.run automatically - system starts to 'low-graphics mode'. Tried fixing as per https://help.ubuntu.com/community/BinaryDriverHowto/ATI#Manually_installing_Catalyst_12.6.2C_special_case_for_Intel.2BAC8-ATI_hybrid_graphics Got lost, gave up. Please note that while configuring BIOS for integrated graphics only is pretty straightforward, configuring for switchable graphics is not.

    Read the article

  • ATI graphics card overriding onboard Intel graphics

    - by Patrick
    I have an ATI graphics card with an AGP connection and a DVI port, and an Intel graphics processor on the motherboard with a VGA port. I have two monitors. When the graphics card is unplugged, I get this from lspci: 00:00.0 Host bridge: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller (rev 10) 00:02.0 VGA compatible controller: Intel Corporation 82G33/G31 Express Integrated Graphics Controller (rev 10) When it is attached, I get this: 00:00.0 Host bridge: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller (rev 10) 01:00.0 VGA compatible controller: ATI Technologies Inc RV380 [Radeon X600 (PCIE)] 01:00.1 Display controller: ATI Technologies Inc RV380 [Radeon X600] Note the absence of 00:02.0 - this is apparently causing the VGA monitor to say "No Signal" and the only the DVI display to show up in the list. I checked for problems in xorg.conf... there isn't one. I have no idea how to build one.

    Read the article

  • Low graphics mode on Ubuntu 12.04 with Intel Graphics

    - by NightShadeQueen
    When I boot, my computer just tells me it can't detect graphic card (or something else) settings and it has to use the low graphics mode. Then it gives me four choices, but doesn't let me choose any of them. I can get my computer to boot by going to some sort of terminal mode and then typing sudo gdm. The other graphics manager I have is lightdm. I originally had the nVidia propriety driver, and I've tried bumblebee. Mobile Intel Graphics Media Accelerator 4500M is my graphics card. Is there any way to fix this so I can use lightdm again?

    Read the article

  • Integrated Graphics went kaput, can I switch to dedicated graphics if I can't get into the BIOS

    - by Om Nom Nom
    I have an 8 year old computer (Pentium 4 1.6 GHz, 256 MB DDR RAM) which is not turning on (it beeps for 10 seconds and then goes off). Nothing appears on the screen, so I can't get into the BIOS. A computer repair person listened to the beeping pattern and told me that its because of the integrated graphics on the motherboard is defective. It's an ASUS P4S333-VM motherboard and the graphics solution is SiS 650. He tried putting in a PCI graphics card expecting that the computer will use that instead and ignore the integrated graphics, but apparently older computers don't switch automatically to the dedicated graphics card; it needs to be changed from the BIOS. But, I can't get inside the BIOS settings as I already said. I am told that the only option now is to replace the motherboard (which is not feasible since it's very old now). So, is there any way to make the computer use the PCI graphics card? IIRC, the motherboard also has an AGP port, but I think that it will also need to be selected from the BIOS?

    Read the article

  • latest intel graphics driver?

    - by Anwar Shah
    I have Intel Graphics Card, which have model number GM965. It is on a Notebook, (Lenovo 3000 Y410). My Ubuntu Installation worked good until I upgraded to 12.04. It was a fresh install. The Graphics performance is poor compared to Natty, Oneiric. In the details tab of System Settings, Graphics driver is shown as "Unknown". I have upgraded the xserver-xorg-video-intel package to version 2.19.. from 2.17. But still same. So, My question is How can I install latest Intel graphics driver for my Chipset? or Is there any other method to fix the problem with graphics.

    Read the article

  • ubuntu integrated graphics suspend + hybrid graphics

    - by kapad
    My laptop uses a hybrid graphics hardware. Using the vgaswitcheroo I am able to power off either card and switch between them correctly. The issue is that the system wakes up/resumes from suspend correctly only when using the discrete graphics, or atleast the discrete graphics must be powered on even if the display is connected to the onboard intel card. Has anyone faced this issues? Is there any workaround? I only want to use the integrated card and not the discrete amd card. System Info Intel HD 3000 ATI mobility radeon HD 7600M Ubuntu 12.10

    Read the article

  • Understanding math used to determine if vector is clockwise / counterclockwise from your vector

    - by MTLPhil
    I'm reading Programming Game AI by Example by Mat Buckland. In the Math & Physics primer chapter there's a listing of the declaration of a class used to represent 2D vectors. This class contains a method called Sign. It's implementation is as follows //------------------------ Sign ------------------------------------------ // // returns positive if v2 is clockwise of this vector, // minus if anticlockwise (Y axis pointing down, X axis to right) //------------------------------------------------------------------------ enum {clockwise = 1, anticlockwise = -1}; inline int Vector2D::Sign(const Vector2D& v2)const { if (y*v2.x > x*v2.y) { return anticlockwise; } else { return clockwise; } } Can someone explain the vector rules that make this hold true? What do the values of y*v2.x and x*v2.y that are being compared actually represent? I'd like to have a solid understanding of why this works rather than just accepting that it does without figuring it out. I feel like it's something really obvious that I'm just not catching on to. Thanks for your help.

    Read the article

  • Graphics card fan is loud (additional graphics card drivers cause problems)

    - by tk4muffin
    Okay this explanation is a bit longer ... but I start at the beginning: I've been using Windows 7 for a very long time, shortly after the release of v12.10 I installed Ubuntu via Windows installer. Everything worked fine but the fan of the graphics card. After a bit of research I found out, that I just had to select a different driver (nvidia-current (proprietary, tested) worked pretty well). This also fixed some graphical bugs when I just logged into my account. Due to my university I got a MSDNAA-Account (allows me to download every Windows OS for free). I downloaded and installed Windows 8. After configuration I installed ubuntu via the Windows installer once again and the first couple launches of ubuntu went well. Suddenly ubuntu didn't launched anymore...caused by some hard-disk errors and had no clue what to do. So I kept working on Windows 8 - unfortunately. After playing around with the new Windows, I put my PC to sleep-mode. I couldn't wake my PC up and it wasn't responding to anything (neither mouse-movement, -clicks or keyboard strokes, nor the power-button and the reset-button worked), so I pulled the plug. Turns out, this was a huge mistake. Somehow the BIOS broke and after restarting a couple of times, the BIOS repaired itself. Neither Windows 8, nor ubuntu where bootable. Now I had to install ubuntu several times, because after rebooting unity was hidden and I didn't know what the problem was and how to fix it. I finally realized that this problem was caused by the graphics card driver, which I've changed to the nvidia-current (This dirver worked fine before my PC "crashed"). So I installed Windows 8 again and after a bit of usage I installed ubuntu once again (via DVD). The booting of ubuntu and windows works fine - so far. But I'm still not able to change the graphics card driver without unity hiding away after restarting the OS. The noisy fan is really disturbing my work... PC Specs: Processor: Intel Core 2 Duo COU E8400 @ 3GHz x2 Memory: 7.8 GB OS type: 64-bit Graphics Card: GeForce 9600 GT Motherboard: Asus P5Q I hope the information given are enough.

    Read the article

  • How to Force Graphics Options in PC Games with NVIDIA, AMD, or Intel Graphics

    - by Chris Hoffman
    PC games usually have built-in graphics options you can change. But you’re not limited to the options built into games — the graphics control panels bundled with graphics drivers allow you to tweak options from outside PC games. For example, these tools allow you to force-enabling antialiasing to make old games look better, even if they don’t normally support it. You can also reduce graphics quality to get more performance on slow hardware. If You Don’t See These Options If you don’t have the NVIDIA Control Panel, AMD Catalyst Control Center, or Intel Graphics and Media Control Panel installed, you may need to install the appropriate graphics driver package for your hardware from the hardware manufacturer’s website. The drivers provided via Windows Update don’t include additional software like the NVIDIA Control Panel or AMD Catalyst Control Center. Drivers provided via Windows Update are also more out of date. If you’re playing PC games, you’ll want to have the latest graphics drivers installed on your system. NVIDIA Control Panel The NVIDIA Control Panel allows you to change these options if your computer has NVIDIA graphics hardware. To launch it, right-click your desktop background and select NVIDIA Control Panel. You can also find this tool by performing a Start menu (or Start screen) search for NVIDIA Control Panel or by right-clicking the NVIDIA icon in your system tray and selecting Open NVIDIA Control Panel. To quickly set a system-wide preference, you could use the Adjust image settings with preview option. For example, if you have old hardware that struggles to play the games you want to play, you may want to select “Use my preference emphasizing” and move the slider all the way to “Performance.” This trades graphics quality for an increased frame rate. By default, the “Use the advanced 3D image settings” option is selected. You can select Manage 3D settings and change advanced settings for all programs on your computer or just for specific games. NVIDIA keeps a database of the optimal settings for various games, but you’re free to tweak individual settings here. Just mouse-over an option for an explanation of what it does. If you have a laptop with NVIDIA Optimus technology — that is, both NVIDIA and Intel graphics — this is the same place you can choose which applications will use the NVIDIA hardware and which will use the Intel hardware. AMD Catalyst Control Center AMD’s Catalyst Control Center allows you to change these options on AMD graphics hardware. To open it, right-click your desktop background and select Catalyst Control Center. You can also right-click the Catalyst icon in your system tray and select Catalyst Control Center or perform a Start menu (or Start screen) search for Catalyst Control Center. Click the Gaming category at the left side of the Catalyst Control Center window and select 3D Application Settings to access the graphics settings you can change. The System Settings tab allows you to configure these options globally, for all games. Mouse over any option to see an explanation of what it does. You can also set per-application 3D settings and tweak your settings on a per-game basis. Click the Add option and browse to a game’s .exe file to change its options. Intel Graphics and Media Control Panel Intel integrated graphics is nowhere near as powerful as dedicated graphics hardware from NVIDIA and AMD, but it’s improving and comes included with most computers. Intel doesn’t provide anywhere near as many options in its graphics control panel, but you can still tweak some common settings. To open the Intel graphics control panel, locate the Intel graphics icon in your system tray, right-click it, and select Graphics Properties. You can also right-click the desktop and select Graphics Properties. Select either Basic Mode or Advanced Mode. When the Intel Graphics and Media Control Panel appears, select the 3D option. You’ll be able to set your Performance or Quality setting by moving the slider around or click the Custom Settings check box and customize your Anisotropic Filtering and Vertical Sync preference. Different Intel graphics hardware may have different options here. We also wouldn’t be surprised to see more advanced options appear in the future if Intel is serious about competing in the PC graphics market, as they say they are. These options are primarily useful to PC gamers, so don’t worry about them — or bother downloading updated graphics drivers — if you’re not a PC gamer and don’t use any intensive 3D applications on your computer. Image Credit: Dave Dugdale on Flickr     

    Read the article

  • How to use integrated Intel graphics instead of Nvidia graphics on MacBook Pro?

    - by Benjamin Geese
    I am running Ubuntu 12.04 64bit on MacBook Pro 15" 2010 (MacBookPro6,2) and I would like to use the integrated Intel graphics instead of the dedicated Nvidia graphics Ubuntu boots with on this machine. I am booting with UEFI, not REFIT or similar. I managed to switch to UEFI with the help of this page. This wiki page also contains tips on switching to Intel graphics which include some (for me) cryptic boot commands to grub. However if I follow the guide, my display stays just black. Currently, I am only looking for solution to use Intel graphics for Ubuntu to save power and keep my MacBook cool. Dynamic switching or stuff like that is not required.

    Read the article

  • Ubuntu 14.04 ATI/Intel Hybrid Graphics DPM

    - by anchit123
    I have a Dell Inspiron 3521 with hybrid ATI/Intel graphics. (AMD Radeon 7670M / Intel HD 4000) using Ubuntu 14.04 with open source drivers for graphics. (xserver-xorg-video-ati) I read that Ubuntu 14.04 with the linux kernel version 3.13 supports auto switching between graphics and dynamic power management. Is it correct? Anyway, if it is true, I dont think that it is working in my system , because fan runs constantly and battery backup is less than 2 hours. lspci | grep -i vga 00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09) 01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Thames [Radeon HD 7500M/7600M Series] (rev ff) What should I do? Is there any hope that this gets fixed in future kernels?

    Read the article

  • Hybrid Graphics on Windows 7/Ubuntu 12.04 Dual Boot

    - by Noob.
    Alright, so here's the situation: I am using an ASUS UL80VT with two graphics cards: Integrated intel graphics and NVIDIA G210M I was running an Ubuntu 12.04 - Windows 7 dual boot (on separate partitions).The machine worked perfectly (including the display drivers) without me needing to install anything special or change any settings. However, my hard drive was corrupted and I lost all my data yesterday, so after it was replaced, I installed Ubuntu 12.04 64x again after installing Windows 7. I booted up Ubuntu after installation, and noticed it was by default using Unity 2D... Gnome 3.4 wasn't working properly either, so I guessed that the NVIDIA G210M driver wasn't installed/working and the OS was instead using the integrated graphics. I checked the "Additional Drivers" thing, but there were no proprietary drivers listed there, so I went to the NVIDIA website, downloaded the driver directly and installed it. I restarted, but there was no change. After this, I read somewhere that I should change my SATA in the BIOS to "Compatible" rather than "Enhanced". This worked fine and fixed the problem (both Unity and Gnome were working perfectly) but then when I tried booting up Windows 7, I recieved the BSOD. So I changed it back to Enhanced, and once again, the NVIDIA 210M graphics isn't working on Ubuntu, but on Windows 7 it is. I do not want to keep changing from Enhanced to Compatible every time I reboot to Ubuntu and neither do I want to simply just use one OS. Note that NVIDIA 210M and integrated graphics work perfectly on Windows 7. Also, I don't care about switching between them, I just want to be able to use the NVIDIA one. What can I do so that both Windows 7 and Ubuntu work and NVIDIA G210M works on Ubuntu?

    Read the article

  • graphics card not found?

    - by Rens
    I just installed Ubuntu 12.04 and absolutely love it , but when i go to system details it says graphics unknown, is this a problem ? i have a acer aspire 5750, and a Intel 3000 HD graphics card.There also no additional drivers to be installed, but on another computer i needed to install additional drivers and it showed the grapics card. is there a problem with intel graphics in combination with ubuntu ?

    Read the article

  • Can't Use Switchable Graphics

    - by Rev
    I can't get my switchable graphics cards working on my Acer 4820TG laptop. It came installed with Windows 7, but I've installed the RTM build of Windows 8. I have to keep the "Graphics" setting on the BIOS set to "Discrete," if it's set to "Switchable" the screen turns black after the boot animation is complete. The machine has an Intel graphics card and an AMD Mobility Radeon HD 5650, and I know that the Intel card is working. I've seen it work a couple of times with Windows 8 installed, but for some reason it just doesn't anymore. I know that it's not broken, because when I plug in a secondary monitor, and move the cursor to the right, I can see it on that monitor. Are there drivers or something I need to install? I've tried a number of drivers and utilities from Acer's website, none of which have fixed the problem.

    Read the article

  • 3+ monitors, nvidia + intel graphics

    - by gozzilli
    I have seen lots of different posts on this issue, but I cannot figure out what to do. I hope we can collect the available information in one place, so that they can be useful for others. Is it possible to have multiple (3+) monitors running on two different graphics cards? I have 1x nVidia GeForce GTX 550 with 2 DVI ports and 1x Intel integrated graphics, with 2 DVI ports. I understand that they would be running on different instances of X servers. Is that correct? Could someone point me in the right direction to start? On Windows it's so simple, there is no additional thing to do other than going in display preferences and activating all 3+ monitors. They can even be laid out alternating one monitor from one graphics card with another monitor from the other card.

    Read the article

  • Disable ATI Radeon graphics card and use intel graphics (switcheroo unavailable)

    - by user92356
    So I have a HP Envy with ATI Radeon 5450 + intel switchable graphics. I think (though I'm not sure) that the Radeon is running right now on Ubuntu 12.04 (because my laptop is making too much noise when I'm doing something non gpu intensive like word processing, or web browsing). So what I want to do is disable the ATI Radeon and use the Intel instead. I looked around and it seems all the solutions use switcheroo, but I dont have it on my computer! I think this happened because I tried installing the proprietary driver (fglrx). Any and all help is 200% appreciated, thank you

    Read the article

  • Making only the outer vector in vector<vector<int>> fixed

    - by Dennis Ritchie
    I want to create a vector<vector<int>> where the outer vector is fixed (always containing the same vectors), but the inner vectors can be changed. For example: int n = 2; //decided at runtime assert(n>0); vector<vector<int>> outer(n); //outer vector contains n empty vectors outer.push_back(vector<int>()); //modifying outer vector - this should be error auto outer_it = outer.begin(); (*outer_it).push_back(3); //modifying inner vector. should work (which it does). I tried doing simply const vector<vector<int>>, but that makes even the inner vectors const. Is my only option to create my own custom FixedVectors class, or are there better ways out there to do this?

    Read the article

  • Adding Functions to an Implementation of Vector

    - by Meursault
    I have this implementation of vector that I've been working on for a few days using examples from a textbook: #include <iostream> #include <string> #include <cassert> #include <algorithm> #include <cstring> // Vector.h using namespace std; template <class T> class Vector { public: typedef T * iterator; Vector(); Vector(unsigned int size); Vector(unsigned int size, const T & initial); Vector(const Vector<T> & v); // copy constructor ~Vector(); unsigned int capacity() const; // return capacity of vector (in elements) unsigned int size() const; // return the number of elements in the vector bool empty() const; iterator begin(); // return an iterator pointing to the first element iterator end(); // return an iterator pointing to one past the last element T & front(); // return a reference to the first element T & back(); // return a reference to the last element void push_back(const T & value); // add a new element void pop_back(); // remove the last element void reserve(unsigned int capacity); // adjust capacity void resize(unsigned int size); // adjust size void erase(unsigned int size); // deletes an element from the vector T & operator[](unsigned int index); // return reference to numbered element Vector<T> & operator=(const Vector<T> &); private: unsigned int my_size; unsigned int my_capacity; T * buffer; }; template<class T>// Vector<T>::Vector() { my_capacity = 0; my_size = 0; buffer = 0; } template<class T> Vector<T>::Vector(const Vector<T> & v) { my_size = v.my_size; my_capacity = v.my_capacity; buffer = new T[my_size]; for (int i = 0; i < my_size; i++) buffer[i] = v.buffer[i]; } template<class T>// Vector<T>::Vector(unsigned int size) { my_capacity = size; my_size = size; buffer = new T[size]; } template<class T>// Vector<T>::Vector(unsigned int size, const T & initial) { my_size = size; //added = size my_capacity = size; buffer = new T [size]; for (int i = 0; i < size; i++) buffer[i] = initial; } template<class T>// Vector<T> & Vector<T>::operator = (const Vector<T> & v) { delete[ ] buffer; my_size = v.my_size; my_capacity = v.my_capacity; buffer = new T [my_size]; for (int i = 0; i < my_size; i++) buffer[i] = v.buffer[i]; return *this; } template<class T>// typename Vector<T>::iterator Vector<T>::begin() { return buffer; } template<class T>// typename Vector<T>::iterator Vector<T>::end() { return buffer + size(); } template<class T>// T& Vector<T>::Vector<T>::front() { return buffer[0]; } template<class T>// T& Vector<T>::Vector<T>::back() { return buffer[size - 1]; } template<class T> void Vector<T>::push_back(const T & v) { if (my_size >= my_capacity) reserve(my_capacity +5); buffer [my_size++] = v; } template<class T>// void Vector<T>::pop_back() { my_size--; } template<class T>// void Vector<T>::reserve(unsigned int capacity) { if(buffer == 0) { my_size = 0; my_capacity = 0; } if (capacity <= my_capacity) return; T * new_buffer = new T [capacity]; assert(new_buffer); copy (buffer, buffer + my_size, new_buffer); my_capacity = capacity; delete[] buffer; buffer = new_buffer; } template<class T>// unsigned int Vector<T>::size()const { return my_size; } template<class T>// void Vector<T>::resize(unsigned int size) { reserve(size); my_size = size; } template<class T>// T& Vector<T>::operator[](unsigned int index) { return buffer[index]; } template<class T>// unsigned int Vector<T>::capacity()const { return my_capacity; } template<class T>// Vector<T>::~Vector() { delete[]buffer; } template<class T> void Vector<T>::erase(unsigned int size) { } int main() { Vector<int> v; v.reserve(2); assert(v.capacity() == 2); Vector<string> v1(2); assert(v1.capacity() == 2); assert(v1.size() == 2); assert(v1[0] == ""); assert(v1[1] == ""); v1[0] = "hi"; assert(v1[0] == "hi"); Vector<int> v2(2, 7); assert(v2[1] == 7); Vector<int> v10(v2); assert(v10[1] == 7); Vector<string> v3(2, "hello"); assert(v3.size() == 2); assert(v3.capacity() == 2); assert(v3[0] == "hello"); assert(v3[1] == "hello"); v3.resize(1); assert(v3.size() == 1); assert(v3[0] == "hello"); Vector<string> v4 = v3; assert(v4.size() == 1); assert(v4[0] == v3[0]); v3[0] = "test"; assert(v4[0] != v3[0]); assert(v4[0] == "hello"); v3.pop_back(); assert(v3.size() == 0); Vector<int> v5(7, 9); Vector<int>::iterator it = v5.begin(); while (it != v5.end()) { assert(*it == 9); ++it; } Vector<int> v6; v6.push_back(100); assert(v6.size() == 1); assert(v6[0] == 100); v6.push_back(101); assert(v6.size() == 2); assert(v6[0] == 100); v6.push_back(101); cout << "SUCCESS\n"; } So far it works pretty well, but I want to add a couple of functions to it that I can't find examples for, a SWAP function that would look at two elements of the vector and switch their values and and an ERASE function that would delete a specific value or range of values in the vector. How should I begin implementing the two extra functions?

    Read the article

  • Need a PCIe desktop graphics card for dual-monitor

    - by Graham
    I have a mid-2008 workstation with two HD monitors supporting HDMI and DVI inputs. Since Ubuntu 11.10, I have experienced no end of trouble with my NVidia Quadro NVS 290 in TwinView dual-monitor output. Others have similar desktop TwinView woes. I want a new graphics card. Previously I asked for a graphics card recommendation and response was Nvidia Geforce GTS 450... but really I'm looking for someone who has actually got a working dual-monitor desktop to tell me what card they use so I can get something that is known to work. So please, people who have no-issues with their 64-bit Ubuntu 12.04 Unity 3D desktop spread across two HD-resolution external monitors (either DVI or HDMI connector), and who also run Google Chrome (which throws a spanner due to its own GPU compositing)... please let me know what graphics card you have so I can buy one. Gathering Options These seem to be the Nvidia cards featuring dual DVI. But they all seem to be gaming cards - what has dual-DVI, good support, but is not a massive gaming card? Nvidia GTS 450 (previously recommended) - 2x DVI Nvidia GTX 550 Ti (used by System76) - 2x DVI Nvidia GT 430 (used by System76) - 1xDVI, 1xHDMI Nvidia GT 640 (found on NVidia site) - 1xDVI, 1xHDMI (also GT 620, GT 630) Has anyone had a good desktop dual-monitor Unity 3D experience with ATI cards?

    Read the article

  • Laggy Graphics After Upgrade to Ubuntu 13.10

    - by John bracciano
    I noticed some issues concerning the graphics after I upgraded from Ubuntu 13.04 to 13.10. More specifically: Dash tends to be more "laggy" than it used to be. When I switch desktops you can clearly see the screen going frame by frame. Menu bar is also "laggy". When I open GIMP, the menu bar is useless after a while - it takes seconds to refresh. The problems seem to appear after some seconds of use. When I boot the system everything works fine, until some more graphics-intensive program starts (Firefox, GIMP, etc). /usr/lib/nux/unity_support_test -p reports: OpenGL vendor string: Intel Open Source Technology Center OpenGL renderer string: Mesa DRI Intel(R) Ivybridge Mobile OpenGL version string: 3.0 Mesa 9.2.1 Not software rendered: yes Not blacklisted: yes GLX fbconfig: yes GLX texture from pixmap: yes GL npot or rect textures: yes GL vertex program: yes GL fragment program: yes GL vertex buffer object: yes GL framebuffer object: yes GL version is 1.4+: yes Unity 3D supported: yes I use an Asus Zenbook UX31A with: Intel® Core i5 Ivy Bridge Integrated Intel® HD Graphics 4000 Intel® HM76 Express Chipset Thank you in advance for any answer!

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >