Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


OpenGL rendering problem


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 codehammer   Members   -  Reputation: 124

Like
0Likes
Like

Posted 08 July 2014 - 11:14 AM

why am i getting this strange window when i run my program, instead of what am suppose to get (window filled with red)

 

Attached Thumbnails

  • show_out.png


Sponsor:

#2 L. Spiro   Crossbones+   -  Reputation: 18938

Like
5Likes
Like

Posted 08 July 2014 - 11:30 AM

Because you are doing something wrong.


L. Spiro

#3 SeanMiddleditch   Crossbones+   -  Reputation: 10066

Like
3Likes
Like

Posted 08 July 2014 - 12:03 PM

To clarify Spiro's snarky answer: you gave us absolutely zero information other than "it's broke." smile.png Give us your full (ready-to-compile) code or a minimal (ready-to-compile) test case that exhibits the problem.

#4 Sponji   Members   -  Reputation: 1598

Like
0Likes
Like

Posted 08 July 2014 - 12:19 PM

That paintGL isn't probably called at all, so you have to tell qt that the widget should be updated. Try calling updateGL.


Derp

#5 HappyCoder   Members   -  Reputation: 3058

Like
0Likes
Like

Posted 08 July 2014 - 02:20 PM

Your window is showing a chunk of uninitialized memory, so it is showing whatever was there before. I appears you are clearing the screen. Are you swapping the back buffer to the window after you are done drawing?

 

EDIT: I have never used qt, but it appears that Sponji is referring to the same thing, make sure you present your rendered scene to the window.


Edited by HappyCoder, 08 July 2014 - 02:21 PM.


#6 L. Spiro   Crossbones+   -  Reputation: 18938

Like
1Likes
Like

Posted 08 July 2014 - 03:18 PM

Ensure that your view inherits from QGLWidget.

If you want the screen to refresh actively, create a QTimer set to a slot that calls repaint() on that widget.

For example:
class C3dViewWidget : public QGLWidget {

…

protected :
	// == Members.
	// Update timer.
	QTimer		m_tTimer;

private slots :
	/**
	 * Called by the timer to update this view.
	 */
	void		Update();
};

void C3dViewWidget::InitWidget() {
	connect( &m_tTimer, SIGNAL( timeout() ), this, SLOT( Update() ));
}

void C3dViewWidget::Update() {
	this->repaint();
}
You can get a lot more useful help when you actually put some effort into your question.
If you still have a problem, then you should probably include a lot more information in your next post.


L. Spiro

Edited by L. Spiro, 08 July 2014 - 04:45 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS