OpenGL Problem

OpenGL Problem

Post by Matthias Knok » Fri, 27 Jun 2003 15:39:06



I have made a small open GL program that is running fine if I draw on the
Canvas of a TForm. what I want is to draw in a part of the window only (for
example in the canvas of a TPaintBox), but when I'm using the same code on
the canvas of the Paiontbox, nothing happens.

Whats wrong ?

Best regards
Matthias

 
 
 

OpenGL Problem

Post by Nikumar » Sat, 28 Jun 2003 02:30:44


Hi,

Nothing happens? or some error happens?
Anyway, try using a window control component which is inherited from
TWinControl.
How about this?

Nikumaru


Quote:> I have made a small open GL program that is running fine if I draw on
the
> Canvas of a TForm. what I want is to draw in a part of the window only
(for
> example in the canvas of a TPaintBox), but when I'm using the same
code on
> the canvas of the Paiontbox, nothing happens.

> Whats wrong ?

> Best regards
> Matthias


 
 
 

OpenGL Problem

Post by Matthias Knok » Thu, 03 Jul 2003 19:38:16


Thanks,
but I don't know  a window control that is inherited from TWinControl and
has a Canvas-property to draw on it (Canvas is defined in TCustomForm).

When I'm starting the program that is drawing OpenGL on the Canvas of
TPaintbox nothing happens - I can see an emty grey window only, there are no
error messages and nothing is displayed in the window ...

Matthias



> Hi,

> Nothing happens? or some error happens?
> Anyway, try using a window control component which is inherited from
> TWinControl.
> How about this?

> Nikumaru



> > I have made a small open GL program that is running fine if I draw on
> the
> > Canvas of a TForm. what I want is to draw in a part of the window only
> (for
> > example in the canvas of a TPaintBox), but when I'm using the same
> code on
> > the canvas of the Paiontbox, nothing happens.

> > Whats wrong ?

> > Best regards
> > Matthias

 
 
 

OpenGL Problem

Post by Scott Heima » Thu, 03 Jul 2003 20:38:38


You will find links to several OpenGL components at the bottom of my OpenGL
page.  Several of them come with source code.  I don't recall any that use
TPaintBox, but I think that at least one uses a TPanel.

Personally, I have never been happy with an OpenGL component that inherits a
control that already has a TCanvas component.  I created my own control from
TWinControl.  I used the ::GetDC and ::ReleaseDC functions to create and
maintain my own device context.  That way I have complete control over the
device context, and complete control over how the OpenGL scene is updated.

Existing controls (that inherit TCustomControl) will update the canvas every
time certain windows events occur.  I was never able to create a
'flicker-free' OpenGL component from an existing control.  Others have, but
there implementations limit the the update rate of the scene.

--
Regards,
Scott
http://members.cox.net/scottheiman/
(a valid e-mail address can be found on my home page)

 
 
 

1. OpenGL problems on Sun...poor OpenGL implemenation?

I have some code for printing an OpenGL window that works on an SGI but
crashes with a segmentation fault on a Sun.  Basically, to print the
window, I perform these steps:

1) Grab a new visual similiar to the window to print from, but make it
single-buffered instead of double-buffered.
2) Create a new context with the new single buffered visual (and share
the display lists with the "real" context)
3) Create an X pixmap
4) Create the GLX pixmap
5) Call glXMakeCurrent() with the new context and pixmap
6) Rerender the scene to the pixmap
6) Call glReadPixels() on the pixmap, format the RGB values, convert to
PostScript and print

Like I said, works fine on an SGI.  However, NOTHING seems to work on
the Sun, other than rendering to my initial context.  The problems I
have are many:

1) I can't create a new context on the Sun.  Once I create one, the next
one always fails.
2) Trying to use the same context for the pixmap fails.  I can create
the pixmap and everything using the same context and visual as my OpenGL
window, but when I call glXMakeCurrent(dsp, pix, cx) my program crashes
with a segmentation violation.  This *really* seems like a bug.  At the
very least, glXMakeCurrent() should just return false if it can't switch
the current context and drawable.

As it stands now, I don't know how to print my window from a Sun.
Calling glReadPixels() on the frame buffer won't work if the window is
obscured (and it typically is with a print dialog).

Any help would be greatly appreciated!!!!!
Scott

--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---

2. FS: Sony EVO-9650 Hi8 S.F.R. w/RGB inputs

3. OpenGL Demo (Was: Re: TNT OpenGL problems)

4. .bmp to .jpg

5. OpenGL problems :(

6. Blank DB Grid Showing

7. Newbie: opengl problem with ATI Xpert 98

8. Mac Video Solutions...

9. VTK and Win NT/98 OpenGL problems

10. ATI Nexus 128 OpenGL problems

11. VW 320 OpenGL Problem...

12. OpenGL problems in IRIX6.5