Click here to Skip to main content
15,880,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi everyone,

I've created a program that uses threads to process the images and points (which are centers of cubes)

I would add a low priory thread that uses OpenGL functions to draw the cubes as they have them processed, through the centre and size, using "wiredCube"...I'm just not very good with OpenGL, but I have read various articles here and looking on google: all the examples I find are with "mainloop" in the main, in charge of launching the various drawing functions of OpenGL...

Instead, how can I do to have a simple function of three-dimensional design, which is updated every few time, with the cubes refreshing, with just a simple thread?

I'm on Visual C++ and a 64bit app. I've read that I need freeglut to use 64bit libs...

Please, someone could show me how?

A piece of code of my program is this:

C++
#include <windows.h>
#include <process.h>


....
variables, others..

int main(){

	HANDLE handle0,handle1,handle2,handle3,handle4;
  
	//threads
	handle0 = (HANDLE) _beginthread(puts,0,&dati0);
	handle1 = (HANDLE) _beginthread(grey,0,&dati1);
	handle2 = (HANDLE) _beginthread(soglia,0,&dati2);
	handle3 = (HANDLE) _beginthread(finitura,0,&dati3);
	handle4 = (HANDLE) _beginthread(verifica,0,&dati4);

	//join
	WaitForSingleObject(handle0,INFINITE);
	WaitForSingleObject(handle1,INFINITE);
	WaitForSingleObject(handle2,INFINITE);
	WaitForSingleObject(handle3,INFINITE);
	WaitForSingleObject(handle4,INFINITE);

..other code...
...

}



I need to insert a "fifth" thread that do 3D drawing, in low priority (background)...

Please, help me.
Posted
Updated 28-Jan-14 22:15pm
v2
Comments
KarstenK 29-Jan-14 5:46am    
consider using normal priority and check in the thread if you really NEED to draw.
Domus1919 29-Jan-14 5:57am    
Yes, but how use OpenGL drawing functions without the "mainloop" statements? In a void function I want to put all OpenGL functions to draw, but how in a single thread?
Rage 25-Feb-14 8:35am    
Either you use timers or you enter your thread periodically and check if you have to redraw

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900