Results 1 to 3 of 3

Thread: copy constructors

  1. #1

    copy constructors

    ive been told i need to write a copy constructor for the following bit of common code. the problem is i still dont know how to do it despite looking at a few tutorials. the reason i need it is im texture mapping many objects with different textures( 1 texture for each) and using a normal constructor i.e. COGLTexture picName; and setting picName to a texture image for each object will not work. any help would be great. thanks

    #include <GL\glaux.h>

    class COGLTexture
    _AUX_RGBImageRec *Image;
    unsigned int GetID();
    void LoadFromFile(char *filename);
    void SetActive();
    int GetWidth();
    int GetHeight();
    int Width, Height;
    unsigned int ID;

  2. #2
    Senior Member Regular Contributor
    Join Date
    Mar 2002

    Re: copy constructors

    Copy constructor is a constructor that takes
    a const reference to an object of that type as an argument.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Dec 2002

    Re: copy constructors

    ... and copies the >>complete<< content.

    This includes memory allocation and memcpy.

    As always is your friend.

Similar Threads

  1. Replies: 1
    Last Post: 07-24-2014, 05:03 PM
  2. Constructors and deconstructors
    By Meanz in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 01-11-2012, 01:23 AM
  3. vtx. copy?
    By imported_miroslav_karpis in forum OpenGL: GLSL
    Replies: 3
    Last Post: 06-22-2010, 06:07 PM
  4. loading textures in constructors
    By Molerat in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-15-2004, 02:49 PM
  5. Anyone have a copy?
    By Old GLman in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-12-2002, 06:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean