Jump to content

View more

Image of the Day

The beast has a mighty searchlight of evil! #screenshotsaturday https://t.co/bzKepOojDL
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

OpenGL rendering problem

4: Adsense

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   

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 L. Spiro   Members   

25471
Like
5Likes
Like

Posted 08 July 2014 - 11:30 AM

*
POPULAR

Because you are doing something wrong.


L. Spiro

#3 SeanMiddleditch   Members   

17493
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 Sponji   Members   

2422
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   

5032
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 L. Spiro   Members   

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