Jump to content

  • Log In with Google      Sign In   
  • Create Account

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   Members   

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


#2   Members   

24826
Like
5Likes
Like

Posted 08 July 2014 - 11:30 AM

*
POPULAR

Because you are doing something wrong.


L. Spiro

#3   Members   

16704
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.

Game Developer, C++ Geek, Dragon Slayer - http://seanmiddleditch.com

C++ SG14 "Games & Low Latency" - Co-chair - public forums

Wargaming Seattle - Lead Server Engineer - We're hiring!


#4   Members   

2266
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   Members   

4736
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.

My current game project Platform RPG

#6   Members   

24826
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.