Jump to content
  • Advertisement
Sign in to follow this  
codehammer

OpenGL OpenGL rendering problem

This topic is 1472 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

 

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!