Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Lwjgl OpenGL Help

Name: Derp 2013-01-18 1:37

Question:
Question;
I've made my top-down minecraftlike game to a point. Dynamic/adjustable types, basic entities, player movement, a worldgen...
However.
This whole time I didn't understand that I needed to code the game to use a Video card via OpenGL and stuff, so the game lags like a whore by only using CPU power to display everything.
So, I'm looking into lwjgl(Yes, I'm using Java), and following some tutorials I understand 'kinda' how to draw basic 2D shapes using OpenGL.
However, I am stuck.
There seem to be multiple ways of displaying a graphic?
DisplayLists, and Vertex Buffers?
I have NO idea what I am doing here.
Do I somehow have the video card calculate the layers of images I am making?
Or is it 'purely' for display?
Sorry if the answer seems obvious, but although I know coding enough to do alot of stuff, this OpenGL stuff seems way over my head and I'm not exactly sure what computer logic I am trying to follow.

Name: Anonymous 2013-01-18 1:37

Ignore the fact I said question twice.

Name: Anonymous 2013-01-18 1:54

>>1
There are a lot of things that serve the same purpose but carry different levels of restrictions. Restrictions help faster implementation of the feature, so you should use the most restrictive method that still enables you to get what you need. Just take your time, start with something simple. Then work your way up to the point where you feel comfortable with implementing a game in it. Although it sounds like you are just doing 2D graphics?

Name: Anonymous 2013-01-18 2:05

>>3
Yup. I mean, maybe in the future I might allow the player to travel though space off the planet he is on, and the space travel might be 3D.
however, right now I am just focusing on 2D. Most of all my code will be in 2D.

I would just start small, but I'm not even sure how/where to start. I'm trying to figure out how to process my sprites right and minimize lag, because right now my game gets ~15fps while ingame, and this pc can run gamecube emulators flawlessly, so obviously the lag is from the code somewhere. I assumed it was because of how I am not currently using OpenGL and I could pass some of the work to the Videocard somehow, or something.

Name: Anonymous 2013-01-18 2:10

>>4
First of all, are you certain the slow down is coming from the graphics? If you have a profiler, use it and compare how expensive the routines are. Do they match up with what you would expect? If not, try disabling the graphics or reducing them to a point where you know it would be efficient. If the game is still slow it's coming from something else. Also just draw everything as color coded triangles at first. Or whatever works in the short term. This sort of thing is useful to have for debugging anyway.

Name: Anonymous 2013-01-18 2:17

>>5
Can somewhat large, well put together game actually run okay without using OpenGL?
I talked to someone about the lag before, I gave them a rough idea of what I was doing with everything, and they just chalked it down to needing to do some work with OpenGL and let the graphics card do some of the work.
I guess I can set up a profiler. I don't have one yet, but I can imagine it would work something like comparing times between some things and see how much lag happens between them all.
Thanks for your replies so far.

Name: Anonymous 2013-01-18 3:29

>>6
Maybe. Computers weren't always fast, and video cards didn't always exist, but people still managed to (very creatively) make games for them. Is the frame rate proportional to the number of entities, etc, currently on the screen? If so, then open gl can help with that. If performance is still bad, then maybe you're using an O(n^2) algorithm somewhere in the code that updates the world.

Name: Anonymous 2013-01-18 3:45

>>1

Notch, how many times do we have to tell you, stop spamming 4chan every time you can't figure something out.

Name: Anonymous 2013-01-18 4:04

>>8
Lol'd.

>>7
Well, I know computers didn't already use Videocards and such, but games were also built differently.
Reguardless, thanks. I do think it's something with my code(More specifically, a way I handle tiles). Maybe someday I'll switch to using OpenGL, but now I think immediate mode will serve me well enough.

Name: Anonymous 2013-01-18 4:17

>>9
Remember, when a scientist has a theory but not enough material to back it up, they perform experiments. Right now you are presenting theories about sources of the slow down. While you are in a good position to judge, you should confirm your theories with experiments.

Name: Anonymous 2013-01-18 5:44

>>10
when a scientist has a theory but not enough material to back it up, they...
...call it "mathematics".

that way they got "Infinite Sets" and divided space into "infinitesimals"

today they have "string theory" and a myriad of other theories.

Name: Anonymous 2013-01-18 6:08

>>11
cretin.

Name: Anonymous 2013-01-18 6:19

>>12
Shalom, Hymie!

Name: Anonymous 2013-01-18 7:21

I haven't coded in OpenGL for over ten years, but didn't they switch from some state machine model where you'd, say, set the brush colour to red then draw a circle, to some gay list shit where you basically did all the steps at once?

Name: Anonymous 2013-01-18 9:48

>>14
I guess display lists where a hot thing about 10 years ago. Nowadays it's a bit different, you basically just create buffers where you put vertex data and then write a couple of shaders that deside how stuff will actually look like. Then you just call glDrawArrays/glDrawElements and the implementation dumps your buffers to the shaders on GPU.

Name: Anonymous 2013-01-18 22:07

bumpaya~

Name: Anonymous 2013-01-19 23:12

restoring...

Don't change these.
Name: Email:
Entire Thread Thread List