• What are you working on? V7
    2,001 replies, posted
[QUOTE=Eleventeen;19591594]I want to set it so 1 unit in OpenGL is a pixel and it starts at top-let. Sorry, I'm not good at maths.[/QUOTE] Ok, fine. My code that I provides does that, but you need to change some of the arguments for glOrtho. Look up that function in the documentation. You can also use glVertex2f when doing 2d stuff in opengl. It is exactly the same as glVertex3f(x, y, 0), but it involves less traffic over the bus, and smaller memory footprint in calllists.
[QUOTE=NovembrDobby;19588298]A++ OP would read again several times @s0ul0r if you're still here Nop, using a system that uses the distance of the border from the middle of the shape (at every angle) to determine if they're inside one frame then outside the next, or touching the border in the current frame.[/QUOTE] As if I would leave this forum over night :smugdog:
I just read up on regular expressions and I think I'm in love, they are awesome. For example rather than using some complicated if statements to parse a phone number, now I can just do "^\D*(\d{5})\D*(\d{6})$" and it will get the area code and number for me.
[QUOTE=Cathbadh;19591898]Ok, fine. My code that I provides does that, but you need to change some of the arguments for glOrtho. Look up that function in the documentation. You can also use glVertex2f when doing 2d stuff in opengl. It is exactly the same as glVertex3f(x, y, 0), but it involves less traffic over the bus, and smaller memory footprint in calllists.[/QUOTE] But what about quads?
[QUOTE=iPope;19592126]I just read up on regular expressions and I think I'm in love, they are awesome. For example rather than using some complicated if statements to parse a phone number, now I can just do "^\D*(\d{5})\D*(\d{6})$" and it will get the area code and number for me.[/QUOTE] I find them god awefull to understand.
[QUOTE=iPope;19592126]I just read up on regular expressions and I think I'm in love, they are awesome. For example rather than using some complicated if statements to parse a phone number, now I can just do "^\D*(\d{5})\D*(\d{6})$" and it will get the area code and number for me.[/QUOTE] True but don't overuse regex if you don't have to, if you know where the phone number starts it's most likely quicker to substring the next 5 characters.
[QUOTE=Eleventeen;19592169]But what about quads?[/QUOTE] What about them? Setting up the projection matrix should make everything happy for your dimensions, so you can just treat openGL coordinates as the size of pixels. [code] float x = artGL->startposX; float y = artGL->startposY; float w = artGL->width; float h = artGL->height; glBindTexture(GL_TEXTURE_2D, artGL->texture); glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex2f(x, y); glTexCoord2f(1.0f, 0.0f); glVertex2f(x + w, y); glTexCoord2f(1.0f, 1.0f); glVertex2f(x + w, y + h); glTexCoord2f(0.0f, 1.0f); glVertex2f(x, y + h); glEnd(); [/code]
[QUOTE=Vampired;19592230]True but don't overuse regex if you don't have to, if you know where the phone number starts it's most likely quicker to substring the next 5 characters.[/QUOTE] I agree, but what if you don't know? I think thats where it becomes more useful, for user input ect.
I want to release the library I was gradually writing over the last months open source, but I can't decide on a license. I didn't think that it would be that hard. I just want a license where they can do whatever they want except make money and they have to give credit. All the licenses I found either allow making money or they have to open source their changes/their program too.
[QUOTE=iPope;19592433]I agree, but what if you don't know? I think thats where it becomes more useful, for user input ect.[/QUOTE] Yes yes your example was fine. I would argue that "some 12345 numbers 123456" isn't a valid phone number though ha.
Updated my Chrome plugin =/ [IMG]https://chrome.google.com/extensions/img/bcennaiejdjpomgmmohhpgnjlmpcjmbg/1263324577.84/screenshot_big/1001[/IMG] If anyone wants it, you can get it here : [url]https://chrome.google.com/extensions/detail/bcennaiejdjpomgmmohhpgnjlmpcjmbg[/url] p.s. Its an undo closed tab plugin
[QUOTE=Robber;19592606]I want to release the library I was gradually writing over the last months open source, but I can't decide on a license. I didn't think that it would be that hard. I just want a license where they can do whatever they want except make money and they have to give credit. All the licenses I found either allow making money or they have to open source their changes/their program too.[/QUOTE] Maybe that's because it's a bad idea. You can always write your own license.
Why is it a bad idea? What would you suggest? I just don't want anyone to make money with my work while I'm not getting anything. It's not likely to happen though. :v:
[url=http://creativecommons.org/licenses/by-nc/2.0/]Creative Commons Attribution-Noncommercial 2.0[/url]? And I agree with Ortzinator, it's a bad idea.
My local university is holding a bunch of courses for the public and this one looked interesting. [quote]Programming 3D Computer Graphics in Java This course provides an overview of the techniques in computer graphics that underpin 3D immersive virtual environments. Furthermore, it provides an introduction to programming 3D graphics java using a hands-on programming task so students can experiment with creating their own 3Dvirtual environment. Students will learn the basics of the "tree" data structure, how to build one and how it can be used to create an hierachical structure for simply and logically defining an immersive 3D graphics environment.[/quote] I was at something like this before about game programming and that one really sucked (For me at least) because we spent most of the time listening to some guy talking about games in general like how companies earns alot of money on people getting addicted and when he started talking about programming it was mostly a talk about how c++ sucks and java is awesome. (Because someone asked what language they wanted the students to use) This one at least required you "to be a enthusiastic programmer" so it may be a bit more advanced because it feels like a waste to go just to learn how I load heightmaps with some odd API I never even heard of. The thing is that if I manage to get in to this one (It's only a limited number of persons) I have to spend the second day, because it's a 2 day thing, on another of their courses and they didn't look that interesting.
"Programming [B]3D [/B]Computer Graphics in [B]Java[/B]" That doesn't sound right :raise: It is possible with JOGL, but why not use C++ to learn DX or OpenGL properly or XNA if that's too hard for the average student.
[QUOTE=Robber;19594893]"Programming [B]3D [/B]Computer Graphics in [B]Java[/B]" That doesn't sound right :raise:[/QUOTE] Yeah I know, if it wasn't for that I would go for sure.
[QUOTE=Robber;19594458]Why is it a bad idea? What would you suggest? I just don't want anyone to make money with my work while I'm not getting anything. It's not likely to happen though. :v:[/QUOTE] IANAL, but wouldn't a dual-license scheme such as GPL/INSERT PROPRIETARY LICENSE HERE work best for this? GPL would make it so that nobody could make money out of the library (since they'd need to publish the source code to their application), and you can sell the alternate license to those who wish to make profit off of it. I'd say LGPL, but that would allow people to sell products that contains your library without having to pay you.
I need a name. I'm making a serialization language which uses a main "environment". Should I just call it environment? I kind of think that's a bad name, though.
[code]//! Starts OpenGL. void CVideoLayerOpenGL::initGL(int width, int height, int bits) { // Set up the projection matrix so that a unit in world coordinates corresponds to a pixel's dimension. glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, width, 0, height, -1, 1); // Top left of screen is the origin. glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glDisable(GL_DEPTH_TEST); glClear(GL_COLOR_BUFFER_BIT); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glEnable(GL_TEXTURE_2D); }[/code] That makes it the bottom left, not top left?
[QUOTE=Eleventeen;19595740][code]//! Starts OpenGL. void CVideoLayerOpenGL::initGL(int width, int height, int bits) { // Set up the projection matrix so that a unit in world coordinates corresponds to a pixel's dimension. glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, width, 0, height, -1, 1); // Top left of screen is the origin. glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glDisable(GL_DEPTH_TEST); glClear(GL_COLOR_BUFFER_BIT); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glEnable(GL_TEXTURE_2D); }[/code]That makes it the bottom left, not top left?[/QUOTE] You didn't look at the documentation for glOrtho like I told you to, did you? You want: glOrtho(0, width, -height, 0, -1, 1);
[QUOTE=Cathbadh;19596128]You didn't look at the documentation for glOrtho like I told you to, did you? You want: glOrtho(0, width, -height, 0, -1, 1);[/QUOTE] I did, and it doesn't help [i]because I don't know maths[/i]. Also, that didn't work. Now nothing is on the screen.
[QUOTE=noctune9;19595319]I need a name. I'm making a serialization language which uses a main "environment". Should I just call it environment? I kind of think that's a bad name, though.[/QUOTE] Just translate "penis" into some obscure language.
[QUOTE=Eleventeen;19596293]I did, and it doesn't help [I]because I don't know maths[/I]. Also, that didn't work. Now nothing is on the screen.[/QUOTE] Well, because the origin is at the top left of the screen, the only things that are gonna show up on screen are objects that have a positive x position, and a negative y position (within the bounds of the screen dimensions) It's not like there's any real math in this example, the most you have to be able to conceptually do is draw a dot on a piece of graph paper given a set of coordinates. For your sake, I'm gonna assume you have enough math skills to pass the 4th grade. glOrtho handles the matrix math for you. If something showed up onscreen when you were using glOrtho(0,width,0,height,-1,1) then you can try doing glOrtho(0,width,height,0,-1,1) and the origin will be where you want, and the stuff should show up on screen, but the image will be vertically mirrored.
[QUOTE=Cathbadh;19597268]I'm gonna assume you have enough math skills to pass the 4th grade[/QUOTE] :|
Just messing with the Slick API for Java right now. I've been looking for a Java equivalent to SDL/SFML, and in the five minutes I've messed with it, Slick seems nice so far. It handles window creation, input, graphics, and sound, letting you worry about the actual application logic itself.
You didn't include my game, I'm kind of disappointed. lol.
So I remade my voxel raytracer the right way, now it uses a bounding box and everything, and I threw in some ambient occlusion to make it pretty. It's still very buggy but whatever. [IMG]http://imgur.com/91cLX.png[/IMG]
Has anybody here used boost::gil with OpenGL/DirectX with decent performance? I'm considering using it, and just winging it for TGA files :v:
[QUOTE=Chandler;19599435]Has anybody here used boost::gil with OpenGL/DirectX with decent performance? I'm considering using it, and just winging it for TGA files :v:[/QUOTE] I haven't used boost, but it's easy enough to make your own TGA loader. The file format is pretty straightforward.
Sorry, you need to Log In to post a reply to this thread.