Results 1 to 3 of 3

Thread: OpenGL, and C++ Builder 4.0

  1. #1

    OpenGL, and C++ Builder 4.0

    I am trying to get Open GL graphics to display in a TPaintBox object. I cannot get anything to display. I am new at this, and so if a TPaintBox component is not supposed to be used for this purpose, please let me know what kind of component I am supposed to use. I have posted my code below, which should draw a white rectangle on a blackbackground inside the picture box. Any suggestions would be greatly appreciated.

    void __fastcall TMain_Form::PaintBox1Paint(TObject *Sender)
    glClearColor(0.0, 0.0, 0.0, 0.0);
    glColor3f(1.0, 1.0, 1.0);
    glOrtho(0.0, 1.0, 0.0, 1.0, 0.0, 1.0);
    glVertex2f(0.25, 0.25);
    glVertex2f(0.75, 0.25);
    glVertex2f(0.75, 0.75);
    glVertex2f(0.25, 0.75);

    Christopher Messick

  2. #2

    Re: OpenGL, and C++ Builder 4.0

    I don't use C++ Builder anymore because I only had problems when using OpenGL. VC++ is better for such things. But I can remember a component that lets you draw OpenGL in it. It can be found here: It's derived from TPanel and initializes OpenGL for you so you have only to handle the window messages and draw something. Your code didn't work because you have to init OpenGL, create a rendering context, set the pixel format etc., before you can use the drawing commands. Hope that helps!


    [This message has been edited by Stonemaster (edited 10-13-2001).]

  3. #3
    Member Contributor
    Join Date
    May 2001

    Re: OpenGL, and C++ Builder 4.0

    Hi there,

    use a TPanel instead and get the HDC with
    HDC dc = GetDC(Panel1->Handle);

    Hope it helps


Similar Threads

  1. C++ Builder and OpenGL
    By soconne in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 08-18-2003, 07:28 AM
  2. OpenGL + Builder C++ 6.0
    By Orzech in forum OpenGL: Basic Coding
    Replies: 21
    Last Post: 08-08-2003, 12:01 PM
  3. opengl in C++builder
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-07-2003, 12:18 AM
  4. OpenGL with c++ Builder
    By BuildaMan in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-25-2000, 02:10 PM
  5. How can I run OpenGL with Builder C++ ??
    By Le Bayonnais in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-29-2000, 09:04 AM

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