HIeveryone,
Im quite new to opengl rendering.
My problem is that I want to render multiple opengl windows and load different textures to each window to a cube for example.(this is a VIDEO texure).I know how to do all this and render it to a opengl window, but my problem is that when creating another instance of the class it looks like opengl is mixing the textures and i get weird issues, like this:
Window is rendering video 2
Window 2 is rendering video 1
I get image flickering in the textures
I believe this has to do with creating different threads but im not totally sure. Im working with Qt sdk and opengl.
Thanks and hope for your help.
hi thanks,
ok ive deleted the context part from tha paintgl, thank you, but im still having the same issue.
I know,creating glwidgets and reimplementing initializegl,resizegl,paintgl is quite easy in qt, for basic stuff.
So i dont know if im wrong, should i create a new qglcontext for each instance of my glwidget?(please any sample would be great)
The problems is that Im creating multiple widgets from the same mainwindow thread and displaying them in the maindwindow but got no idea how to change each of the qglwidgets to another thread ,or it is not necessary to do that?
Thanks everybody, all your comments were very helpful!!
I solve my issue with wglMakeCurrent :D. I know can play over 12 video files at the same time with no lag or flickering or any weird stuff happening and in different windows!
Again thanks for your help all!
I used setOpenGl(true) and checked right after if switching to OpenGL was successful (i.e. openGl() returned true). I I used an OpenGL benchmark software to make sure there wasn't anything wrong with my machine. Everything looked fine.
I've been continuing to try to debug what is going wrong here. Taking my existing project out of the equation, I switched over to the interactions example. It works flawlessly and responds very quickly as is. Just by adding a callsetOpenGl(true); slows down the responsiveness considerably.
I just ran a few of Qt's OpenGL examples (OpenGL Accelerated Series, OpenGL Window Example, Cube Open GL ES 2.0 Example, 2D Painting Example, and Hello GL2 Example). The all ran perfectly. The OpenGL accelerated series for example ran at 55-60 FPS with OpenGL and 33 FPS without it.
CPU renderer uses about 7% CPU in a given application (redrawing a particular plot every 17ms), OpenGL uses 15%. I remember having a go when QCP2 Beta was new and it worked a dream with Qt 5.6. I think it might be something to do with the OpenGL changes in 5.7.
i use the example in the qcustomplot package which in the dir QCustomPlot2\examples\plots, and i chose the setupRealtimeDataDemo.
with openGL, it only reach 67fps
without openGL, it reach 189fps
I got the same result with chzw.Maybe my pc is poorer,I got 22 fps when I use opengl into the setupRealtimeDataDemo.I truly want to know can qcustomplot really improve the plot quality of real time data?If someone would tell me?
aaleexx: No that wasn't the case. Using the right calls as suggested in the link above fixes the linker problem without adding the -lOpenGL32 line.
Still though, the performance is horrible in OpenGL compared to software renderer.
I have exactly the same problem: FPS declines to 2 with around 4 millions points on screen, and OpenGl doesn't help here. On the contrary FPS are much higher without OpenGL when only a few hundreds points are available for plotting. Any solution?
I found a Nene Tutorial for opengl on his website. he has written a tutorial on learning OPENGL. however, his tutorials cover opengl in windows environments, not linux. therefore, he doesn't go through the steps of creating the developing environment for OPENGL.
he has an example that is easy (example1), the code is simple, probably just 20 lines or so. however, when i compile with gcc, i get errors. i'm in school right now, not at home so i can't remember what I typed. my question is just this:
As far as I know, SDL doesn't replace anything from the OpenGL API, it just adds general functionality which is needed anyway and platform specific, like opening windows, configuring a graphical context, sound, mouse/keyboard input, etc. and other things not done by OpenGL.
however, i tried the nehe tutorial that uses sdl, and it works perfectly!!
am i stuck with SDL(not a bad thing of course)?
-am i typing in the wrong GCC command?
-what are the differences in sdl and glut? is sdl better? would it help me -more to learn sdl instead of glut?[/b]
I am looking into porting our plugin to VST3 and I would like to use VSTGUI to get a platform independent editor window where I can draw with pure OpenGL (maybe NanoVG).
I just need OpenGL functions, mouse and keyboard events. (No UI components from XML etc.) I cannot find examples on the internet.
How do I create my editor (which class to inherit from)?
How do I use the COpenGLView?
Could you please give me some pointers?
Hi,
for this case, VSTGUI might be overkill. You just have to create a custom IPlugView implementation, where you add either a HWND or an NSView to the parent view which is provided to you in the attached call.
After experimenting I have a test GUI inherited from VSTGUIEditor and a view inherited from COpenGLView. I can have mouse and keyboard events, and I can add views like CTextEdits. I noticed that CTextEdits are covered by the COpenGLView.
I would like to add text edits on top of the opengl view. Is it possible?
I am working with frame buffer objects, too and I need to make sure context is current many times.
Performance would benefit if there was a way to avoid calling makeContextCurrent() when the context is already current.
Welcome to my OpenGL tutorials. I am an average guy with a passion for OpenGL! The first time I heard about OpenGL was back when 3Dfx released their Hardware accelerated OpenGL driver for the Voodoo 1 card. Immediately I knew OpenGL was something I had to learn. Unfortunately, it was very hard to find any information about OpenGL in books or on the net. I spent hours trying to make code work and even more time begging people for help in email and on IRC. I found that those people that understood OpenGL considered themselves elite, and had no interest in sharing their knowledge. VERY frustrating!
I created this web site so that people interested in learning OpenGL would have a place to come if they needed help. In each of my tutorials I try to explain, in as much detail as humanly possible, what each line of code is doing. I try to keep my code simple (no MFC code to learn)! An absolute newbie to both Visual C++ and OpenGL should be able to go through the code, and have a pretty good idea of what's going on. My site is just one of many sites offering OpenGL tutorials. If you're a hardcore OpenGL programmer, my site may be too simplistic, but if you're just starting out, I feel my site has a lot to offer!
This tutorial was completely rewritten January 2000. This tutorial will teach you how to set up an OpenGL window. The window can be windowed or fullscreen, any size you want, any resolution you want, and any color depth you want. The code is very flexible and can be used for all your OpenGL projects. All my tutorials will be based on this code! I wrote the code to be flexible, and powerful at the same time. All errors are reported. There should be no memory leaks, and the code is easy to read and easy to modify. Thanks to Fredric Echols for his modifications to the code!
I'll start this tutorial by jumping right into the code. The first thing you will have to do is build a project in Visual C++. If you don't know how to do that, you should not be learning OpenGL, you should be learning Visual C++. The downloadable code is Visual C++ 6.0 code. Some versions of VC++ require that bool is changed to BOOL, true is changed to TRUE, and false is changed to FALSE. By making the changes mentioned, I have been able to compile the code on Visual C++ 4.0 and 5.0 with no other problems.
After you have created a new Win32 Application (NOT a console application) in Visual C++, you will need to link the OpenGL libraries. In Visual C++ go to Project, Settings, and then click on the LINK tab. Under "Object/Library Modules" at the beginning of the line (before kernel32.lib) add OpenGL32.lib GLu32.lib and GLaux.lib. Once you've done this click on OK. You're now ready to write an OpenGL Windows program.
NOTE #2: When the first tutorials were written, GLAUX was the way to go. Over time GLAUX lost support. Many of the tutorials on this site still use the old GLAUX code. If your compiler does not support GLAUX or you would rather not use it, download the GLAUX REPLACEMENT CODE from the main page (left menu).
Next you need to set up all the variables you plan to use in your program. This program will create a blank OpenGL window, so we won't need to set up a lot of variables just yet. The few variables that we do set up are very important, and will be used in just about every OpenGL program you write using this code.
The first line sets up a Rendering Context. Every OpenGL program is linked to a Rendering Context. A Rendering Context is what links OpenGL calls to the Device Context. The OpenGL Rendering Context is defined as hRC. In order for your program to draw to a Window you need to create a Device Context, this is done in the second line. The Windows Device Context is defined as hDC. The DC connects the Window to the GDI (Graphics Device Interface). The RC connects OpenGL to the DC.
The first line below sets up an array that we will use to monitor key presses on the keyboard. There are many ways to watch for key presses on the keyboard, but this is the way I do it. It's reliable, and it can handle more than one key being pressed at a time.
The active variable will be used to tell our program whether or not our Window has been minimized to the taskbar or not. If the Window has been minimized we can do anything from suspend the code to exit the program. I like to suspend the program. That way it won't keep running in the background when it's minimized.
3a8082e126