Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Di Jun 04, 2024 04:02

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 2 Beiträge ] 
Autor Nachricht
 Betreff des Beitrags: Render in an area of the form.
BeitragVerfasst: Sa Nov 17, 2007 08:32 
Offline
DGL Member

Registriert: Sa Nov 17, 2007 08:08
Beiträge: 1
I'm using opengl for 2D rendering of triangular meshes. I'm using a single form concept with a status bar and couple of buttons at the bottom.

The problem is, when i set the rendering context to the form's handle, and start handling onPaint OpenGL fills the entire canvas when using glClear. The glViewport sets the render area, OK. But how do i constrain the painting area to a rectangle on the form, and not the entire canvas. I've read about rendering in other controls, but things got all messed up :( (... and after 3 hrs. i gave up, and decided to ask :roll:)

In short: How can one make OpenGL draw in a specified region of a form :? 10x in advance.

P.S It's fundamental i know, but i was unable to formulate a decent search phrase :oops:


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Sa Nov 17, 2007 10:27 
Offline
DGL Member
Benutzeravatar

Registriert: Do Dez 05, 2002 10:35
Beiträge: 4234
Wohnort: Dortmund
Welcome to the forum :)

The only thing you have to do is to place an TPanel on your form and create the render context (RC) with the device context (DC) of the panel. Normally you call DC := GetDC(Form.Handle) but now you must call DC := GetDC(Panel.Handle). And with this DC you are able to create an RC on the panel. The OpenGL drawing now will be applied to the panel.

BUT. You said you are using OnPaint from the form. If you only wants to render if the windows need to repaint you can't use the TPanel directlly. The TPanel dosn't provides an OnPaint event. I have written an really small component named TAdvancedPanel. It introduce the OnPaint Event and the ability to recieve the Focus / TabStop and the arrow keys. Simple use this instead the TPanel and it should works.


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 2 Beiträge ] 
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 3 Gäste


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
cron
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.008s | 14 Queries | GZIP : On ]