Results 1 to 2 of 2

Thread: Rendering mess (white box texture error)

  1. #1
    Member Contributor
    Join Date
    May 2012
    Posts
    51

    Rendering mess (white box texture error)

    I've got a weird issue were my class renders an error texture (the white box), when I initialize it with my constructor globally. However the same error doesn't happen when I initialize it in my Display function. How is this possible?

    I'm guessing I have to initialize it in an init function but I don't want to loose my constructor.

    Code :
    	C_Visual_Obj qMenu((GLboolean) 1,
    		                guiSmile_txtID,
    						(GLboolean)0,//frame state
    						1.0f,//frame size 
    						300.0f,//position
    						100.0f,
    						0.0f, 0.0f,//V1
    						100.0f,0.0f,//V2
    						100.0f,50.f,//V3
    						0.0f,50.f,//V4
    						Anime_Static);
    void display(void)
    {	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    	glClearColor(1.0,0.0,0.0,1.0);
     
    	//STATE: MENU
     
    	qMenu.Draw();

  2. #2
    Newbie Frequent Contributor
    Join Date
    Mar 2016
    Posts
    896

    Re: Rendering mess (white box texture error)

    Does your constructor make OpenGL calls? If so, you need to have a valid OpenGL context at the time the c'tor runs. Creating the object as a global variable means it is created before main() and you don't have a context.
    One way to work around that is to make the global variable a pointer and create the object on the heap after the OpenGL context is created.

Similar Threads

  1. White screen Flicker for rendering image
    By thilegl in forum OpenGL: Linux
    Replies: 0
    Last Post: 01-19-2019, 01:31 AM
  2. ShadowMap not rendering, FBO full white
    By giordi in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 05-24-2016, 04:34 PM
  3. Depth texture issues - All white texture
    By Illiander in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 11-17-2014, 03:56 AM
  4. White depth texture using FBO
    By Maire Nicolas in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 10-28-2010, 01:15 AM
  5. multitexturing texture mess
    By JanHH in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-10-2003, 11:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean