List availibility

i have a cocoa app and i am using a custom opengl view. my problem is: from time to time display lists are not availible. every 3 frame a glIsList returns GL_FALSE. the lists are generated in the awake from nib. how can this be??? is there a cocoa specific problem? :mad: :mad: :mad:

another one: i want to use selection mode to pick objects on the screen. but the rendering is senseless if the process is not in the drawGLScene but i only want to render to the selection buffer. if i execute the selection function in the drawGLScene everything works.

the first problem is driving me crazy!! hope y have experience with something like that…

Make sure your context is current when you make GL calls. If it’s not, behavior is undefined and likely to crash.

In particular, NSOpenGLView will only make its context current for -drawRect:, -reshape and -prepareOpenGL. If you wish to make GL calls at any other time, you must make the correct context current yourself. I don’t recommend it; limiting your GL calls to those three methods is much safer and cleaner.

ok…thank you

the problem also occurs in C funtions called in the drawGL function. how can this be?

the problem is back again and i can’t ignore it anymore

i use a timer to run the mainloop (how would you do this) the timerUpdate function is:

[[self openGLContext] makeCurrentContext];
[self drawGLScene];
[NSOPenGLContext clearCurrentContext];

it looks like glTexImage2D works randomly !!!argggg!!!

suggestions to avoid this…

have you run in the profiler with “break on error” turned on?

Display lists work fine for me. Though, the difference is, I don’t use Cocoa. :slight_smile: Glut works just fine.

which profiler? opengl profiler?

no i have to use cocoa glView - it is a complicated tool with gui with integrated glviews.

yes, the opengl profiler.

<unregistered>: GLUT is written with Cocoa :stuck_out_tongue:

i have analyzed the problem and found that every second frame i can’t call any functions - even cocoa functions can’t be executed - no error code - nothing - so it is a cocoa problem :eek:

do you have a simple openglview which works perfectly?
i have a custom class - subclass of openglview and the standard functions of all examples

timer is like the timer in all examples - don’t understand the world anymore :eek: :eek: has an example of how to set up GL in cocoa that should work. I’m not saying it’s the best way, but it’s a working way :slight_smile:

thanks. really nice examples!

i know it is nonesense but in my draw functions i set some gui elements. in drawRect i have no (write) access to IBOutlets. what is the reason for that?

i even have no access to other cocoa class instances declared in the glview.h

lets say i have a TableController.h and TableController.m and in the glview.h i have

@interface glView: NSOpenGLView
TableController* table;

in drawRect of glView following method call can’t be executed: [table doSomething]; (no error - just not working runtime)

that’s not declared as an IBOutlet, are you sure it’s being hooked up correctly?

remember that it’s legal to send messages to nil receivers in ObjC, and the result is that silently, nothing happens.

in all other methods it works - receiver must bei correct.

it doesn’t matter any more. i have used another method to update the gui elements.

thanks for the great support!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.