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 codehammer   Members   -  Reputation: 123

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: 13600

Like
5Likes
Like

Posted 08 July 2014 - 11:30 AM

Because you are doing something wrong.


L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#3 SeanMiddleditch   Members   -  Reputation: 5872

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: 1251

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: 2665

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: 13600

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.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums




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