Results 1 to 2 of 2

Thread: problems with 'background' painting

  1. #1
    Member Newbie
    Join Date
    Aug 2002
    Location
    Germany
    Posts
    35

    problems with 'background' painting

    Hi,
    my problem is the following:
    i have an animated object (in my case something like a water surface with expanding waves).
    Now i wanted to put a background image from a *.bmp file. After having some trouble with writing a function that can cope with the file and return useful data i can 'paint' the image in glOrtho2D() projection 'mode'to the framebuffer with glDrawPixels(). Of course only without animation. When i try to do the same with animation and 3D-Projection (means something like calling glDrawPixel 30 times a second and painting the background before rendering the 3D Objects)the program becomes incredible slow or hangs completely up.
    I dont know anything about Texture mapping yet. Can you give me some advice how to take a 1,2 MB image and to use it for painting background in reasonable speed.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Apr 2001
    Posts
    340

    Re: problems with 'background' painting

    Use texture mapping
    Here are the steps :
    1/ at init time, load your .bmp file somwhere in memory in a suitable layout (I assume you managed to do this since you use glDrawPixels)
    2/ at init time create a texture object, and initialize it with the data loaded from the bmp (look at glTexImage2D)
    3/ for every frame :
    clear color buffer & depth buffer
    disable depth buffer writing
    enable 2D texture
    bind your texture
    draw a quad that covers the window with proper texture coords
    disable 2D texture
    enable depth buffer writing
    draw your scene as usual

Similar Threads

  1. changing texturevalues for painting
    By lyd in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 11-24-2004, 02:01 PM
  2. 3D Painting
    By lyd in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-26-2004, 08:51 PM
  3. Painting regions
    By CuriosoVB in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-18-2003, 11:09 PM
  4. Bad painting with bezier curves
    By Liso in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 10-08-2002, 08:48 AM
  5. 3D Painting
    By renderman in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 08-17-2000, 05:38 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