Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6999917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:36:14+00:00 2026-05-27T20:36:14+00:00

I have an OSG application that I want to texture map a full screen

  • 0

I have an OSG application that I want to texture map a full screen quad in the finalDrawCallback because I need everything in my scene to be rendered before the texturing is done. This is why I have to use the openGL calls instead of the osg calls for the program and shaders to execute.

Specifically I seem to have an issue with compiling both the vert and frag shaders. When I call glGetShaderiv(shader, GL_COMPILE_STATUS, &param), my param value doesn’t change or is undefined. Which, according to its documentation says that an error was produced. However, when I call glGetError() to check, openGL reports GL_NO_ERROR.

Here is the setup function

    glActiveTexture(GL_TEXTURE0);
    glGenTextures(1, &screenTexture);
    glBindTexture(GL_TEXTURE_2D, screenTexture);
    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

    glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

    glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);

    GLuint vs = glCreateShader(GL_VERTEX_SHADER);
    const GLchar* vs_source = shaderLoadFile("vert.glsl");

    glShaderSource(vs, 1, &vs_source, NULL);
    glCompileShader(vs);
    checkShader(vs);

    GLuint fs = glCreateShader(GL_FRAGMENT_SHADER);
    const GLchar* fs_source = shaderLoadFile("frag.glsl");

    glShaderSource(fs, 1, &fs_source, NULL);
    glCompileShader(fs);
    checkShader(fs);

    prog = glCreateProgram();
    glAttachShader(prog, vs);
    glAttachShader(prog, fs);

    glLinkProgram(prog);
    glUseProgram(prog); 

And helper functions for reading the shader source:

FILE *f = fopen(file, "rb");
if (f == NULL)
{
    std::cout<<"Error: Unable to locate shader files.\n";
    exit(-1);
    return NULL;
}

fseek(f, 0, SEEK_END);
long size = ftell(f);
fseek(f, 0, SEEK_SET);
char* ret = new char[size+1];
fread(ret, size, 1, f);
fclose(f);
ret[size] = '\0';
return ret;

And the Shaders themselves

    //vertex shader
void main() 
{
    glTexCoord[0] = gl_MultiTexCoord0;
}
     //frag shader
uniform sampler2D screenTex;
void main()
{
    gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); 
}

Edit: I just figured this out. It seems the problem was that I had no graphics context when making these calls.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:36:14+00:00Added an answer on May 27, 2026 at 8:36 pm

    It seems the problem was that I had no graphics context when making these calls. I believe this explains the reason no error was being produced but the shaders failed compiling.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have you used VS.NET Architect Edition's Application and System diagrams to start designing a
Have a n-tire web application and search often times out after 30 secs. How
Have searched the database but need to specifically sum(of hours flown or days off)in
Have a bunch of WCF REST services hosted on Azure that access a SQL
Have finally got a responsive site working (of a fashion). What I want to
Have a look at one of my websites: moskah.com The problem is that it
Have a simple contact us XPage created. Have server side validation in place that
Have some dates in my local Oracle 11g database that are in this format:
Have an app that can use tts to read text messages. It can also
Have a fun issue with sharepoint calendar view filtering. That code works fine: SPSecurity.RunWithElevatedPrivileges(delegate()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.