Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Strange stuff happening with OpenGL  (Read 1282 times)
0 Members and 1 Guest are viewing this topic.
Offline trollwarrior1
« Posted 2013-11-14 21:16:09 »


so basically what the problem is when I start my level, the first thing that I see are kinda random sprites for no reason. It happens only for a split second.

I tried to make a screenshot, but in that screen shot I couldn't see what I saw seeing on the screen. I thought I failed to make a screenshot, so I recorded everything. It didn't show up on the recording as well.

What might be causing this? I'm using VBO to render this. What might be causing this strange thing? I wanted to make a screenshot or something, but as stated above it doesn't really work like that Cheesy

I don't even know what to ask. Why would stuff be appearing on the screen and not on the Print Screen or recorded video?

It seems like tile sprites are being replaced by one of the animation sprites. It happens for 2 game ticks (60/s). I just don't get it. If I was swapping sprites by mistake or something it would show up on the screen i think. This is like an error with opengl or something.

I tried recording few more times using different frame rates. I managed to record the problem. My recorder probably wasn't catching the game once it was running at 60 fps. So now this is a problem with my rendering or something. That is a relief Tongue Now I can fix it somehow! Cheesy
This is how it looks like Cheesy

The problem occurs when I spawn zombies! Cheesy The problem only lasts one frame.
I could just spawn 1 zombie behind the scenes before the game even starts rendering, but that wouldn't really solve the problem. This is just kinda strange.
My Zombie class has static SpriteSheet which is just an opengl texture basically. It isn't used anywhere. I think the problem is with texture binding. When I create 1st zombie, static texture get created, therefore binding itself to opengl. I still need to confirm this, but problem is probably with texture binding. My Tile sprite seems to be rendering at the same coordinates but from the other texture.
Yeap the problem is with binding. I have this "abstract" kinda class for rendering called screen. When I render a sprite, I try to set current texture to that of sprite. If the texture is already the same, I don't do anything. If it is different, I have a reference to the last spritesheet I set. When I create textures, I don't use screen class to set textures at all, therefore breaking it. In the other words, this is just an error of binding textures properly.
Offline lcass
« Reply #1 - Posted 2013-11-14 22:32:33 »

Hmm are you adding anything to your game that might be drawn say a rogue render call in one of the constructors?
Offline Opiop
« Reply #2 - Posted 2013-11-15 01:17:18 »

Post some code. This isn't an OpenGL issue obviously, so why wouldn't you include code? This is a personal code issue, and no one can see your code unless you share it.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline SHC
« Reply #3 - Posted 2013-11-15 01:48:52 »

It seems to me that you are rendering and logic at the same time with two threads.

Offline trollwarrior1
« Reply #4 - Posted 2013-11-15 06:00:36 »

This is pretty big code. Would be messy if I started posting. + you wouldn't even want to look at it. As I posted in the thread, this happens when I spawn first zombie. Obviously this has to do something with initializing static sprites or something.
Offline trollwarrior1
« Reply #5 - Posted 2013-11-15 06:12:02 »

This line in my texture class fixed everything! Cheesy

if(Screen.currentSpriteSheet != null) Screen.currentSpriteSheet.bind();
Pages: [1]
  ignore  |  Print  

EgonOlsen (45 views)
2018-06-10 19:43:48

EgonOlsen (25 views)
2018-06-10 19:43:44

EgonOlsen (47 views)
2018-06-10 19:43:20

DesertCoockie (202 views)
2018-05-13 18:23:11

nelsongames (127 views)
2018-04-24 18:15:36

nelsongames (126 views)
2018-04-24 18:14:32

ivj94 (867 views)
2018-03-24 14:47:39

ivj94 (128 views)
2018-03-24 14:46:31

ivj94 (771 views)
2018-03-24 14:43:53

Solater (143 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!