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

  • Home
  • SEARCH
  • 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 7938991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:57:49+00:00 2026-06-03T22:57:49+00:00

EDIT: I’m sorry Stack Overflow, but I’m retarded. frac(tex_offset) -> fract(tex_offset) , and it

  • 0

EDIT: I’m sorry Stack Overflow, but I’m retarded. frac(tex_offset) -> fract(tex_offset), and it works fine on ATI cards, and also nVidia cards when #version is specified now. This must be why most of the programmers I know don’t have much hair left.

–

I’m working on a game for a school project. It’s a vertical scroller, so one of the required features was a scrolling background. I tried a few approaches, but I eventually wrote a simple fragment shader (this is the first time I touch shader programming, so don’t really know what I’m doing):

uniform sampler2D tex;
uniform float tex_offset;

void main()
{
    vec2 coords = vec2(gl_TexCoord[0].s, gl_TexCoord[0].t - frac(tex_offset));
    gl_FragColor = texture2D(tex, coords);
}

I use SFML so I don’t touch much of the stuff behind the scenes, but the texture I’m using is passed to the tex variable, and the tex_offset is generated in my game loop by taking the total elapsed seconds multiplied by a factor to control the scrolling speed.

This appears to do what it’s supposed to; it indefinitely scrolls a seamless repeating texture in one direction. It works on my laptop, and it works on my home computer, which both have nVidia cards. However, when we tried to run it on a group member’s computer with an ATI card, it simply did nothing. I did some googling and it seems like the nVidia cards accept “non-standard” GLSL code as well, which might explain the issues with compatibility. I find it difficult to find good tutorials/explanation on GLSL as most of the stuff I dig up is from version 1.2-1.4 and I’m apparently using syntax that was deprecated in version 3 (gl_FragColor, gl_TexCoord). However, when I tried to set #version to 120 or 140 or whatever, the shader also stopped working on my nVidia computers.

So, to try to phrase this into question form: what is wrong about this shader code? Is there any way to debug the syntax, and how do I turn on “standards” mode for my nVidia cards if this is possible?

  • 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-06-03T22:57:51+00:00Added an answer on June 3, 2026 at 10:57 pm

    Changed frac(tex_offset) to fract(tex_offset), and it works fine on ATI cards, and also nVidia cards when #version is specified now.

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

Sidebar

Related Questions

EDIT: I switched back to XHTML 1.0 Transitional. It renders fine, but isn't valid.
EDIT 1 I apologize but after reading the 2 suggested articles I still don't
EDIT: This post was originally specific to ASP.NET, but after thinking about it I'm
EDIT: There's now a doc page on this so this question is irrelevant, also
Edit: I'm looking for solution for this question now also with other programming languages.
EDIT Leaving this for posterity, but nearly a year later, to get down voted,
EDIT: Sorry about ellipsis that's not what I actually have. For declaring an array
EDIT: I'll try and make it clearer sorry for the confusion. I have two
EDIT: solved, I know how but I don't understand why. I changed variables declaration
EDIT: looking for this: http://diminishing.org/extending-formtastic-with-a-sprinkle-of-jquery (If this works I'll answer my own question) I've

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.