sharing a Rendering Context for multiple wnds..

Started by
11 comments, last by phueppl1 23 years, 3 months ago
Hi! Following problem: In my Leveleditor I''ve got 5 Rendering Context for each open map. each for one window and one to share the textures between the windows. So, I thought that that doesn''t make to much sense... My Question: Can I punsh all the views into one rendering Context and set the Rendering Context with wglmakecurrent(HDC, HGLRC); to my current view, draw the stuff, go to the next view and do the same? Then I wouldn''t have to worry about sharing textures either. state variables wouldn''t be that big of a problem either, I think. thx, cya, Phil Visit Rarebyte! and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states
Visit Rarebyte! and no!, there are NO kangaroos in Austria (I got this question a few times over in the states ;) )
Advertisement
Hi


Sorry but this is not a answer to your question but I hope it helps. I will be doing a sort of editor in vb quite soon and I had planed to just use ONE OpenGL window but split it four ways, I think there is something on this in the red book. Hope the idea helps and I think it will ease the coding a little.

3DG
Yeah, I thought of doing this too... but I don''t think I pays of anymore. My Leveleditor is already in a stage we''re I shouldn''t turn it all around again..

3DG... You will probably have to draw your own splitter then... I just found it out a few minutes ago...
Good luck..
cya,
Phil

Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states
Visit Rarebyte! and no!, there are NO kangaroos in Austria (I got this question a few times over in the states ;) )

Nice One Dude, and Thanks


3DG

You can share contexts but make sure you do it at the start of your program. I went for the single context split four ways with my 3d editor after I went with four separate windows. I found the four windows updating right after each other visually annoying.

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato
"... we should have such an empire for liberty as she has never surveyed since the creation ..."Thomas Jefferson

I too am working with a multi-view, multi RC editor.
I would greatly appreciate knowing if you are sharing
the textures using texture objects or by display lists.
Currently I''m using Texture objects, which I''m told, are
able to be shared by multiple RC''s BUT I cannot get
sharing to work with the objects. Do you know how????

Any help would be greatly appreciated. Thanks.
Ok, here''s how I did it: ( at least it seems to work :p)

2 Global Variables: a HGLRC and a HDC.
Load the Rendering Context and the HDC at the start of your programm, I did it in CMainframe::OnCreate();
Whenever you load a texture, make this one the current HGLRC with wglMakeCurrent()(look it up in the MSDN for further infos ;o), and load it.
Then.. each view has it''s own rendering context. at the initialization of the view, call wglShareLists(globalHRC, viewshrc); This should do it. You should have acess to the textures now.
hope that helped,
cya,
Phil

Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states
Visit Rarebyte! and no!, there are NO kangaroos in Austria (I got this question a few times over in the states ;) )

Thanks for the info.

I think that''s similar to the way I tried it.
Had the first view using a global HGLRC (but not a
global HDC) then set up the texture objects there
with glGenTextures.
The other view had it''s own HGLRC and tried using
wglShareList with no success.
I didn''t get any error codes but the textures were not
there (only white objects) and when I went back to the
first view the textures got blown away there also (white).
??
I''ll try it again this weekend with a global HDC.

Once again, you are using textures objects, right??


Thanks,

Roy
Jup...

I had problems before I had the global HDC:

I had to leave the first Map open and then load a 2nd one. otherwise the textures weren''t accessable.. grml grml...
then I found out that I was loading them into the wrong context or so. So the Texture Loading func''s calls wglMakeCurrent(global HDC, global HGLRC); and then loads the texture. at least that helped in my case...
cya,
Phil

Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states
Visit Rarebyte! and no!, there are NO kangaroos in Austria (I got this question a few times over in the states ;) )
phueppl1,

Man, I could kiss you!

Made a fast test (my old tests were just commented out
so it was quick to do)

My problem was that I had
the wglShareList variables reversed ( okay, I''m stupid
Had the newHGLRC first then the globalHGLRC with the
textures second. Still not using a global HDC tho.

I only tested it in one of my other views and it worked
great. Didn''t have to wait a few seconds for the textures
to be bound again and also freed up the meg or so of
textures I was loading. This is great. I''ve been trying
for a month or so on this and was about to give up.

If I sound overjoyed it''s because I am. Thanks !!!!

Roy...

This topic is closed to new replies.

Advertisement